Poll sync cheaply and make the server deployable
Polling re-downloaded the whole store, photos included, every five
seconds. The app now checks a tiny version endpoint and only fetches the
payload when it actually moved, and the server gained request logging,
graceful shutdown, and self-hosting docs so it can run on a VPS instead
of only on localhost.
💘 Generated with Crush
Assisted-by: Crush:kimi-k3
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Prompt sync server
|
||||
Documentation=https://gitea.tzgyn.dev/TZGyn/prompt
|
||||
After=network-online.target postgresql.service
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
# The binary is built on a Mac with:
|
||||
# GOOS=linux GOARCH=arm64 go build -o prompt-sync .
|
||||
ExecStart=/usr/local/bin/prompt-sync
|
||||
Environment=PROMPT_SYNC_ADDR=:8080
|
||||
Environment=PROMPT_SYNC_DATABASE_URL=postgres://prompt:CHANGE_ME@localhost:5432/prompt_sync?sslmode=disable
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
# The server only needs to talk to Postgres and bind :8080.
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user