Skip to content

Instantly share code, notes, and snippets.

@fzrhrs
Last active September 18, 2024 06:52
Show Gist options
  • Save fzrhrs/7653cbd7b4b561b0a95dfb7dbad284ad to your computer and use it in GitHub Desktop.
Save fzrhrs/7653cbd7b4b561b0a95dfb7dbad284ad to your computer and use it in GitHub Desktop.

Install Redis:

[Unit]
Description=sidekiq
After=syslog.target network.target

[Service]
Type=simple
User=deploy
Group=deploy
UMask=0002
WorkingDirectory=/home/deploy/website/current
ExecStart=/home/deploy/.rvm/gems/ruby-3.2.2/wrappers/bundle exec sidekiq -e production
Environment=MALLOC_ARENA_MAX=2
# Greatly reduce Ruby memory fragmentation and heap usage
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/

# if we crash, restart
RestartSec=1
Restart=on-failure

# output goes to specified log files
StandardOutput=file:/home/deploy/website/shared/log/sidekiq.log
StandardError=file:/home/deploy/website/shared/log/sidekiq_error.log

# This will default to 'bundler' if we don't specify it
SyslogIdentifier=sidekiq

[Install]
WantedBy=multi-user.target

Then:

sudo systemctl daemon-reload
sudo systemctl enable sidekiq
sudo service sidekiq start

Check if Sidekiq is started:

sudo ps aux | grep sidekiq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment