Skip to content

Instantly share code, notes, and snippets.

@FinnWoelm
Forked from arteezy/puma.service
Last active November 26, 2021 09:23
Show Gist options
  • Save FinnWoelm/21fd86dc0842447e1470bfca329a3d63 to your computer and use it in GitHub Desktop.
Save FinnWoelm/21fd86dc0842447e1470bfca329a3d63 to your computer and use it in GitHub Desktop.
Manage Puma with systemd on Ubuntu 16.04 and rvm
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/var/apps/upshift/current
ExecStart=/usr/local/rvm/bin/rbenv default do bundle exec pumactl -S /var/apps/upshift/shared/tmp/pids/puma.state -F /var/apps/upshift/shared/puma.rb start
ExecStop=/usr/local/rvm/bin/rbenv default do bundle exec pumactl -S /var/apps/upshift/shared/tmp/pids/puma.state -F /var/apps/upshift/shared/puma.rb stop
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target
@FinnWoelm
Copy link
Author

To get the values for ExecStart or ExecStop, run cap production puma:start or cap production puma:stop and copy the command that is printed to your console. For example, in this case it's the last line below:

$ cap production puma:start
00:00 puma:start
      01 /usr/local/rvm/bin/rvm default do bundle exec pumactl -S /var/apps/upshift/shared/tmp/pids/puma.state -F /var/apps/upshift/shared/puma.rb start`

@FinnWoelm
Copy link
Author

Replace User, WorkingDirectory, ExecStart, and ExecStop above with values of your setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment