add English blog deploy configration
This commit is contained in:
parent
5d70203684
commit
44236edd2e
4
Gemfile
4
Gemfile
|
@ -36,6 +36,10 @@ gem 'rest-client'
|
|||
gem 'unicorn'
|
||||
gem 'newrelic_rpm'
|
||||
|
||||
gem 'mina', require: false
|
||||
gem 'mina-multistage', require: false
|
||||
gem 'mina-unicorn', :require => false
|
||||
|
||||
group :development do
|
||||
gem 'spring'
|
||||
gem 'quiet_assets'
|
||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -125,6 +125,12 @@ GEM
|
|||
mime-types (>= 1.16, < 3)
|
||||
method_source (0.8.2)
|
||||
mime-types (2.4.3)
|
||||
mina (0.3.3)
|
||||
open4 (~> 1.3.4)
|
||||
rake
|
||||
mina-multistage (0.1.1)
|
||||
mina (>= 0.2.1)
|
||||
mina-unicorn (0.0.4)
|
||||
mini_magick (4.1.0)
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.5.1)
|
||||
|
@ -158,6 +164,7 @@ GEM
|
|||
notiffany (0.0.6)
|
||||
nenv (~> 0.1)
|
||||
shellany (~> 0.0)
|
||||
open4 (1.3.4)
|
||||
optionable (0.2.0)
|
||||
origin (2.1.1)
|
||||
pry (0.10.1)
|
||||
|
@ -311,6 +318,9 @@ DEPENDENCIES
|
|||
html_truncator
|
||||
jbuilder
|
||||
jquery-rails
|
||||
mina
|
||||
mina-multistage
|
||||
mina-unicorn
|
||||
mini_magick
|
||||
mongoid
|
||||
mongoid-pagination
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
require 'mina/multistage'
|
||||
require 'mina/bundler'
|
||||
require 'mina/rails'
|
||||
require 'mina/git'
|
||||
require 'mina/rvm' # for rvm support. (http://rvm.io)
|
||||
require 'mina/unicorn'
|
||||
|
||||
set :domain, 'yafeilee.me'
|
||||
set :deploy_to, '/home/ruby/wblog'
|
||||
set :repository, 'git@github.com:windy/wblog.git'
|
||||
set :branch, 'master'
|
||||
set :app_path, "#{deploy_to}/#{current_path}"
|
||||
set :stages, %w(en zh)
|
||||
set :default_stage, 'zh'
|
||||
|
||||
# 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.
|
||||
set :shared_paths, ['config/mongoid.yml', 'config/application.yml', 'log', 'tmp', 'public/uploads', 'public/personal' ]
|
||||
|
||||
set :user, 'ruby' # Username in the server to SSH to.
|
||||
|
||||
task :environment do
|
||||
queue! %[source /usr/local/rvm/scripts/rvm]
|
||||
queue! %[rvm use 2.0.0]
|
||||
|
@ -32,6 +29,8 @@ task :setup => :environment do
|
|||
end
|
||||
|
||||
queue! %[mkdir -p "#{deploy_to}/shared/pids/"]
|
||||
queue! %[mkdir -p "#{deploy_to}/shared/tmp/sockets"]
|
||||
queue! %[mkdir -p "#{deploy_to}/shared/tmp/pids"]
|
||||
queue! %[mkdir -p "#{deploy_to}/shared/log/"]
|
||||
end
|
||||
|
||||
|
@ -51,38 +50,3 @@ task :deploy => :environment do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
namespace :unicorn do
|
||||
set :unicorn_pid, "#{app_path}/tmp/pids/unicorn_wblog.pid"
|
||||
set :start_unicorn, %{
|
||||
cd #{app_path} && bundle exec unicorn -c config/unicorn/#{rails_env}.rb -E #{rails_env} -D
|
||||
}
|
||||
|
||||
# Start task
|
||||
# ------------------------------------------------------------------------------
|
||||
desc "Start unicorn"
|
||||
task :start => :environment do
|
||||
queue 'echo "-----> Start Unicorn"'
|
||||
queue! start_unicorn
|
||||
end
|
||||
|
||||
# Stop task
|
||||
# ------------------------------------------------------------------------------
|
||||
desc "Stop unicorn"
|
||||
task :stop do
|
||||
queue 'echo "-----> Stop Unicorn"'
|
||||
queue! %{
|
||||
mkdir -p "#{app_path}/tmp/pids"
|
||||
test -s "#{unicorn_pid}" && kill -QUIT `cat "#{unicorn_pid}"` && rm -rf "#{unicorn_pid}" && echo "Stop Ok" && exit 0
|
||||
echo >&2 "Not running"
|
||||
}
|
||||
end
|
||||
|
||||
# Restart task
|
||||
# ------------------------------------------------------------------------------
|
||||
desc "Restart unicorn using 'upgrade'"
|
||||
task :restart => :environment do
|
||||
invoke 'unicorn:stop'
|
||||
invoke 'unicorn:start'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
set :domain, 'yafeilee.me'
|
||||
set :deploy_to, '/home/ruby/wblog_en'
|
||||
set :repository, 'git@github.com:windy/wblog.git'
|
||||
set :branch, 'master'
|
||||
set :user, 'ruby'
|
||||
set :unicorn_config, -> { "#{deploy_to}/#{current_path}/config/unicorn/en.rb" }
|
|
@ -0,0 +1,6 @@
|
|||
set :domain, 'yafeilee.me'
|
||||
set :deploy_to, '/home/ruby/wblog'
|
||||
set :repository, 'git@github.com:windy/wblog.git'
|
||||
set :branch, 'master'
|
||||
set :user, 'ruby'
|
||||
set :unicorn_config, -> { "#{deploy_to}/#{current_path}/config/unicorn/zh.rb" }
|
|
@ -0,0 +1,27 @@
|
|||
app_path = File.expand_path( File.join(File.dirname(__FILE__), '..', '..'))
|
||||
|
||||
worker_processes 1
|
||||
preload_app true
|
||||
timeout 180
|
||||
listen '/tmp/unicorn_wblog_en.sock'
|
||||
user 'ruby', 'ruby'
|
||||
stderr_path "log/unicorn.log"
|
||||
stdout_path "log/unicorn.log"
|
||||
|
||||
before_fork do |server, worker|
|
||||
old_pid = "#{server.config[:pid]}.oldbin"
|
||||
if File.exists?(old_pid) && server.pid != old_pid
|
||||
begin
|
||||
Process.kill("QUIT", File.read(old_pid).to_i)
|
||||
rescue Errno::ENOENT, Errno::ESRCH
|
||||
# someone else did our job for us
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
after_fork do |server, worker|
|
||||
end
|
||||
|
||||
before_exec do |server|
|
||||
ENV["BUNDLE_GEMFILE"] = "#{app_path}/current/Gemfile"
|
||||
end
|
Loading…
Reference in New Issue