Created
September 1, 2021 12:55
-
-
Save charusat09/bfc3c10d160323ef75b5fb2ed54b5e5b to your computer and use it in GitHub Desktop.
Add Puma service to systemctl for Puma v5+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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