Skip to content

Instantly share code, notes, and snippets.

@reynardmh
Created April 7, 2021 22:46
Show Gist options
  • Select an option

  • Save reynardmh/00a2058c93d792c348a84cee654fa49e to your computer and use it in GitHub Desktop.

Select an option

Save reynardmh/00a2058c93d792c348a84cee654fa49e to your computer and use it in GitHub Desktop.
Template: Puma systemd for rails app using rvm
# Place this in /etc/systemd/system/puma-myapp.service
[Unit]
Description=Myapp Puma Server
After=network.target
[Service]
Type=simple
User=ubuntu
EnvironmentFile=/var/www/myapp/current/.env
Environment=RAILS_ENV=staging
WorkingDirectory=/var/www/myapp/current/
ExecStart=/home/ubuntu/.rvm/bin/rvm-exec ruby-2.6.6 bundle exec puma -C /var/www/myapp/shared/puma.rb
ExecStop=/home/ubuntu/.rvm/bin/rvm-exec ruby-2.6.6 bundle exec pumactl -F /var/www/myapp/shared/puma.rb stop
ExecReload=/home/ubuntu/.rvm/bin/rvm-exec ruby-2.6.6 bundle exec pumactl -F /var/www/myapp/shared/puma.rb phased-restart
TimeoutSec=15
Restart=always
KillMode=process
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment