viviotech / lucee-installer

BitRock Installer XML config and files for the Lucee installers
http://lucee.viviotech.net/
9 stars 2 forks source link

SystemD-compatible Init Scripts #93

Open utdream opened 6 years ago

utdream commented 6 years ago

The current service control scripts function on systems using SystemD (CentOS 7, Ubuntu 18.04+) due to SystemD's backwards compatibility. These init scripts need to be re-written to utilize proper SystemD init methods.

utdream commented 5 years ago

Notes on this:

I could probably tie a Lucee SystemD script right into Tomcat's existing/updated scripts and save myself some time. I could also leave the existing lucee_ctl scripts for legacy systems as it still works great for those systems. Need to update the system detection module that I use in several of the scripts in order to detect SystemD-capable systems, and generate the scripts accordingly.

utdream commented 5 years ago

Linking the new lucee.service SystemD script directly to the native Tomcat start/stop scripts might not work. Tomcat's native scripts don't appear to interface well with SystemD. For example, running a start command on the native script when the server is already running results in a SystemD server status that looks like it failed, when the reality is that the server is running just fine, it just didn't need to be started. The start script didn't need to spit out an error code, but rather a success code with output explaining that the server was already running.

Rather than try to edit/revise the Tomcat native scripts, it would probably be best to abstract them using the existing lucee_ctl scripts. That way we can make something that's both backwards and forwards compatible.

sbleon commented 4 years ago

I updated most of my Lucee servers this week to use systemd instead of SysV-style init. Here's the configuration I came up with. I've only been running it for a brief time, so take it with a grain of salt.

[Unit]
Description=Lucee CFML application server
[Service]
Type=forking
User=lucee
Environment=JAVA_HOME=/opt/lucee/jdk JRE_HOME=/opt/lucee/jdk/jre
ExecStart=/opt/lucee/tomcat/bin/startup.sh
ExecStop=/opt/lucee/tomcat/bin/shutdown.sh
TimeoutStopSec=5
# The exit code of the tomcat java process when terminated via shutdown.sh is 143.
# Don't treat that non-zero exit code as a failure.
SuccessExitStatus=143
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target