Created
January 18, 2021 13:39
-
-
Save dux/bff91e33b234fc9a7ac7fe7b891aa6ab to your computer and use it in GitHub Desktop.
systemd sample script to start puma/rails app
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
[Unit] | |
Description=Puma HTTP Server | |
After=network.target | |
[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 your application code root directory | |
WorkingDirectory=/home/deploy/my-app | |
# The command to start Puma | |
ExecStart=/home/deploy/.rbenv/shims/puma -C /home/deploy/my-app/config/puma.rb | |
# The command to stop Puma | |
ExecStop=/home/deploy/.rbenv/shims/puma -S /home/deploy/my-app/config.puma.rb | |
# Path to PID file so that systemd knows which is the master process | |
PIDFile=/home/deploy/my-app/tmp/pids/puma.pid | |
# Should systemd restart puma? | |
# Use "no" (the default) to ensure no interference when using | |
# stop/start/restart via `pumactl`. The "on-failure" setting might | |
# work better for this purpose, but you must test it. | |
# Use "always" if only `systemctl` is used for start/stop/restart, and | |
# reconsider if you actually need the forking config. | |
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