systemd job in deploy docs

This commit is contained in:
Devin Howard 2017-01-10 18:00:37 -05:00
parent e9e6b1dc09
commit da94cd0c8b

View file

@ -103,7 +103,7 @@ server to see what problems show up:
#### Upstart service for delayed_worker: #### Upstart service for delayed_worker:
Put the following code into `/etc/init/metamaps_delayed_worker.conf`: If your system uses upstart for init scripts, put the following code into `/etc/init/metamaps_delayed_job.conf`:
description "Delayed Jobs Worker for Metamaps" description "Delayed Jobs Worker for Metamaps"
@ -128,3 +128,30 @@ Then start the service and check the last ten lines of the log file to make sure
sudo service metamaps_delayed_job start sudo service metamaps_delayed_job start
tail /var/log/upstart/metamaps_delayed_job.log tail /var/log/upstart/metamaps_delayed_job.log
#### Systemd service for delayed_worker:
If your system uses systemd for init scripts, ptu the following code into `/etc/systemd/system/metamaps_delayed_job.service`:
[Unit]
Description=metamaps delayed job service
After=network-online.target
[Service]
ExecStart=/usr/local/rvm/gems/ruby-2.3.0@metamaps/bin/bundle exec rails jobs:work
WorkingDirectory=/home/metamaps/metamaps
Restart=always
User=metamaps
Group=metamaps
Environment=HOME=/home/metamaps
Environment=PATH="/usr/local/rvm/gems/ruby-2.3.0@metamaps/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin"
Environment=GEM_PATH="/usr/local/rvm/gems/ruby-2.3.0@metamaps:/usr/local/rvm/gems/ruby-2.3.0@global"
Environment=RAILS_ENV="production"
[Install]
WantedBy=multi-user.target
Then start the service and check the last ten lines of the log file to make sure it's running OK:
sudo systemctl start metamaps_delayed_job
# ??? how the heck do you check systemd logs??