systemd-unit files

Be careful when copy-pasting!

Caddy

Filename: /etc/systemd/system/caddy.service

[Unit]
Description=Caddy HTTP/2 Web Server
Documentation=https://caddyserver.com/docs
After=network.target

[Service]
User=aizan
ExecStart=/usr/local/bin/caddy -agree=true -conf=/home/aizan/script/Caddyfile
PIDFile=/var/run/caddy/caddy.pid
Restart=on-failure
LimitNOFILE=8192

[Install]
WantedBy=multi-user.target

This unit file assumes the User Aizan with its configuration file located at ~/script/Caddyfile.

Gogs

Filename: /etc/systemd/system/gogs.service

[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mariadb.service mysqld.service postgresql.service memcached.service redis.service

[Service]
Type=simple
User=aizan
Group=aizan
WorkingDirectory=/home/aizan/gogs-base/gogs
ExecStart=/home/aizan/gogs-base/gogs/gogs web
Restart=on-failure
RestartSec=5
Environment=USER=aizan HOME=/home/aizan

[Install]
WantedBy=multi-user.target

This unit file assumes the User and Group Aizan with its WorkingDirectory in ~/gogs-base/gogs.