52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
|
#
|
||
|
# Systemd unit file for Apache Tomcat
|
||
|
#
|
||
|
|
||
|
[Unit]
|
||
|
Description=Apache Tomcat {{ tomcat_version}} Web Application Server
|
||
|
After=syslog.target network.target
|
||
|
StartLimitIntervalSec=500
|
||
|
StartLimitBurst=5
|
||
|
RequiresMountsFor={{ tomcat_m_instances_logdir_base }}/{{ item.http_port }} /var/lib/tomcat{{ tomcat_version }}
|
||
|
|
||
|
[Service]
|
||
|
Environment="CATALINA_HOME=/usr/share/tomcat{{ tomcat_version }}"
|
||
|
Environment="CATALINA_BASE={{ item.instance_path }}"
|
||
|
Environment="CATALINA_TMPDIR={{ item.catalina_tmp_directory }}"
|
||
|
Type=simple
|
||
|
ExecStartPre=+/usr/libexec/tomcat{{ tomcat_version}}/tomcat-update-policy.sh
|
||
|
ExecStart=/bin/sh /usr/libexec/tomcat{{ tomcat_version }}/tomcat-instance-{{ item.http_port }}-start.sh
|
||
|
SuccessExitStatus=143
|
||
|
RestartSec=10
|
||
|
Restart=on-failure on-abort
|
||
|
# Logging
|
||
|
SyslogIdentifier=tomcat{{ tomcat_version }}
|
||
|
|
||
|
User={{ item.user }}
|
||
|
Group={{ item.user }}
|
||
|
{% if tomcat_systemd_security %}
|
||
|
PrivateTmp=yes
|
||
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||
|
NoNewPrivileges=true
|
||
|
CacheDirectory={{ tomcat_m_cache_base }}/{{ item.http_port }}
|
||
|
CacheDirectoryMode=750
|
||
|
ProtectSystem=strict
|
||
|
ReadWritePaths={{ item.instance_path }}/conf/Catalina/
|
||
|
ReadWritePaths={{ item.instance_path }}/webapps
|
||
|
ReadWritePaths={{ tomcat_m_instances_logdir_base }}/{{ item.http_port }}
|
||
|
{% endif %}
|
||
|
{% if tomcat_systemd_security_enhanced %}
|
||
|
ProtectSystem=strict
|
||
|
ProtectHome=yes
|
||
|
PrivateDevices=yes
|
||
|
PrivateUsers=yes
|
||
|
ProtectKernelTunables=yes
|
||
|
ProtectKernelLogs=yes
|
||
|
RestrictAddressFamilies=AF_INET6 AF_INET
|
||
|
SystemCallArchitectures=native
|
||
|
SystemCallFilter=@system-service
|
||
|
{% endif %}
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|