Rails specific tasks for Capistrano v3:
Add these Capistrano gems to your application's Gemfile using
group :development do gem "capistrano", "~> 3.10", require: false gem "capistrano-rails", "~> 1.4", require: false end
Run the following command to install the gems:
Then run the generator to create a basic set of configuration files:
bundle exec cap install
Require everything (
# Capfile require 'capistrano/rails'
Or require just what you need manually:
# Capfile require 'capistrano/bundler' # Rails needs Bundler, right? require 'capistrano/rails/assets' require 'capistrano/rails/migrations'
Please note that any
requires should be placed in
Capfile, not in
You can tweak some Rails-specific options in
You'll probably want to symlink Rails shared files and directories like
Make sure you enable it by setting
# deploy.rb append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', '.bundle', 'public/system', 'public/uploads' append :linked_files, 'config/database.yml', 'config/secrets.yml'
In capistrano < 3.5, before
append was introduced, you can use
push to get the same result.
While migrations looks like a concern of the database layer, Rails migrations
are strictly related to the framework. Therefore, it's recommended to set the
:app instead of
set :migration_role, :app
The advantage is you won't need to deploy your application to your database server, and overall a better separation of concerns.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request