Created
May 1, 2017 06:37
-
-
Save tobinharris/55b4875d3970ef14ec26c081686c1bec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/init/clockwork.conf - DigitalOcean Rails Image - Clockwork config | |
# This example config should work with Ubuntu 14.04+. It | |
# allows you to manage clockwork with | |
# Upstart, Ubuntu's native service management tool. | |
# | |
# Assumes you have a clock.rb script in your Rails app root | |
# | |
# Use the service command: | |
# sudo service clockwork {start,stop,restart,status} | |
# | |
description "Clockwork Background Worker" | |
# no "start on", we don't want to automatically start | |
stop on (stopping workers or runlevel [06]) | |
# change to match your deployment user | |
setuid rails | |
setgid rails | |
env HOME=/home/rails | |
respawn | |
respawn limit 3 30 | |
# normal exit codes, it just respawns. | |
normal exit 0 TERM | |
script | |
# this script runs in /bin/sh by default | |
# respawn as bash so we can source in rbenv | |
exec /bin/bash <<'EOT' | |
# Pick your poison :) Or none if you're using a system wide installed Ruby. | |
# rbenv | |
# source /home/apps/.bash_profile | |
# OR | |
# source /home/rails/.profile | |
# OR system: | |
source /etc/profile.d/rvm.sh | |
# | |
# rvm | |
# source /home/apps/.rvm/scripts/rvm | |
# Logs out to /var/log/upstart/sidekiq.log by default | |
rvm use 2.1.3 | |
env RAILS_ENV=production | |
cd /home/rails | |
exec bundle exec clockwork clock.rb | |
EOT | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment