Deploying a symfony application

Define your target server

Edit /config/properties.ini:

1
2
3
4
5
[stage]
  host=192.168.xx.yyy
  port=22
  user=myuser
  dir=/the/project/root

Test your deployment configuration

php symfony project:deploy stage

Preserve the production data

php symfony doctrine:data-dump data/production.yml

I would do it in a successive step, but, deploying, you could upload a different model schema: then, when dumping the data, Doctrine won’t be able to map the data in the database and your model schema.

Deploy

php symfony project:deploy stage --go

Test target server configuration

1
2
3
4
5
ssh [email protected]

cd /the/project/root

php lib/vendor/symfony/data/bin/check_configuration.php 

Re-configure the DBs

1
2
3
php symfony configure:database "mysql:host=localhost;dbname=production_test" user pwd --env=test

php symfony configure:database "mysql:host=localhost;dbname=production" user pwd

Build the environments

1
2
php symfony doctrine:build --all --and-load --env=test
php symfony doctrine:build --all

Load production data on production DB ( if a migration is needed… migrate! )

php symfony doctrine:data-load data/production.yml

Test the environment

php symfony test:all

Heal the environment

1
2
3
4
5
php symfony cc

php symfony project:permissions

php symfony project:optimize frontend prod 

I’m pretty sure something is missing here, hope to see some replies.


Hi there! I recently wrote an ebook on web application security, currently sold on leanpub, the Amazon Kindle store and gumroad.

It contains 160+ pages of content dedicated to securing web applications and improving your security awareness when building web apps, with chapters ranging from explaining how to secure HTTP cookies with the right flags to understanding why it is important to consider joining a bug bounty program.

Feel free to skim through some of the free chapters published on this blog and, if the content seems interesting enough to you, grab a copy on leanpub, the Amazon Kindle store, gumroad or simply checkout right down below!

Buy the Web Application Security ebook for $9.99

In the mood for some more reading?

...or check the archives.