Overview: why we are moving and what the finished system looks like
Owner: Frank (Thankgod) Ikari | Date: 29 November 2026 | Replaces: the earlier doc 66 (Research Database Install) and the migration parts of docs 55 and 65. For: doing it hands-on from an empty Lightsail server to a live Bideward receiver, dashboard and Research page.
STATUS: PLAN FOR REVIEW (version 2, 29 Nov 2026). Nothing in this guide has been built or run yet. Frank reviews it; only after his go-ahead does Claude Code write the Node adapter (Part E). This guide now lives in the repository (docs/setup/lightsail/) and is edited there; the Google Doc 66 is only a pointer to it. Where this guide says “verify at the time”, a Cloudflare or AWS screen or plan limit may have changed and must be checked on screen before relying on it.
1. Why we are moving, and what the finished system looks like
Section titled “1. Why we are moving, and what the finished system looks like”The Cloudflare Worker keeps all receiver state in one Durable Object. On the free plan that object may write only 100,000 rows a day; running many bots passed that on 28 Nov 2026, so the dashboard answers “the receiver could not answer just now (Exceeded allowed rows written in Durable Objects free tier)”. More bots means more writes, so the limit will keep coming back. There is no money for a paid plan, so the receiver moves to the Lightsail server you already pay for. Cloudflare stays in front as a shield (DNS, TLS, firewall rules, rate limits, optional login gate), but it no longer stores anything.
The finished picture, in one line: bot or browser → Cloudflare (app.bideward.com for people, api.bideward.com for bots) → Cloudflare Tunnel (outbound connection made by the server) → Bideward hub on 127.0.0.1 → PostgreSQL on a private socket.
| Piece | Where it runs | What it does |
|---|---|---|
| 1. Cloudflare edge | Cloudflare | Owns the names app.bideward.com and api.bideward.com. Terminates https, applies WAF rules and rate limits, hides the server’s address. Stores nothing. |
| 2. cloudflared (the tunnel) | Lightsail box | Opens an outbound connection to Cloudflare and carries requests and WebSockets to the hub. This is why no inbound port is open. |
| 3. Bideward hub (Node adapter) | Lightsail box, 127.0.0.1:8080 | Runs the same receiver code as the Worker (cloudflare/worker.js) unchanged, on a small Node layer that behaves like a Durable Object. Serves the dashboard, bots, loaders and WebSockets. |
| 4. PostgreSQL 17 | Lightsail box, Unix socket only (no network port) | Stores everything: the key-value state the Worker used, and, step by step, proper tables for accounts, roles, bots, settings, sessions, take-profit and ruin records, rounds and more. |
| 5. Research service | Lightsail box, 127.0.0.1:8787 | The existing research service. Private: no public name, no certificate, no open port. The hub calls it locally. |
| 6. Backups | Box disk, Lightsail snapshots, Google Drive | Nightly database dumps, the existing Drive backup of the app data, and server snapshots. |
| 7. Tailscale | Box and your computer | The only way to open a terminal on the box (SSH). |
The old Cloudflare Worker is kept only until the move is proven, then switched off.