Systemd socket activation keeps the listening socket open across service restarts so connections queue at the kernel instead of getting 503s from Caddy. The Go server detects LISTEN_FDS and uses the inherited fd, falling back to normal listen for local dev. Caddy retry window bumped as a safety net. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
19 lines
539 B
Django/Jinja
19 lines
539 B
Django/Jinja
[Unit]
|
|
Description=WP Packages
|
|
After=network.target litestream.service
|
|
Requires=litestream.service wppackages.socket
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=deploy
|
|
Group=www-data
|
|
WorkingDirectory={{ app_root }}/current
|
|
ExecStart={{ app_root }}/current/{{ go_binary_name }} serve --db {{ db_path }}
|
|
Restart=always
|
|
RestartSec=1s
|
|
StandardOutput=append:{{ app_root }}/shared/storage/logs/wppackages.log
|
|
StandardError=append:{{ app_root }}/shared/storage/logs/wppackages.log
|
|
EnvironmentFile={{ app_root }}/shared/.env
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|