#
# Systemd unit file for Jetty
#

[Unit]
Description=Jetty 9 Web Application Server
Documentation=https://www.eclipse.org/jetty/documentation/current/
After=network.target

[Service]

# Configuration
Environment="JETTY_HOME=/usr/share/jetty9/"
Environment="JETTY_STATE=/var/lib/jetty9/jetty.state"
Environment="JAVA_OPTS=-Djava.awt.headless=true"
EnvironmentFile=-/etc/default/jetty9

# Lifecycle
Type=simple
ExecStart=/usr/share/jetty9/bin/jetty.sh run
SuccessExitStatus=143
Restart=on-abort

# Logging
SyslogIdentifier=jetty9

# Security
User=jetty
Group=jetty
PrivateTmp=yes
AmbientCapabilities=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
WorkingDirectory=/usr/share/jetty9/
LogsDirectory=jetty9
LogsDirectoryMode=750
ProtectSystem=strict
ReadWritePaths=/var/lib/jetty9/

[Install]
WantedBy=multi-user.target
