3

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?

greg0ire
  • 22,714
  • 16
  • 72
  • 101
Karol F
  • 1,556
  • 2
  • 18
  • 33

1 Answers1

4

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.

Inoryy
  • 8,365
  • 2
  • 39
  • 40
  • you mean I should have one server per environment? What about shared hosting, when my hosting provider offer: "localhost" only for database host – Karol F May 26 '13 at 18:01
  • You don't need two different servers. Just deploy to different domains / virtual hosts like stage.myapp.com (staging) and myapp.com (for prod). Create two databases myapp_staging and myapp_production and use the parameters.yml on the remote server to link to these. – webDEVILopers Jan 16 '15 at 13:24