Good afternoon,
I appreciate all of the help in getting my server transitioned over using CommandBox. I have it up and running and things seem to be running OK, for now. For uptime purposes, I’m wondering if there’s any way to integrate monit
functionality with CommandBox.
I’m currently running CommandBox as a service located at /usr/lib/systemd/system/mydomain.service
. This is the contents of the service file:
[Unit]
Description=MyDomain.com Web Service
[Service]
User=ubuntu
Group=ubuntu
ExecStart=/usr/local/bin/box server start /web/default/server.json
Type=forking
[Install]
WantedBy=multi-user.target
(Feedback about the service set up is always welcome.)
In the past I’ve used monit
with configuration similar to this:
check process lucee with pidfile /opt/lucee/tomcat/work/tomcat.pid
start program = "/opt/lucee/lucee_ctl start"
stop program = "/opt/lucee/lucee_ctl stop"
restart program = "/opt/lucee/lucee_ctl restart"
if failed host www.mydomain.com port 443 with protocol https and request "/server_up.cfm" with timeout 5 seconds for 2 times within 3 cycles then restart
If Lucee gets bogged down in something stupid, I’ve used this to step in restart it. I’ve also set up similar ones for nginx
and mysql
. This allows for unattended monitoring of the server in case something happens when I’m away and can’t restart it.
I’m curious how I might best configure a similar monit file for my CommandBox server. I should note that the thing that worries me is the weird issue that’s already come up once before where I go to start the server, even after a restart, and CommandBox “thinks” there’s a server still running, because of an improper shutdown.
By nature, a monit
usage is likely going to trigger when problems are happening, so the risk of the ‘server still running’ issue seems high. That’s why I’m reaching out for any thoughts people might have about how to manage such a situation and if anybody else has any ideas. Thank you as always for the feedback.