[Unit]
Description=Squash TM
After=syslog.target network.target mariadb.service postgresql.service postgresql-11.service postgresql-12.service postgresql-13.service postgresql-14.service

[Service]
Type=simple
User={{ squashtm_user }}
Group={{ squashtm_user }}
WorkingDirectory={{ squashtm_root_dir }}/app
EnvironmentFile={{ squashtm_root_dir }}/etc/env
ExecStart=/usr/lib/jvm/jre-17/bin/java \
            -Xms128m -Xmx2048m -server \
            -Duser.language=en \
            -Djava.io.tmpdir=${TMP_DIR} \
            -Dlogging.dir=${LOG_DIR} \
            -jar ${BUNDLES_DIR}/${JAR_NAME} \
            --spring.config.additional-location=${CONF_DIR}/ \
            --spring.profiles.active=${DB_TYPE} \
            --spring.config.name=application,squash.tm.cfg \
            --logging.config=${CONF_DIR}/log4j2.xml
UMask=007
SuccessExitStatus=143
PrivateTmp=yes
NoNewPrivileges=true
MemoryLimit=3072M
SyslogIdentifier=squash-tm
Restart=on-failure
StartLimitInterval=0
RestartSec=30
PrivateDevices=true
ProtectControlGroups=true
ProtectHome=true
ProtectSystem=full
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict
RestrictRealtime=true
RestrictNamespaces=true
ReadWritePaths=/run {{ squashtm_root_dir }}/logs {{ squashtm_root_dir }}/data {{ squashtm_root_dir }}/tmp
LockPersonality=true

[Install]
WantedBy=multi-user.target

