I am using Isso as a lightweight commenting system for a few websites hosted on my FreeBSD server, and until recently I was using supervisor to daemonize and control the instances. But why using a third party process control system (event if it is does a great job) if we can do it with FreeBSD native mechanisms ?
I have to admit that my websites don’t draw a lot of comments so I can rely on the integrated Isso webserver (behind a Nginx proxy), quoting the author:
Isso ships with a built-in web server, which is useful for the initial setup and may be used in production for low-traffic sites (up to 20 requests per second)."
Perfect.
Well, 4 websites, 4 Isso instances, 4 rc.d scripts, multiple possibilities. I could setup instances in the same script à la uwsgi, but I was more interested by the approach of reusing the same script multiple times, like I came across in my internet searches. If I understand correctly, symlinking the same script with differents names forbid the /usr/local/etc/rc.d/<script> <action>
usage, only service <script> <action>
is working because the name is correctly detected. Here is my hybrid solution:
#!/bin/sh
# PROVIDE: isso_hello
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name=isso_hello
rcvar=${name}_enable
load_rc_config "${name}"
eval ${name}_user="www"
eval ${name}_group="www"
eval home=\$${name}_home
eval pidfile=${home}/daemon.pid
command="/usr/sbin/daemon"
command_args="-S -P ${pidfile} /usr/local/bin/isso -c ${home}/config.ini run"
run_rc_command "$1"
And in /etc/rc.conf
:
isso_hello_enable="YES"
isso_hello_home="/usr/local/www/isso-hello"
If I want another instance, for example isso_blog
I juste have top copy /usr/local/etc/rc.d/isso_hello
to /usr/local/etc/rc.d/isso_blog
and change the names at lines 2 and 8. And of course adding 2 lines in /etc/rc.conf
for it.
Each Isso home directory (owned by the www user) contains 3 files: comments.sqlite3 config.ini daemon.pid