Plugin for Mina that adds support for multiple stages.
Plugin for Mina that adds support for multiple stages.
Add this line to your application's Gemfile:
gem 'mina-multistage', require: falseAnd then execute:
$ bundleOr install it yourself as:
$ gem install mina-multistageRequire mina/multistage in your config/deploy.rb:
require 'mina/multistage'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
...
task setup: :environment do
...
end
desc 'Deploys the current version to the server.'
task deploy: :environment do
...
endThen run:
$ bundle exec mina multistage:initThis will create config/deploy/staging.rb and config/deploy/production.rb stage files.
Use them to define stage specific configuration.
If you receive the following error, make sure that you've required 'mina/multistage' in
your config/deploy.rb
$ bundle exec mina multistage:init
mina aborted!
Don't know how to build task 'multistage:init'# config/deploy/staging.rb
set :domain, 'example.com'
set :deploy_to, '/var/www/my_app'
set :repository, 'https://github.com/user/repo'
set :branch, 'master'
set :user, 'www'
set :rails_env, 'staging'Now you can deploy the default stage with:
$ mina deploy # this deploys staging by defaultOr specify a stage explicitly:
$ mina staging deploy
$ mina production deploystages - array of stages names, the default is the name of all *.rb files from stages_dir
stages_dir - stages files directory, the default is config/deploy
default_stage - default stage, the default is staging
If you want to override the default values for any of these options, they should be set before requiring mina/multistage.
# config/deploy.rb
set :stages, %w(development test staging production)
set :stages_dir, 'config/deploy_stages'
set :default_stage, 'development'
require 'mina/multistage'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
...
task setup: :environment do
...
end
desc 'Deploys the current version to the server.'
task deploy: :environment do
...
endgit checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)