【发布时间】:2015-06-09 04:12:25
【问题描述】:
我有一个使用 sidekiq 的 rails 4.2 应用程序。我正在使用 mina 进行部署。我的 Gemfile 包含“sidekiq”和“mina-sidekiq”。
我的部署脚本如下
require 'mina_sidekiq/tasks'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'x.x.x.x'
set :deploy_to, '/home/deploy/appname'
set :repository, 'git@bitbucket.org:username/appname.git'
#set :identity_file, "#{ENV['HOME']}/.ssh/id_rsa"
set :branch, 'master'
set :rails_env, 'production'
set :shared_paths, ['config/secrets.yml', 'log', 'tmp']
set :user, 'deploy'
task :environment do
invoke :'rvm:use[ruby-2.2.1@default]'
end
task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/tmp"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
queue %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/secrets.yml'."]
end
desc "Deploys the current version to the server."
task :deploy => :environment do
to :before_hook do
# Put things to run locally before ssh
end
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'sidekiq:quiet'
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
to :launch do
queue "mkdir -p #{deploy_to}/#{current_path}/tmp/"
queue "touch #{deploy_to}/#{current_path}/tmp/restart.txt"
invoke :'sidekiq:restart'
end
end
end
config/sidekiq.yml 包含
# Sample configuration file for Sidekiq.
# # Options here can still be overridden by cmd line args.
# # sidekiq -C config.yml
# ---
:verbose: false
:concurrency: 1
:queues:
- [often, 7]
- [default, 5]
- [seldom, 3]
“mina deploy --verbose”的最后几个包含如下
-----> Build finished
-----> Moving build to releases/37
$ mv "$build_path" "$release_path"
-----> Updating the current symlink
$ ln -nfs "$release_path" "current"
-----> Launching
$ cd "$release_path"
-----> Stop sidekiq
Skip stopping sidekiq (no pid file found)
-----> Start sidekiq
$ bundle exec sidekiq -d -e production -C /home/deploy/appname/current/config/sidekiq.yml -i 0 -P /home/deploy/appname/shared/pids/sideki
$ bundle exec sidekiq -d -e production -C /home/deploy/appname/current/config/sidekiq.yml -i 0 -P /home/deploy/appname/shared/pids/sidekiq.pid -L /home/deploy/appname/current/log/sidekiq.log
-----> Done. Deployed v37
问题是部署后sidekiq进程仍然没有在服务器上运行。有什么建议么?
【问题讨论】: