Skip to content

Instantly share code, notes, and snippets.

@renatonitta
Created September 8, 2020 18:52
Show Gist options
  • Save renatonitta/354d683ea35fc96bd6d23ea88e6884e1 to your computer and use it in GitHub Desktop.
Save renatonitta/354d683ea35fc96bd6d23ea88e6884e1 to your computer and use it in GitHub Desktop.
Puma + Sidekiq: systemd units and configs
#!/usr/bin/env puma
environment = ENV.fetch('RAILS_ENV', 'production')
threads 0, 4
workers 1
bind 'tcp://0.0.0.0:9292'
preload_app!
plugin :tmp_restart
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/var/www/[app_path]/current
EnvironmentFile=/etc/environment
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C config/puma.rb
Restart=always
[Install]
WantedBy=multi-user.target
[Unit]
Description=Sidekiq workers
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/var/www/[app_path]/current
EnvironmentFile=/etc/environment
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec sidekiq -C config/sidekiq.yml -e production
Restart=always
[Install]
WantedBy=multi-user.target
---
:concurrency: 4
:queues:
- [default, 10]
:logfile: /var/www/[app_path]/shared/log/sidekiq.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment