feat: caddyfile, api.service, 01.sh makefile

This commit is contained in:
2026-05-01 15:08:38 +02:00
parent f94048539e
commit 2c2459c833
5 changed files with 166 additions and 0 deletions
@@ -0,0 +1,12 @@
# Set the email address that should be used to contact you if there is a problem with
# your TLS certificates.
{
email you@example.com
}
# Remove the http:// prefix from your site address.
xxx.xxx.net {
respond /debug/* "Not Permitted" 403
reverse_proxy localhost:4000
}
@@ -0,0 +1,34 @@
[Unit]
# Description is a human-readable name for the service.
Description=Greenlight API service
# Wait until PostgreSQL is running and the network is "up" before starting the service.
After=postgresql.service
After=network-online.target
Wants=network-online.target
# Configure service start rate limiting. If the service is (re)started more than 5 times
# in 600 seconds then don't permit it to start anymore.
StartLimitIntervalSec=600
StartLimitBurst=5
[Service]
# Execute the API binary as the greenlight user, loading the environment variables from
# /etc/environment and using the working directory /home/greenlight.
Type=exec
User=greenlight
Group=greenlight
EnvironmentFile=/etc/environment
WorkingDirectory=/home/greenlight
ExecStart=/home/greenlight/api -port=4000 -db-dsn=${GREENLIGHT_DB_DSN} -env=production
# Automatically restart the service after a 5-second wait if it exits with a non-zero
# exit code. If it restarts more than 5 times in 600 seconds, then the rate limit we
# configured above will be hit and it won't be restarted anymore.
Restart=on-failure
RestartSec=5
[Install]
# Start the service automatically at boot time (the 'multi-user.target' describes a boot
# state when the system will accept logins).
WantedBy=multi-user.target