Created
November 4, 2019 12:18
-
-
Save DucNguyenVan/61cd10a82e11551788cb5bda841f09a9 to your computer and use it in GitHub Desktop.
sidekiq systemd config
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
# | |
# 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,reload} sidekiq | |
# | |
# This file corresponds to a single Sidekiq process. Add multiple copies | |
# to run multiple processes (sidekiq-1, sidekiq-2, etc). | |
# | |
[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: | |
# | |
# https://www.freedesktop.org/software/systemd/man/systemd.service.html | |
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html | |
# | |
# THOSE PAGES ARE CRITICAL FOR ANY LINUX DEVOPS WORK; read them multiple | |
# times! systemd is a critical tool for all developers to know and understand. | |
# | |
[Service] | |
Type=simple | |
WorkingDirectory=/var/www/rails/code-contest | |
# 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=/home/ec2-user/.rbenv/shims/bundle exec sidekiq -e production | |
# use `systemctl reload sidekiq` to send the quiet signal to Sidekiq | |
# at the start of your deploy process. | |
ExecReload=/usr/bin/kill -TSTP $MAINPID | |
User=ec2-user | |
Group=ec2-user | |
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