Evolix/chexpire

systemd unit

Opened this issue · 0 comments

I suggest to add this example of systemd unit :

[Unit]
Description=Puma HTTP Server for Chexpire
After=network.target

[Service]
WorkingDirectory=/home/%u/www/current
UMask=0027
Environment="GEM_HOME=/home/%u/www/shared/bundle/ruby/2.3.0/"
Environment="RBENV_ROOT=/home/%u/.rbenv"
Environment="RAILS_ENV=production"
Environment="RACK_ENV=production"
ExecStart=/home/%u/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/%u/www/shared/tmp/pids/puma.state -F /home/%u/www/shared/puma.rb restart
Type=forking
RemainAfterExit=yes

[Install]
WantedBy=default.target

and add documentation to explain how to use it :

* Ensure to enable systemd units for your user by executing in root : loginctl enable-linger <user>
* Create chexpire.service in ~/.config/systemd/user/
* Adjust GEM_HOME with your ruby version
* systemctl --user enable chexpire && systemctl --user start chexpire

Note: unfortunatly capistrano doesn't use systemd unit by default, it breaks "systemctl status"