Dirk Heinrichs The above is for running Jenkins in Tomcat, isn't it? Yes. The example provided based on [Advanced Configuration - Multiple Tomcat Instances|https://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt] - e.g. single installation and "n" - Tomcat Server instances, which allow to run NOT multiple applications within single server(which is also possible by default), but multiple Tomcat Server instances. This is widely used technique when you desire to split up different application servers but share binaries between them. Unit template "tomcat@.service" follow the described flow above:
Determines current default Tomcat binaries(configured via alternatives) directory and expose required variable ExecStartPre=/bin/bash -c 'systemctl set-environment CATALINA_HOME=$(readlink -f /usr/bin/tomcat)'
Retrieves server instance configuration(RedHat or Debian makes no difference here, just replace 'sysconfig' to 'default' on deb packaging stage) EnvironmentFile=-/etc/sysconfig/%i
Starts dedicated Tomcat Instance for Jenkins
This kind of configuration provides flexibility on Servlet container configuration, protocols configuration used for proxy communication, simple server and java versions updates, and simplicity for multiple server configuration(dev/int/stage/prod instances) when you are on bare-metal/virtual machines.
So setting up a "tomcat@.service" for single webapps doesn't seem to be necessary at all
For the configuration when the single app should have its own server.
One that starts Jenkins standalone, just like the current sys-v init script does.
I'd left this advanced java app deployment configuration here for someone who tried to find systemd solution from the maintainers. Feel free to switch this unit to the internal winstone(jetty) servlet container used at Jenkins war/jar binaries.