Created
January 29, 2019 05:32
-
-
Save deepakdargade/c555b18b9f6c587d40e4d2f5c02b1b60 to your computer and use it in GitHub Desktop.
Systemd service file for Sidekiq
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 | |
# | |
# Customize this file based on your bundler location, app directory, etc. | |
# Put this in /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 | |
# If you use rbenv: | |
# ExecStart=/bin/bash -lc '/home/deploy/.rbenv/shims/bundle exec sidekiq -e production' | |
# If you use the system's ruby: | |
ExecStart=/usr/local/bin/bundle exec sidekiq -e production | |
User=deploy | |
Group=deploy | |
UMask=0002 | |
# Greatly reduce Ruby memory fragmentation and heap usage | |
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ | |
Environment=MALLOC_ARENA_MAX=2 | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment