Running thin in no-daemon mode, for use in supervisor or other process manager.

1,880 views
Skip to first unread message

Romain Dorgueil

unread,
Sep 28, 2012, 6:52:34 AM9/28/12
to thin...@googlegroups.com
Hi,

I'm trying to get thin to work in no-daemon mode (like, don't fork / go in background) but as of today I can't.

I'm running thin 1.3.1, to serve a redmine cluster, and I guess it goes daemon mode because of the "cluster" mode.

My thin configuration

pid: tmp/pids/thin.pid
user: redmine
group: redmine
wait: 30
timeout: 30
log: log/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
servers: 5
daemonize: true
#socket: tmp/thin.sock
port: 3000
chdir: /srv/redmine/current

And my current (non working) supervisor configuration:

[program:redmine]
command=/usr/local/bin/thin start -C /srv/current/redmine/config/thin.yml
directory=/srv/redmine/current
user=redmine
autostart=true
autorestart=true
startsecs=10
redirect_stderr=true
stdout_logfile=/var/log/supervisor/redmine.log

I wonder if I may be able to run the individual cluster items of thin using supervisor, instead of using thin cluster.

Thanks for any advice you'd have.

Romain

Marc-André Cournoyer

unread,
Sep 28, 2012, 8:34:03 AM9/28/12
to thin...@googlegroups.com
Hi Romain,

Setting either the `servers` or `daemonize: true` option will make thin run as a daemon. You could start each instance yourself or with a script w/ those turned off.


Romain

--
You received this message because you are subscribed to the Google Groups "thin-ruby" group.
To view this discussion on the web visit https://groups.google.com/d/msg/thin-ruby/-/z9cmmdqYBywJ.
To post to this group, send email to thin...@googlegroups.com.
To unsubscribe from this group, send email to thin-ruby+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/thin-ruby?hl=en.



--
M-A

Romain Dorgueil

unread,
Sep 28, 2012, 8:37:20 AM9/28/12
to thin...@googlegroups.com
Thank you.

So indeed I missed the daemonize: true in my config, but I would have struggled to understand that servers was forcing it.

My trick has been to make supervisor launch all individual instances, and it works well.

For the record and whoever would need it later (could not find any example on internet), here is my supervisord configuration to run a thin cluster.

[program:redmine]
process_name=%(program_name)s_%(process_num)02d
directory=/srv/redmine/current
user=redmine
numprocs=6
autostart=true
autorestart=true
startsecs=10
redirect_stderr=true
stdout_logfile=/var/log/supervisor/redmine-thin.log
command=/usr/local/bin/thin -p 30%(process_num)02d -e production start

Romain

Le 28/09/12 14:34, Marc-André Cournoyer a écrit :
romain.vcf

Ivailo Bardarov

unread,
Dec 7, 2015, 4:25:32 AM12/7/15
to thin-ruby
After 3 years: Thanks! This tip makes my day!
Reply all
Reply to author
Forward
0 new messages