Systemd unit for Puma web server
Go to your app directory and run:
rvm wrapper RUBYVERSION@GEMSET APPNAME pumactl
This will generate a wrapper that can be referenced in unit file:
/home/rubyworker/.rvm/bin/APPNAME_pumactl
Copy systemd unit file to /etc/systemd/system and edit unit file. You must setup your:
- path to wrapper;
- app directory path;
- path to puma config;
- user for run puma.
After installing or making changes to puma.service run:
systemctl daemon-reload
systemctl enable puma.service
systemctl start puma.service
systemctl status puma.service
A normal restart. Warning: listeners sockets will be closed while a new puma process initializes.
systemctl restart puma.service
- Official Puma docs for using systemd (not for using with RVM) https://github.com/puma/puma/blob/master/docs/systemd.md
- Official example of Puma config file https://github.com/puma/puma/blob/master/examples/config.rb
rvm wrapper RUBYVERSION@GEMSET APPNAME sidekiq