Skip to content

Instantly share code, notes, and snippets.

@john45
Created April 15, 2019 21:00
Show Gist options
  • Save john45/fb30398a06f1153040453b720d401668 to your computer and use it in GitHub Desktop.
Save john45/fb30398a06f1153040453b720d401668 to your computer and use it in GitHub Desktop.
autostart puma through systemd
1. create file in /etc/systemd/system/<your-puma>.service
[Unit]
Description=Puma HTTP Server Everbot
After=network.target
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
# Preferably configure a non-privileged user
User=deployer
Group=deployer
# Specify the path to your puma application root
WorkingDirectory=/home/deployer/apps/everbot
# Helpful for debugging socket activation, etc.
Environment=PUMA_DEBUG=1
# EnvironmentFile=/var/www/my-website.com/.env
# The command to start Puma
ExecStart=/home/deployer/.rvm/wrappers/ruby-2.6.0/bundle exec puma -C /home/deployer/apps/everbot/config/puma.rb
PIDFile=/home/deployer/apps/everbot/tmp/pids/puma.pid
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment