In this blog post I’ll show you small yet powerful capifony’s multistage extension. Before I found out about this extension I was continuously deploying to development and production server by changing contents of deploy.rb file - this is the main configuration file of capifony. By using this extension you’ll have one command for development another one for production server and you won’t need to worry anymore if you’ve entered correct information for your server.
First replace contents of your deploy.rb with this code.
Next create prod.rb file in app/config. Make sure its contents are like your usual deploy.rb file and fill it with server information for production server. Afterwards do the same for dev.rb but use the information for you development server.
If you have multiple staging servers you can just add them
set :stages, %w(prod dev dev1 dev2 dev3).
Don’t forget to create configuration files for each one of them.
To deploy on production:
cap prod deploy
To deploy on development:
cap dev deploy or
By using multistage extension we save ourselves a lot of time as we don’t have to change the information manually. Next time I’ll definitely be paying more attention to documentation and cookbooks of software products I regularly use.
This post is on GitHub. If you spot any errors please do a pull request.
comments powered by Disqus