Skip to content

Instantly share code, notes, and snippets.

@charusat09
Created September 1, 2021 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charusat09/bfc3c10d160323ef75b5fb2ed54b5e5b to your computer and use it in GitHub Desktop.
Save charusat09/bfc3c10d160323ef75b5fb2ed54b5e5b to your computer and use it in GitHub Desktop.
Add Puma service to systemctl for Puma v5+
cd /etc/systemd/system
sudo vim puma.service
# add the follwing code to the above file:
---------------------------------------------------------------------------------------
[Unit]
Description=Puma HTTP Server
After=network.target ??
[Service]
Type=simple
User=ec2-user
WorkingDirectory=/home/ec2-user/web-app
Environment=RAILS_ENV=alpha
ExecStart=/bin/bash -lc 'RAILS_SERVE_STATIC_FILES=true SECRET_KEY_BASE=`cat /etc/myapp/secret` RAILS_ENV=`cat /etc/myapp/env` pumactl -F /home/ec2-user/web-app/config/puma.rb start'
Restart=always
KillMode=process
[Install]
WantedBy=multi-user.target
---------------------------------------------------------------------------------------
# Enable the above changes:
sudo systemctl daemon-reload
sudo systemctl enable puma
sudo service puma start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment