2015-06-25 13:24:24 -04:00
|
|
|
#
|
|
|
|
# systemd unit file for CentOS 7, Ubuntu 15.04
|
|
|
|
#
|
|
|
|
# Customize this file based on your bundler location, app directory, etc.
|
|
|
|
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
|
|
|
|
# Run:
|
|
|
|
# - systemctl enable sidekiq
|
|
|
|
# - systemctl {start,stop,restart} sidekiq
|
|
|
|
#
|
|
|
|
# This file corresponds to a single Sidekiq process. Add multiple copies
|
|
|
|
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
|
|
|
|
#
|
|
|
|
# See Inspeqtor's Systemd wiki page for more detail about Systemd:
|
|
|
|
# https://github.com/mperham/inspeqtor/wiki/Systemd
|
|
|
|
#
|
|
|
|
[Unit]
|
|
|
|
Description=sidekiq
|
|
|
|
# start us only once the network and logging subsystems are available,
|
|
|
|
# consider adding redis-server.service if Redis is local and systemd-managed.
|
|
|
|
After=syslog.target network.target
|
|
|
|
|
|
|
|
# See these pages for lots of options:
|
|
|
|
# http://0pointer.de/public/systemd-man/systemd.service.html
|
|
|
|
# http://0pointer.de/public/systemd-man/systemd.exec.html
|
|
|
|
[Service]
|
|
|
|
Type=simple
|
|
|
|
WorkingDirectory=/opt/myapp/current
|
2016-08-28 18:45:07 -04:00
|
|
|
# If you use rbenv:
|
2018-08-19 16:21:11 -04:00
|
|
|
# ExecStart=/bin/bash -lc '/home/deploy/.rbenv/shims/bundle exec sidekiq -e production'
|
2016-08-28 18:45:07 -04:00
|
|
|
# If you use the system's ruby:
|
2015-12-18 16:52:26 -05:00
|
|
|
ExecStart=/usr/local/bin/bundle exec sidekiq -e production
|
2015-06-25 13:24:24 -04:00
|
|
|
User=deploy
|
|
|
|
Group=deploy
|
|
|
|
UMask=0002
|
|
|
|
|
2018-04-29 20:58:19 -04:00
|
|
|
# Greatly reduce Ruby memory fragmentation and heap usage
|
|
|
|
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/
|
|
|
|
Environment=MALLOC_ARENA_MAX=2
|
|
|
|
|
2015-06-25 13:24:24 -04:00
|
|
|
# if we crash, restart
|
|
|
|
RestartSec=1
|
|
|
|
Restart=on-failure
|
|
|
|
|
|
|
|
# output goes to /var/log/syslog
|
|
|
|
StandardOutput=syslog
|
|
|
|
StandardError=syslog
|
|
|
|
|
|
|
|
# This will default to "bundler" if we don't specify it
|
|
|
|
SyslogIdentifier=sidekiq
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|