#
# Systemd unit file for Apache Tomcat
#

[Unit]
Description=Apache Tomcat 10 Web Application Server
Documentation=https://tomcat.apache.org/tomcat-10.0-doc/index.html
After=network.target
RequiresMountsFor=/var/log/tomcat10 /var/lib/tomcat10

[Service]

# Configuration
Environment="CATALINA_HOME=/usr/share/tomcat10"
Environment="CATALINA_BASE=/var/lib/tomcat10"
Environment="CATALINA_TMPDIR=/tmp"
Environment="JAVA_OPTS=-Djava.awt.headless=true"

# Lifecycle
Type=simple
ExecStartPre=+/usr/libexec/tomcat10/tomcat-update-policy.sh
ExecStart=/bin/sh /usr/libexec/tomcat10/tomcat-start.sh
SuccessExitStatus=143
Restart=on-abort

# Logging
SyslogIdentifier=tomcat10

# Security
User=tomcat
Group=tomcat
PrivateTmp=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
CacheDirectory=tomcat10
CacheDirectoryMode=750
ProtectSystem=strict
ReadWritePaths=/etc/tomcat10/Catalina/
ReadWritePaths=/var/lib/tomcat10/webapps/
ReadWritePaths=/var/log/tomcat10/

[Install]
WantedBy=multi-user.target
