Skip to content

Instantly share code, notes, and snippets.

@wwhiro200
Last active December 5, 2017 20:23
Show Gist options
  • Save wwhiro200/d17ac1b4062150e0cdb12356280da9a6 to your computer and use it in GitHub Desktop.
Save wwhiro200/d17ac1b4062150e0cdb12356280da9a6 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