Skip to content

Instantly share code, notes, and snippets.

@r00takaspin
Created May 11, 2018 15:29
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save r00takaspin/9ec25860f72fa930fbc4dea25487aeb2 to your computer and use it in GitHub Desktop.
Save r00takaspin/9ec25860f72fa930fbc4dea25487aeb2 to your computer and use it in GitHub Desktop.
Run puma web server with RVM from systemd
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
# Preferably configure a non-privileged user
# User=
# The path to the puma application root
# Also replace the "<WD>" place holders below with this path.
# Helpful for debugging socket activation, etc.
# Environment=PUMA_DEBUG=1
# The command to start Puma. This variant uses a binstub generated via
# `bundle binstubs puma --path ./sbin` in the WorkingDirectory
# (replace "<WD>" below)
WorkingDirectory=/home/deploy/moika/current
User=deploy
Group=deploy
ExecStart=/home/deploy/.rvm/bin/rvm all do bundle exec puma -b tcp://0.0.0.0:3000 -e production
# Variant: Use config file with `bind` directives instead:
# ExecStart=<WD>/sbin/puma -C config.rb
# Variant: Use `bundle exec --keep-file-descriptors puma` instead of binstub
Restart=always
[Install]
WantedBy=multi-user.target
@equivalent
Copy link

equivalent commented Nov 30, 2023

Thank you for this. Tried yours but in the end I had to do it bit differently https://blog.eq8.eu/til/systemd-service-daemon-for-puma-server-instaled-under-rvm.html

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