0

While deploying a Symfony application using Capifony I am having issues changing the stage while issuing commands. I would like to push my database from production to beta when deploying.

This is my attempt at doing this. Here is the beta.rb file:

set :deploy_to, "/var/www/#{domain}/deploy/beta"

after "deploy", "deploy:cleanup"

# Move database from production to beta and dev
# Set stage to production, move database to local
set :stage, "prod"
after "deploy", "database:move:to_local"

# Set stage back to beta, move database to remote beta
set :stage, "beta"
after "deploy", "database:move:to_remote"

In the past I have stored the cap files outside of the project using capistrano and symfony < 2 and used scripts to deal with stuff like this. With it now in the project it doesn't make sense to have scripts in the project.

Am I able to change the stage on the fly when executing commands like this? Or should I create a task to call an external script?

Thanks!

Adam Elsodaney
  • 7,722
  • 6
  • 39
  • 65
nux
  • 153
  • 1
  • 8

1 Answers1

0

You can use the DoctrineMigrationsBundle for such purposes. This bundle is very versatile and has neat console command line interface, which you can simply build into your capifony script. Read about it in the symfony and its own reference docs:

http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html
https://github.com/doctrine/DoctrineMigrationsBundle/blob/master/Resources/doc/index.rst

Debreczeni András
  • 1,597
  • 10
  • 18
  • Thanks for this info. This bundle does look useful, but I am primarily interested in moving data. – nux Jun 25 '14 at 18:39