packages.wenpai.net/deploy/ansible/roles/wppackages/templates/wppackages.service.j2
Ben Word e276195b6e
Implement socket-activated zero-downtime deploy switchover (#67)
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>
2026-04-04 14:07:54 -05:00

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