# ==> /etc/systemd/system/yahns@.service <== # Since SIGUSR2 upgrades do not work under systemd, this service # file allows starting two (or more) simultaneous services # during upgrade (e.g. yahns@1 and yahns@2) with the intention # that they are both running during the upgrade process. # # This allows upgrading without downtime, using yahns@2 as a # temporary hot spare: # # systemctl start yahns@2 # sleep 2 # wait for yahns@2 to boot, increase as necessary for big apps # systemctl restart yahns@1 # sleep 2 # wait for yahns@1 to warmup # systemctl stop yahns@2 [Unit] Description = yahns Ruby server %i Wants = yahns.socket After = yahns.socket [Service] # yahns can handle lots of open files: LimitNOFILE = 32768 LimitCORE = infinity # The listen socket we give yahns should be blocking for optimal # load distribution between processes under the Linux kernel. # NonBlocking is false by default in systemd, but we specify it # here anyways to discourage users from blindly changing it. Sockets = yahns.socket NonBlocking = false # bundler users must use the "--keep-file-descriptors" switch, here: # ExecStart = /path/to/bin/bundle exec --keep-file-descriptors yahns -c ... ExecStart = /path/to/bin/yahns -c /path/to/yahns.conf.rb KillSignal = SIGQUIT User = www-data Group = www-data ExecReload = /bin/kill -HUP $MAINPID # this should match the shutdown_timeout value in yahns_config(5) TimeoutStopSec = 600 # Only kill the master process, it may be harmful to signal # workers via default "control-group" setting since some # Ruby extensions and applications misbehave on interrupts KillMode = process [Install] WantedBy = multi-user.target