Skip to content

Part I. Validate with 1 to 3 bots and measure speed

You run 1 to 3 bots until the migration is complete. This part proves the server is fast and steady before more bots are added. Nothing here needs money.

  1. One TEST bot on each platform you use (up to three in total), running for at least 24 hours. No LIVE bot until I.2 is all green.
  2. Realtime switched on in the dashboard, so the cards follow the live feed.
  3. A terminal open on the server (Tailscale SSH) with sudo journalctl -u bideward-hub -f.

I.2 What to check and what counts as passing

Section titled “I.2 What to check and what counts as passing”
Check How Pass
Cards follow the game Watch a card for 10 rounds; compare the round number on the card with the betting site Within 2 seconds of the site, no skipped rounds
Round log complete For one hour, compare the number of crash results stored in the crash history with the number of rounds the site played No gaps
Receiver speed The hub’s health detail page (local only, reached with curl on the server) shows request latency p50, p95, p99 p99 under 150 ms
Write queue Same page: queue length and flush time Queue never above 1,000; flush under 100 ms
Memory sudo systemctl status bideward-hub, bideward-research, postgresql and free -m Hub under 400 MB, research under 250 MB, swap in use under 100 MB
CPU uptime Load average under 1.0 with 3 bots
Dropped connections sudo journalctl -u bideward-hub –since “1 hour ago” with grep -c “ws close” No storm: a few per hour is normal
Alerts Press the dashboard’s Telegram test The message arrives within seconds
Service restart sudo systemctl restart bideward-hub while a bot runs The bot reconnects within 30 seconds; no money or bet record missing; at most the last quarter-second of the round log
Reboot sudo reboot After 3 minutes PostgreSQL, hub, research and tunnel are all up with no action from you
Cloudflare path Cloudflare → Analytics for app.bideward.com Requests rising, errors near zero, WAF blocks only unknown traffic

I.2a The two test programs from the repository, against the real server

Section titled “I.2a The two test programs from the repository, against the real server”

The adapter was tested in a sandbox with simulated bots (the sandbox numbers are in CHANGELOG-lightsail-adapter.md). The numbers that count are the ones from the real 2 GB server, so the same two programs are run here. They are in the repository, need no installation beyond Node, and use test bots only (names “Soak #…” and “Load #…”, mode TEST, no betting). Run them from the server, in /opt/bideward/hub, before any real bot is moved (Part H), and use a receiver key you are willing to use for tests (the same key the bots post with).

  1. Load test: node tools/loadtest.mjs --url https://api.bideward.com --key YOURKEY --bots 30 --seconds 120 --interval 1000 --kb 30 --detail http://127.0.0.1:8080/health/detail (one post per bot per second is far harder than a real bot, which posts once per round). Repeat with --bots 3 and --bots 100. It prints the latency the bots saw (p50, p95, p99) and, from the hub’s own detail page, the highest write queue, memory and event-loop delay. Pass: p99 under 150 ms at 30 bots, queue never above 1,000, hub memory under 900 MB at 100 bots, no errors and no non-200 answers.
  2. Socket soak (E.6 item 5): node tools/soak.mjs --url https://api.bideward.com --key YOURKEY --bots 20 --minutes 30. 20 bots keep their socket open, send ping, expect pong, are cut off at random and reconnect. Pass: the program ends with its own PASS line: every ping answered, every forced drop reconnected, nothing closed on the hub’s side.
  3. Afterwards open the dashboard and delete the “Soak #” and “Load #” cards (✕ remove with the control password), then check that the hub log shows no error lines.

I.3 Then the Cloudflare tests deferred in Part D

Section titled “I.3 Then the Cloudflare tests deferred in Part D”
  1. Turn Bot Fight Mode on (D.8) and repeat I.2’s first three checks for one hour. If any bot request is blocked, turn it off again.
  2. Enable the ingestion rule (D.6) with the real paths and header from step E1; confirm the bots still post; confirm a request without the header is blocked (security checklist, Part N).
  3. Turn on the Access application for /research (D.7) and confirm the Research page opens for you and not in a private window without signing in.
  4. Tunnel-off test (the “back shortly” page). Run sudo systemctl stop cloudflared-bideward, then open https://app.bideward.com in a private window. It must show our branded page (D.11), not Cloudflare’s error. A bot request to api.bideward.com must fail in a way the loader retries. Then run sudo systemctl start cloudflared-bideward and confirm the dashboard returns within a minute. If the Worker does not show our page, tell me; the fallback is a plain static page.
  5. Host-route test. Open https://api.bideward.com/ in a browser: it must not show the dashboard (404). Open an ingestion path on https://app.bideward.com: 404.
  1. Add bots in steps (3, then 10, then 30), 24 hours at each step, repeating the I.2 table.
  2. Move to the 4 GB server when any of these is true for an hour: swap in use above 300 MB, hub memory above 700 MB, p99 above 150 ms, or PostgreSQL’s cache hit rate falls under 98%.
  3. Lightsail cannot resize an instance in place. The upgrade is: take a manual snapshot, create a new instance from the snapshot at the larger size, then on the new instance run tailscale up again and remove the old machine in the Tailscale console (two machines with the same identity confuse it). Stop the old instance’s cloudflared before starting the new one, so the tunnel connects only from the new server. Raise shared_buffers to 1 GB and effective_cache_size to 2 GB (B.2) and the unit memory limits in proportion. Verify the Lightsail prices for each size before choosing.

← Previous: Part H. The cutover: pointing the loaders at the new address · Guide index · Next: Part J. Backups and restore →