I have a rails 4.2 application which uses sidekiq. I am using mina for deployment. My Gemfile contains 'sidekiq' and 'mina-sidekiq'.
My deployment script is as
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, '[email protected]: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 contains
# 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]
the last few contains of 'mina deploy --verbose' are as
-----> 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
The problem is that sidekiq process is still not running on the server after deployment. Any suggestions?
On your production instance.Please check, Is there sidekiq.log file exists or not. if exists then please have a look on logs in this file.
Is redis server running in your instance ? To Bind redis server with sidekiq
Make a file config/redis.yml . Write the below code -
Make sure there must be an instance elasticache on server and a custom tcp rule should be added in inbound in security groups of particular cache instance.