README.md in capistrano-rails-1.1.7 vs README.md in capistrano-rails-1.1.8

- old
+ new

@@ -5,15 +5,15 @@ - `cap deploy:migrate` - `cap deploy:compile_assets` ## Installation -Add this line to your application's Gemfile: +Add these lines to your application's Gemfile: ```ruby group :development do - gem 'capistrano', '~> 3.1' + gem 'capistrano', '~> 3.6' gem 'capistrano-rails', '~> 1.1' end ``` Run the following command to install the gems: @@ -52,13 +52,16 @@ ```ruby # If the environment differs from the stage name set :rails_env, 'staging' -# Defaults to 'db' -set :migration_role, 'migrator' +# Defaults to :db role +set :migration_role, :db +# Defaults to the primary :db server +set :migration_servers, -> { primary(fetch(:migration_role)) } + # Defaults to false # Skip migration if files in db/migrate were not modified set :conditionally_migrate, true # Defaults to [:web] @@ -73,14 +76,10 @@ # Defaults to nil (no asset cleanup is performed) # If you use Rails 4+ and you'd like to clean up old assets after each deploy, # set this to the number of versions to keep set :keep_assets, 2 - -# Defaults to the primary :db server -set :migration_role, :db -set :migration_servers, -> { primary(fetch(:migration_role)) } ``` ### Symlinks You'll probably want to symlink Rails shared files and directories like `log`, `tmp` and `public/uploads`. @@ -89,9 +88,22 @@ ```ruby # deploy.rb set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads') set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml') ``` + +### Recommendations + +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 +role to `:app` instead of `:db` like: + +```ruby +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. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)