-
-
Save rapind/7eae33272dc28858c583e8440bde1b3c to your computer and use it in GitHub Desktop.
systemd unit file for running ruby/rails delayed_job as service
This file contains hidden or 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
| # systemd unit file for Ubuntu 16.04 | |
| [Unit] | |
| Description=Delayed Job Worker %i | |
| After=syslog.target network.target | |
| # TODO: Change to application directory | |
| AssertPathExists=/var/www/rails_app | |
| [Service] | |
| Type=simple | |
| # TODO: Change to application directory | |
| WorkingDirectory=/var/www/rails_app | |
| ExecStart=/bin/bash -lc 'RAILS_ENV=production bundle exec rake jobs:work' | |
| KillSignal=SIGINT | |
| User=deploy | |
| Group=deploy | |
| UMask=0002 | |
| Restart=on-failure | |
| StandardOutput=syslog | |
| StandardError=syslog | |
| SyslogIdentifier=dj_worker_%i | |
| [Install] | |
| WantedBy=multi-user.target | |
| # Usage | |
| # Start "sudo systemctl start delayed_job@{0..3}" to start 4 worker instances | |
| # Enable "sudo systemctl enable delayed_job@{0..3}" to enable 4 worker instances | |
| # Disable "sudo systemctl disable delayed_job@{0..3}" to disable 4 worker instances | |
| # Stop "sudo systemctl stop delayed_job@{0..3}" to stop 4 worker instances |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment