Last active
March 13, 2020 14:14
-
-
Save hungmi/e0a445051dd8477bd49b0e84842085d8 to your computer and use it in GitHub Desktop.
Use systemd to restart puma after reboot. Put this file at /etc/systemd/system/puma.service. Please check those paths in ExecStart and ExecStop carefully.
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 Rails Server | |
After=network.target | |
[Service] | |
Type=simple | |
User=deploy | |
WorkingDirectory=/home/deploy/apps/AppName/current | |
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/apps/AppName/shared/puma.rb | |
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/apps/AppName/shared/tmp/pids/puma.state stop | |
TimeoutSec=15 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target | |
////////////////// | |
[Unit] | |
Description=Puma Rails Server | |
After=network.target | |
[Service] | |
Type=simple | |
User=root | |
Group=root | |
WorkingDirectory=/home/deploy/railsapp/current | |
ExecStart=/home/deploy/.rbenv/shims/bundle exec bundle exec puma -C /home/deploy/railsapp/shared/puma.rb | |
ExecStop=/home/deploy/.rbenv/shims/bundle exec bundle exec puma -S /home/deploy/railsapp/shared/puma.rb | |
PIDFile=/home/deploy/railsapp/current/tmp/pids/puma.pid | |
TimeoutSec=15 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
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] | |
Type=simple | |
User=deploy | |
WorkingDirectory=/home/deploy/apps/shiftweb/current | |
Environment=RAILS_ENV=production | |
ExecStart=/home/deploy/.rvm/bin/rvm ruby-2.6.5 do bundle exec puma -C /home/deploy/apps/shiftweb/shared/puma.rb | |
ExecStop=/home/deploy/.rvm/bin/rvm ruby-2.6.5 do bundle exec pumactl -S /home/deploy/apps/shiftweb/shared/tmp/pids/puma.state -F /home/deploy/apps/shiftweb/shared/puma.rb stop | |
Restart=always | |
KillMode=process | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment