update mina version

This commit is contained in:
yafeilee 2017-05-01 13:37:07 +08:00
parent c36f7e5477
commit 24b0273643
3 changed files with 62 additions and 35 deletions

10
Gemfile
View File

@ -36,12 +36,12 @@ gem 'newrelic_rpm'
gem 'puma' gem 'puma'
gem 'mina', require: false gem 'mina', '~> 1.0.6', require: false
gem 'mina-puma', '~> 1.0.1', require: false
gem 'mina-multistage', '~> 1.0.3', require: false
gem 'mina-sidekiq', '~> 1.0.1', require: false
gem 'mina-logs', '~> 1.0.1', require: false
gem 'mina-multistage', require: false
gem 'mina-sidekiq', require: false
gem 'mina-puma', require: false
gem 'mina-logs', require: false
gem 'browser_warrior' gem 'browser_warrior'
group :development do group :development do

View File

@ -372,11 +372,11 @@ DEPENDENCIES
js_cookie_rails js_cookie_rails
kaminari! kaminari!
listen (~> 3.x) listen (~> 3.x)
mina mina (~> 1.0.6)
mina-logs mina-logs (~> 1.0.1)
mina-multistage mina-multistage (~> 1.0.3)
mina-puma mina-puma (~> 1.0.1)
mina-sidekiq mina-sidekiq (~> 1.0.1)
mini_magick mini_magick
newrelic_rpm newrelic_rpm
nokogiri nokogiri

View File

@ -7,52 +7,79 @@ require 'mina/rails'
require 'mina/git' require 'mina/git'
require 'mina/rvm' require 'mina/rvm'
require 'mina/puma' require 'mina/puma'
require 'mina_sidekiq/tasks' require "mina_sidekiq/tasks"
require 'mina/logs' require 'mina/logs'
# Manually create these paths in shared/ (eg: shared/config/database.yml) in your server. set :shared_dirs, fetch(:shared_dirs, []).push('log', 'public/uploads', 'public/personal')
# They will be linked in the 'deploy:link_shared_paths' step. set :shared_files, fetch(:shared_files, []).push('config/database.yml', 'config/application.yml')
set :shared_paths, ['config/database.yml', 'config/application.yml', 'log', 'tmp', 'public/uploads', 'public/personal' ]
set :sidekiq_pid, ->{ "#{fetch(:shared_path)}/tmp/pids/sidekiq.pid" }
task :environment do task :environment do
invoke :'rvm:use[2.3.1]' invoke :'rvm:use', '2.3.1'
end end
task :setup => :environment do task :setup => :environment do
['config', 'log', 'tmp', 'public/uploads', 'public/personal'].each do |dir| command %[mkdir -p "#{fetch(:shared_path)}/tmp/sockets"]
queue! %[mkdir -p "#{deploy_to}/shared/#{dir}"] command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/tmp/sockets"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/#{dir}"]
end
['config/database.yml', 'config/application.yml'].each do |file| command %[mkdir -p "#{fetch(:shared_path)}/tmp/pids"]
queue! %[touch "#{deploy_to}/shared/#{file}"] command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/tmp/pids"]
queue %[echo "-----> Be sure to edit 'shared/#{file}'."]
end
queue! %[mkdir -p "#{deploy_to}/shared/pids/"] command %[mkdir -p "#{fetch(:shared_path)}/log"]
queue! %[mkdir -p "#{deploy_to}/shared/tmp/sockets"] command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/log"]
queue! %[mkdir -p "#{deploy_to}/shared/tmp/pids"]
queue! %[mkdir -p "#{deploy_to}/shared/log/"] command %[mkdir -p "#{fetch(:shared_path)}/public/uploads"]
command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/public/uploads"]
command %[mkdir -p "#{fetch(:shared_path)}/config"]
command %[chmod g+rx,u+rwx "#{fetch(:shared_path)}/config"]
command %[touch "#{fetch(:shared_path)}/config/application.yml"]
command %[echo "-----> Be sure to edit '#{fetch(:shared_path)}/config/application.yml'"]
command %[touch "#{fetch(:shared_path)}/config/database.yml"]
command %[echo "-----> Be sure to edit '#{fetch(:shared_path)}/config/database.yml'"]
end end
desc "Deploys the current version to the server." desc "Deploys the current version to the server."
task :deploy => :environment do task :deploy => :environment do
command %[echo "-----> Server: #{fetch(:domain)}"]
command %[echo "-----> Path: #{fetch(:deploy_to)}"]
command %[echo "-----> Branch: #{fetch(:branch)}"]
deploy do deploy do
# Put things that will set up an empty directory into a fully set-up invoke :'sidekiq:quiet'
# instance of your project.
invoke :'git:clone' invoke :'git:clone'
invoke :'deploy:link_shared_paths' invoke :'deploy:link_shared_paths'
invoke :'bundle:install' invoke :'bundle:install'
invoke :'rails:db_migrate' invoke :'rails:db_migrate'
invoke :'rails:assets_precompile' invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
to :launch do on :launch do
# Insure puma is start when restart it invoke :'rvm:use', '2.3.1'
invoke :'puma:start' invoke :'puma:hard_restart'
invoke :'puma:phased_restart'
invoke :'sidekiq:restart' invoke :'sidekiq:restart'
end end
end
invoke :'deploy:cleanup' end
desc "Deploys the current version to the server."
task :first_deploy => :environment do
command %[echo "-----> Server: #{fetch(:domain)}"]
command %[echo "-----> Path: #{fetch(:deploy_to)}"]
command %[echo "-----> Branch: #{fetch(:branch)}"]
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'deploy:cleanup'
on :launch do
invoke :'rvm:use', '2.3.1'
invoke :'rails:db_create'
end
end end
end end