[How to] Managing Symphony on Amazon Elastic Beanstalk (AWS PAAS)
This is an open discussion with no replies, filed under General.
Search
Create an account or sign in to comment.
This is an open discussion with no replies, filed under General.
Create an account or sign in to comment.
Quick Links
Symphony • Open Source XSLT CMS
--with-xsl
)
I am posting this so that anyone trying to deploy a Symphony installation on AWS will have a guide.
Elastic Beanstalk is AWS's PAAS (Platform as a Service). Essentially, it is an layer of abstraction that a PHP application like Symphony sits in. Elastic Beanstalk manages the Load Balancer and the EC2 (server) instances. It also generates a RDS (database) instance for your application to connect to.
Because EB is an application deployment service, the server can only run the application itself. Unfortunately, this makes running Symphony on AWS a little bit more difficult.
config.php
cannot be different from the local and production copy. Normally, one would change the database on the production config.php or change a symlink to another file. This cannot be done since you cannot access applications files once deployed.To solve #1, all uploaded media must be hosted on S3, using the s3upload_field.
To solve #2, use AWS Environment Variables. In the root of your Symphony project, create a directory
.ebextensions
and add a file in there.ebextensions/environment.config
with the following contents: optionsettings: - optionname: APP_ENV value: localThen open up
manifest/config.php
and add this to the bottom (I have also included CDI settings in case you use CDI).Deploy your application with
git aws.push
. Then open up the AWS Management Console, select Elastic Beanstalk, go to your environment, and click "Configuration". Select "Software Configuration" and changeAPP_ENV
to "production". We are doing this because you might want to setup different environments for staging, development, etc.environment.config
must be constant, so instead overwrite the variable in the AWS Console.To solve #3, you must use Composer to install all extensions or manually put the folders in.
===============
I hope this was helpful for anyone trying to use AWS to deploy Symphony. Switching to AWS obviously has many benefits. Personally, I saw a speed improvement with Symphony's page creation from 1.5s to 0.3s (5x faster) after moving to AWS from shared hosting. Elastic Beanstalk automatically scales your application as well, so if you become really popular suddenly, you will have to do nothing manually.