helpers, command mapping, logging etc
desc "Notify service of deployment"
task :notify do
run_locally do
with rails_env: :development do
rake 'service:notify'
end
end
end
desc "Ask about breakfast"
task :breakfast do
ask(:breakfast, "kiełbasa")
on roles(:all) do |h|
execute "echo \"$(whoami) wants #{fetch(:breakfast)} for breakfast!\""
end
end
bundle exec capify .
bundle exec cap install
bundle exec cap install STAGES=staging,production
set(:bundle_cmd) { File.join(bundle_dir, 'bin/bundle') }
set :bundle_cmd, -> { File.join(fetch(:bundle_dir), 'bin/bundle') }
set :application, 'massmailer'
fetch :mieso_type, 'kiełbasa'
fetch(:default_env).merge!(rails_env: :production)
set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{pids log public/system}
on :all, in: :groups, max: 3, wait: 5 do
# Take all servers, in groups of three which execute in parallel
# wait five seconds between groups of servers.
# This is perfect for rolling restarts
end
on :all, in: :sequence, wait: 15 do
# This takes all servers, in sequence and waits 15 seconds between
# each server, this might be perfect if you are afraid about
# overloading a shared resource, or want to defer the asset compilation
# over your cluster owing to worries about load
end
on :all, in: :parallel do
# This will simply try and execute the commands contained within
# the block in parallel on all servers. This might be perfect for kicking
# off something like a Git checkout or similar.
end
require 'sshkit/dsl'
on %w{knapo.net knapo2.net}, in: :sequence, wait: 5 do
within "/home/knapo" do
with rails_env: :production do
rake "db:migrate"
runner "S3::Sync.notify"
end
end
end