Reputation: 439
My goal is to have sidekiq start when the server boots up (I'm using EC2 with an auto-scaling group). I know there are a few other posts regarding getting sidekiq to start with upstart on boot, but I don't believe mine has been addressed specifically.
I'm using this wiki - https://github.com/mperham/sidekiq/tree/master/examples/upstart/manage-many and have placed the scripts inside /etc/init/sidekiq.conf
and /etc/init/sidekiq-manager.conf
.
I've made a couple small modifications as directed in /etc/init/sidekiq.conf
, changing:
# setuid apps
# setgid apps
-> replaced apps
with ubuntu
in both lines, which is the deployment user.
export HOME=/home/apps
to export HOME=/home/ubuntu
I also have a /etc/sidekiq.conf
that includes the following line:
/home/ubuntu/app_dir, 2
Otherwise, these scripts are identical to those included in the referenced repo. I'm getting the following errors in my logs (/var/log/upstart
)
/bin/bash: line 19: cd: 2: No such file or directory
Could not locate Gemfile
It appears as if it's attempting to change directory somewhere other than /home/ubuntu/app_dir
, at which point it's in the wrong directory and cannot find my Gemfile.
Is there somewhere else I need to specify a correct path to my app directory?
Thanks!
Upvotes: 4
Views: 1133
Reputation: 9190
You can run sidekiq
as an upstart job. Making a sidekiq.conf
file in /etc/init/
directory and put the upstart code to run sidekiq.
Here is the complete script and the guide to make sidekiq upstart job.
After making this job, sidekiq start/stop/restart
would be easy with sudo service
command.
Upvotes: 1