SpeakTrue

SpeakTrue LA/Canada Load Balancer Plan

Summary

Build a warm-standby failover setup for web.speaktrue.cc:

Key Changes

Canada Runtime Instance

Provision a Canada Docker VM/container equivalent to the current LA SpeakTrue host.

Required Canada setup:

Cloudflare Tunnels

Use two site-specific tunnels:

Each tunnel routes to the local app:

service = http://127.0.0.1:8000

Create two non-user-facing origin hostnames:

st-web-la-origin.speaktrue.cc
st-web-ca-origin.speaktrue.cc

Tunnel public hostnames:

st-web-la-origin.speaktrue.cc -> http://127.0.0.1:8000
st-web-ca-origin.speaktrue.cc -> http://127.0.0.1:8000

Do not put these origin hostnames in marketing copy, Supabase redirects, or app config. They exist only for Cloudflare Load Balancing health checks and origin routing.

Cloudflare Load Balancer

Create a Cloudflare Load Balancer for:

web.speaktrue.cc

Pool design:

Traffic policy:

TLS mode:

GitHub Actions Deploy

Replace the single-target homelab deploy workflow with two deploy jobs.

Secrets:

LA_HOMELAB_SSH_HOST
LA_HOMELAB_SSH_USER
LA_HOMELAB_SSH_PRIVATE_KEY
LA_HOMELAB_DEPLOY_PATH
LA_HOMELAB_SSH_PORT

CA_HOMELAB_SSH_HOST
CA_HOMELAB_SSH_USER
CA_HOMELAB_SSH_PRIVATE_KEY
CA_HOMELAB_DEPLOY_PATH
CA_HOMELAB_SSH_PORT

Workflow behavior:

App/Auth Compatibility

Keep the public app identity stable:

LEGACY_WEB_PUBLIC_ORIGIN=https://web.speaktrue.cc
LEGACY_AUTH_POST_LOGIN_REDIRECT_URL=https://web.speaktrue.cc/

Do not add origin hostnames to normal auth redirect flows unless direct origin debugging is explicitly needed.

Supabase redirect allowlist should continue to include:

https://web.speaktrue.cc/**
https://speaktrue.cc/auth/callback
https://speaktrue.cc/auth/callback/

Only add origin hostnames to Supabase redirects if intentionally testing OAuth directly against an origin hostname. The default is not to add them.

Monitoring And Verification

Initial rollout checks:

  1. Verify LA origin directly:

    curl -fsS https://st-web-la-origin.speaktrue.cc/health
    
  2. Verify Canada origin directly:

    curl -fsS https://st-web-ca-origin.speaktrue.cc/health
    
  3. Verify the load-balanced hostname:

    curl -fsS https://web.speaktrue.cc/health
    
  4. Confirm Cloudflare Load Balancing reports:

    • la-primary healthy
    • ca-standby healthy
    • active routing to LA

Failover drill:

  1. Disable the LA tunnel route or stop the LA app container.
  2. Wait for Cloudflare to mark LA unhealthy.
  3. Confirm:
    • https://web.speaktrue.cc/health remains 200
    • Cloudflare routes to Canada
    • login page loads
    • authenticated session still works
    • STT/TTS basic workflow still works
  4. Restore LA.
  5. Confirm traffic returns to LA after the healthy threshold.

Operational monitors to add or update:

Test Plan

Before enabling the load balancer:

After enabling the load balancer:

Assumptions And Defaults