Docs › Running Appwind Pay
Scaling and failover
Appwind Pay runs as two services on each server: upwall (the web/API processes) and upwall-worker (notifications, catch-up, renewal checks, webhooks). Both can run on any number of servers at once — queue rows are claimed with FOR UPDATE SKIP LOCKED, periodic jobs take a Postgres advisory lock — so adding a server never double-processes anything.
Stage 1 — one server (start here)
- 2 vCPU / 4 GB droplet.
web_workers: 2–4inconfig.yaml. - PostgreSQL on the same server, nightly backups to R2 (
upwall-backup.timer). - Handles hundreds of requests per second; the SDKs keep apps working through restarts.
Stage 2 — managed database
Move PostgreSQL to DigitalOcean Managed PostgreSQL with a standby node (automatic failover, point-in-time recovery):
- Create the cluster in the same region (NYC3); add the droplet as a trusted source.
pg_dumptheupwalldatabase and restore it into the cluster.- Set
database_urlin/opt/upwall/config.yamlto the cluster's connection string (sslmode=require), runbash deploy/install.sh. The installer sees the shared database and stops the local one.
Stage 3 — two app servers
- Create a second droplet (another region, e.g. AMS3, keeps you up if a region fails).
- Copy
/opt/upwall/config.yamlto it (samesecret_keyanddatabase_url— the secret key decrypts store keys) and run the same install. - In front, either:
- DigitalOcean Load Balancer with both droplets, health check
GET /health—api.revenueandrevenuepoint at the balancer; or - DNS:
pay-api→ server 1,pay-api2→ server 2, and setfallbackServersin the SDKs; for Google, a second Pub/Sub push subscription to server 2. - Apple allows one notification URL; behind a load balancer it reaches whichever server is up, and the 6-hourly history catch-up covers any gap.
Sizing
| Load | Setup |
|---|---|
| Up to ~1M customers | 1 droplet 2 vCPU / 4 GB |
| Up to ~10M | Managed Postgres 4 GB + 2 droplets 4 vCPU / 8 GB, web_workers: 4, db_pool: 20 |
| More | Add droplets; raise max_connections or add PgBouncer |
Useful commands
systemctl status upwall upwall-worker
sudo -u upwall /opt/upwall/.venv/bin/python -m upwall queues # backlog and job times
sudo -u upwall /opt/upwall/.venv/bin/python -m upwall reconcile --hours 72
journalctl -u upwall-worker -n 100