[Unit]
Description=Grimmory - Self-hosted book library
After=network.target mysql.service
Requires=mysql.service

[Service]
Type=simple
User={{ grimmory_sys_user }}
Group={{ grimmory_sys_group }}
WorkingDirectory={{ grimmory_install_path }}
EnvironmentFile={{ grimmory_install_path }}/.env
ExecStart={{ grimmory_java_home }}/bin/java {{ grimmory_jvm_opts }} -jar {{ grimmory_install_path }}/app.jar
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectSystem=strict
ProtectControlGroups=true
ProtectHome=true
ProtectKernelTunables=true
ProtectKernelModules=true
ReadWritePaths={{ grimmory_install_path }} {{ grimmory_data_path }} {{ grimmory_bookdrop_path }}
MemoryMax=1200M
MemoryHigh=1100M
UMask=0027

[Install]
WantedBy=multi-user.target
