Random stuff, WIP, bits and pieces from a random web developer.
Deploying a Symfony project with Capifony
Written around Jul 29, 2015 - tags: symfony and capifony
I have been working with Symfony2 for a while now and recently I have been looking at deploying symfony projects on remote servers (in my case, [AWS]) without having to SSH and manually run whatever commands the projects need to be run.
In order to run capifony, you will need to install ruby:
Once you have ruby and capifony installed, go ahead and capifony your symfony project:
The last command will create a Capfile at the root of your folder, and a deploy.rb in app/config/.
You shouldn’t have to change anything in your Capfile. Most of the changes will be done in app/config/deploy.rb.
Capifony’s website describes pretty well how to simply setup a deployment so I am just going to be lazy and dump my configuration, and explain what it does :)
I use capifony in a multistage environment (staging and production) which I keep in:
app/config/environments/production.rb
app/config/environments/staging.rb
The two files contains the differences between the two servers (two stages).
For instance: the hostname is different, the git branch I want to deploy is different (development on staging and master on production)
server production-awesome is the hostname I have setup in my ~/.ssh/config
With the above deploy settings, I can easily deploy on my staging remote server by running:
There is no need to specify the staging environment as it is the default (set by default_stage)
And on production:
If you change the logger.level to Logger::IMPORTANT, the output of your capifony deployment will look a bit sexier than the other levels