Start free
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–4 in config.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):

  1. Create the cluster in the same region (NYC3); add the droplet as a trusted source.
  2. pg_dump the upwall database and restore it into the cluster.
  3. Set database_url in /opt/upwall/config.yaml to the cluster's connection string (sslmode=require), run bash deploy/install.sh. The installer sees the shared database and stops the local one.

Stage 3 — two app servers

  1. Create a second droplet (another region, e.g. AMS3, keeps you up if a region fails).
  2. Copy /opt/upwall/config.yaml to it (same secret_key and database_url — the secret key decrypts store keys) and run the same install.
  3. In front, either:
  4. DigitalOcean Load Balancer with both droplets, health check GET /health — api.revenue and revenue point at the balancer; or
  5. DNS: pay-api → server 1, pay-api2 → server 2, and set fallbackServers in the SDKs; for Google, a second Pub/Sub push subscription to server 2.
  6. 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