wblog/config/deploy.rb

61 lines
1.7 KiB
Ruby
Raw Normal View History

set :stages, %w(en zh)
set :default_stage, 'zh'
2015-04-08 00:15:02 +08:00
require 'mina/multistage'
2014-04-01 22:54:58 +08:00
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
2016-04-24 15:22:24 +08:00
require 'mina/rvm'
require 'mina/puma'
2015-04-12 00:59:38 +08:00
require 'mina_sidekiq/tasks'
2014-04-01 22:54:58 +08:00
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server.
# They will be linked in the 'deploy:link_shared_paths' step.
2016-04-24 15:22:24 +08:00
set :shared_paths, ['config/database.yml', 'config/application.yml', 'log', 'tmp', 'public/uploads', 'public/personal' ]
# rvm path
set :rvm_path, '/usr/local/rvm/scripts/rvm'
2014-04-01 22:54:58 +08:00
task :environment do
2016-04-24 15:22:24 +08:00
invoke :'rvm:use[2.2.3]'
2014-04-01 22:54:58 +08:00
end
task :setup => :environment do
2014-04-02 19:55:04 +08:00
['config', 'log', 'tmp', 'public/uploads', 'public/personal'].each do |dir|
2014-04-01 22:54:58 +08:00
queue! %[mkdir -p "#{deploy_to}/shared/#{dir}"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/#{dir}"]
end
2016-04-24 15:22:24 +08:00
['config/database.yml', 'config/application.yml'].each do |file|
2014-04-01 22:54:58 +08:00
queue! %[touch "#{deploy_to}/shared/#{file}"]
queue %[echo "-----> Be sure to edit 'shared/#{file}'."]
end
2014-04-03 10:34:25 +08:00
queue! %[mkdir -p "#{deploy_to}/shared/pids/"]
2015-04-08 00:15:02 +08:00
queue! %[mkdir -p "#{deploy_to}/shared/tmp/sockets"]
queue! %[mkdir -p "#{deploy_to}/shared/tmp/pids"]
2014-04-03 10:34:25 +08:00
queue! %[mkdir -p "#{deploy_to}/shared/log/"]
2014-04-01 22:54:58 +08:00
end
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
to :launch do
2016-04-24 17:04:17 +08:00
# Insure puma is start when restart it
invoke :'puma:start'
invoke :'puma:phased_restart'
2015-04-12 00:59:38 +08:00
invoke :'sidekiq:restart'
2014-04-01 22:54:58 +08:00
end
2016-04-24 15:58:24 +08:00
invoke :'deploy:cleanup'
2014-04-01 22:54:58 +08:00
end
end