demarches-normaliennes/lib/tasks/deploy.rake

41 lines
895 B
Ruby
Raw Normal View History

def domains_for_stage
if ENV['DOMAINS'].present?
ENV['DOMAINS'].split
2018-10-23 18:26:23 +02:00
else
raise "DOMAINS is empty. It must be something like DOMAINS='web1.dev web2.dev'"
end
end
task :setup do
domains = domains_for_stage
domains.each do |domain|
sh "mina setup domain=#{domain}"
2018-09-03 18:36:09 +02:00
end
end
task :deploy do
domains = domains_for_stage
branch = ENV.fetch('BRANCH')
2018-09-03 18:36:09 +02:00
domains.each do |domain|
sh "mina deploy domain=#{domain} branch=#{branch} force_asset_precompile=true"
end
end
task :post_deploy do
domains = domains_for_stage
branch = ENV.fetch('BRANCH')
sh "mina post_deploy domain=#{domains.first} branch=#{branch}"
end
2020-05-14 16:11:00 +02:00
task :rollback do
domains = domains_for_stage
2020-05-14 16:11:00 +02:00
branch = ENV.fetch('BRANCH')
domains.each do |domain|
sh "mina rollback service:restart_puma service:reload_nginx service:restart_delayed_job domain=#{domain} branch=#{branch}"
2020-05-14 16:11:00 +02:00
end
end