Capistrano deploys but manually triggers migration

I am using Capistrano to deploy a Rails application. I am thinking about a situation where there were database changes, so I can’t just cap deploybecause the migration has to be done before the code is updated. I understand there cap deploy:migrations, but it's a little more automatic than I would like. I would like to:

  • Click the new code in the release catalog, but do not update the symlink or restart the application.
  • ssh to the server, run rake:db_abort_if_pending_migrationsto confirm that the migrations that I want to run are the only ones postponed, and then run rake db:migratemanually.
  • Complete the deployment, update the symbolic link, and restart the application.

Is there an easy way to do this with Capistrano's built-in tasks, or will I need to write my own deployment steps to complete this?

I should also mention that I am considering cases (e.g. adding columns) where migration can be performed in a live database. For more disruptive changes, I understand that I will need to tear down the site with the maintenance page during deployment.

+5
source share
1 answer

Try:

  • cap deploy:update_code

  • Follow what you described to enter the server manually or through cap shell

  • cap deploy:symlink deploy:restart

See more details cap -e deploy:update_code deploy:symlink deploy:restart deploy:shell.

Hope this will be helpful for you.

+5
source

All Articles