I've managed to successfully deploy a Rails 4, Puma, Nginx App using Capistrano. When I deploy cap production deploy everything works great. My problem is if the server reboots for whatever reason or if it crashes, it doesn't restart.
I'm using a Debian 8 on DigitalOcean. It seems Debian 8 uses systemd, so I've followed the instructions from Puma but it didn't work. After some research I've found a couple more scripts and the one that seemed most sensible was this:
[Unit]
Description=Rails-Puma Webserver
[Service]
Type=simple
User=myuser
WorkingDirectory=/home/myuser/apps/myapp
ExecStart=/home/myuser/.rvm/rubies/ruby-2.2.2/bin/systemd_rails server -e production
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target
I've saved the above file in /etc/systemd/system/rails-puma.service then I've enabled it: sudo systemctl enable rails.service and finally started it: sudo systemctl start rails-puma.service
Which unfortunately didn't work. This is the result of sudo systemctl status rails-puma.service:
● rails-puma.service - Rails-Puma Webserver
Loaded: loaded (/etc/systemd/system/rails-puma.service; enabled)
Active: failed (Result: start-limit) since Thu 2016-07-07 12:11:58 EDT; 4s ago
Process: 4373 ExecStart=/home/myuser/.rvm/rubies/ruby-2.2.2/bin/systemd_rails server -e production (code=exited, status=203/EXEC)
Main PID: 4373 (code=exited, status=203/EXEC)
Jul 07 12:11:58 mrcProd systemd[1]: rails-puma.service: main process exited, code=exited, status=203/EXEC
Jul 07 12:11:58 mrcProd systemd[1]: Unit rails-puma.service entered failed state.
Jul 07 12:11:58 mrcProd systemd[1]: rails-puma.service start request repeated too quickly, refusing to start.
Jul 07 12:11:58 mrcProd systemd[1]: Failed to start Rails-Puma Webserver.
Jul 07 12:11:58 mrcProd systemd[1]: Unit rails-puma.service entered failed state.
What am I doing wrong here?

所有评论(0)