Install Redis:
- https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-redis-on-ubuntu-22-04
- https://dev.to/kevinluo201/start-sidekiq-6-as-daemon-in-production-environment-on-ubuntu-20-04-4m7b
- https://github.com/sidekiq/sidekiq/wiki/Deployment
[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