I struggled with this a week later and really can't find an answer. I deployed the Rails application with Capistrano. I use Puma as a server.
When I deploy, everything works fine. The problem is to start Puma on reboot and / or crash.
To get the deployment setup, I used this tutorial . I also use RVM. The problem, which, it seems to me, is to start the Puma service. Here is what I used (service file):
[Unit] Description=Puma HTTP Server After=network.target [Service] Type=simple #User=my-user WorkingDirectory=/home/my-user/apps/MyApp/current ExecStart=/home/my-user/apps/MyApp/current/sbin/puma -C /home/my-user/apps/MyApp/shared/puma.rb Restart=always [Install] WantedBy=multi-user.target
This does not work. I started to think that the problem was that Ruby was not installed for all users, so I installed RVM for all users and still get the same problem. My server has only root and my-user.
After seeing how Capistrano is deployed, the command it runs is: cd /home/my-user/apps/MyApp/current && ( RACK_ENV=production /home/my-user/.rvm/bin/rvm default do bundle exec puma -C /home/my-user/apps/MyApp/shared/puma.rb --daemon ) . If I use the above command, I get a message from Systmd complaining about missing parameters. So I wrote a script with it and got a service file to call this script to start the application.
This does not work either. Please note that if I call the script from anywhere on the server, the script launches the application, so its a problem when setting up Systemd, but I canβt understand what is wrong, and Iβm not sure how to debug it, I saw the debug page on the web -site System, but it did not help me. If I run systemctl status puma.service , all this tells me that the service is in a state of failure, but it does not tell me how and why.
Also worth noting: if I run bundle exec puma -C /home/my-user/apps/MyApp/shared/puma.rb from my application folder, it works fine, since I can duplicate this command using the Systemd service?
linux ruby-on-rails nginx systemd puma
WagnerMatosUK
source share