Skip to content

Instantly share code, notes, and snippets.

@eknowlton
Created May 23, 2018 15:06
Show Gist options
  • Save eknowlton/321d66be80fb2a28919ff08cb615351e to your computer and use it in GitHub Desktop.
Save eknowlton/321d66be80fb2a28919ff08cb615351e to your computer and use it in GitHub Desktop.
Rails Rbenv systemd configuration
# add to /etc/systemd/system/app.service
# manage app with 'systemctl'
[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=deploy
# The path to the puma application root
# Also replace the "<WD>" place holders below with this path.
WorkingDirectory=/home/deploy/server/api/current
# 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)
ExecStart=/home/deploy/.rbenv/shims/bundle exec puma -b "unix:///home/deploy/server/api/puma.sock" --pidfile "/home/deploy/server/api/puma.pid"
PIDFile=/home/deploy/server/api/puma.pid
Restart=always
# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=puma
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment