Skip to content

Instantly share code, notes, and snippets.

@sj26
Forked from dsadaka/\lib\systemd\system\sidekiq-static.service
Last active May 3, 2024 07:07
Show Gist options
  • Save sj26/5d6d0bff1adf06d2ef2f1468cd9d3402 to your computer and use it in GitHub Desktop.
Save sj26/5d6d0bff1adf06d2ef2f1468cd9d3402 to your computer and use it in GitHub Desktop.
systemd unit files for multiple sidekiq workers
[Unit]
Description=Sidekiq workers
# start as many workers as you want here
[email protected]
[email protected]
# ...
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=true
[Unit]
Description=Sidekiq worker %I
# restarts/stops with sidekiq
PartOf=sidekiq.service
After=network.target
[Service]
# Run as a systemd notify service with watchdog support (sidekiq v6.0.6+)
Type=notify
WatchdogSec=5
# Modify to your application user/group/pwd
User=app
Group=app
UMask=0002
WorkingDirectory=/app
ExecStart=/app/bin/sidekiq -C config/sidekiq.yml -e production
# restart & stop send TERM to main process, wait up to 30 seconds, then KILL if still running
KillMode=mixed
TimeoutStopSec=30
# restart on non-zero exit or other failure after 5 seconds
Restart=on-failure
RestartSec=5
# don't create a new systemd.slice per instance
Slice=system.slice
@jpriollaud
Copy link

@sj26 very helpful thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment