Search code examples
symfonydeploymentcapifony

capifony multistage deployment and database configuration per stage


I found excellent tool called capifony which is very very useful while developing symfony2 application and I want to work with multistage option. All works fine, but I have one problem with database configuration for other stages.

Suppose we have:

  • 3 environments: development, production, staging
  • 3 servers: local - development, my.site.com - production and staging.my.site.com - staging

How to setup capifony for this standard multistage example?

When we call:

cap production deploy:migrations 

or

cap staging deploy:migrations 

the capifony use the

--env=prod

for all symfony's console commands. There is a problem, because we call:

app/console doctrine:migrations:migrate --env=prod

for staging server, but the database configuration used for it is "prod" so we run schema update in production settings... How to solve it?


Solution

  • Solution to your original question is simple, use set :symfony_env_prod, "staging" in deploy.rb

    However, you seem to be mixing servers with environments.

    Each server should be treated as a complete package and support any environment (i.e. dev server with production environment), including having separate databases.

    Furthermore, staging server setup should be as close to production as possible (that is whole point of the staging server), so it should be run on production environment.