0

I have this problem with a thin server where systemd restart doesn't respect onebyone config, so it should stop and start each server individually. What's happening is that all servers are stopped first, then all are started which causes downtime in service. If I start it from a command line everything works as expected, but via systemd not so. I tried this on two different servers one ubuntu 16.04 and other Debian 9 with the same result .

Here is my thin.service file

[Unit]
Description=Thin Web Server
After=syslog.target
After=network.target

[Service]
Type=forking

User=luff

WorkingDirectory=/home/luff/bertani

ExecStart=/home/luff/.rvm/wrappers/bertani/thin -C config/thin.rb start
ExecStop=/home/luff/.rvm/wrappers/bertani/thin  -C config/thin.rb stop
ExecReload=/home/luff/.rvm/wrappers/bertani/thin -C config/thin.rb restart

TimeoutSec=15
Restart=always

and my thin.rb config

environment: development
address: 0.0.0.0
port: 3000
timeout: 30
log: /home/luff/logs/thin.log
pid: /home/luff/tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 100
require: []
wait: 30
threadpool_size: 20
servers: 3 
daemonize: true
onebyone: true
Shreko
  • 139
  • 8
  • What is the problem you are having? It is not clear from your description nor from the files you have posted. – Michael Hampton Apr 16 '19 at 19:24
  • Only problem is with restart, everything else works fine. In thin config 'onebyone' means that if I have 3 servers up it should go stop server 1 start server 1 stop server 2 start server 2 stop server 3 start server 3 Instead it goes: stop server 1 stop server 2 stop server 3 start server 1 start server 2 start server 3 – Shreko Apr 16 '19 at 20:42
  • 1
    This is how systemctl restart works: It completely stops the service, before starting it again. You seem to have tried to work around this by doing a restart in ExecReload=. How did that work out? – Michael Hampton Apr 17 '19 at 01:54
  • I have an older server ubuntu 12.04 where this works properly under init.d. But in 16.04 init.d script works same as systemd. This causes me downtime on a production server where server is not responding for 20-30 sec waiting for all 5 servers to shut down first, then come back up. This 'onebyone' feature avoids downtime when restarting. – Shreko Apr 17 '19 at 12:26
  • Michael, your comment about ExecReload got me on the right path. I think I got it working now. In thin.service file I had ExecReload by I was calling it 'restart' on the command line. Once I switched to ` systemctl reload thin.service ` it works as expected. Michael, Thank you very much for all your help. – Shreko Apr 17 '19 at 12:37

0 Answers0