Infrastructure Overview¶
How the tomoda app fits into production. This section is app-perspective — what runs where, how a request reaches the backend, how secrets get into a Pod. For the infrastructure itself (Terraform, K8s manifests, Argo CD, cluster operations), see the separate devops docs.
Environments¶
Three environments. Each is intentionally a strict superset of the previous one so surprises in production are minimized.
Local¶
Everything runs on the developer's machine. Infra dependencies (Postgres, Redis, RustFS, Photon) come up via docker-compose.dev.yml; the Go backend and the Expo frontend run outside Docker for fast iteration and hot reload.
| Component | How it runs locally |
|---|---|
| Postgres + PostGIS | kartoza/postgis:15-3.3 container on :5432 |
| Redis | redis:7-alpine container on :6379 |
| Object storage | RustFS container on :9000 / :9001 (S3-compatible) |
| Geocoder | Photon container on :2322 |
| Backend (Go) | go run / Air hot reload, served on :8080 |
| Frontend (Expo) | task dev:frontend, Metro on :8081 |
task dev orchestrates this — see Docker Compose and Getting Started.
Dev¶
The tomoda-dev namespace on the k3s cluster (one OVH bare-metal server in Beauharnois, Quebec), used for integration testing and pre-prod validation. Application manifests live in the separate devops/ repo at k8s/apps/tomoda/overlays/dev/. Argo CD watches that repo and reconciles cluster state. Secrets are sourced from GCP Secret Manager via External Secrets Operator.
Prod¶
Same cluster as dev, isolated in the tomoda-prod namespace. Argo CD reconciles k8s/apps/tomoda/overlays/prod/.
How prod actually runs
Prod is not managed databases. Postgres runs in-cluster as a CloudNative-PG (CNPG) cluster on local NVMe, Redis runs in-cluster as the Bitnami Helm chart. All object storage (user media, CNPG backups, Photon indexes, seed sets) is Cloudflare R2. For the full story, see DevOps → Architecture.
Production topology (app-perspective)¶
iOS / Android / Web
assets.tomoda.life
api / app / www
Go · :8080
Nginx · :8081
+ PostGIS
:2322 ClusterIP
Details worth calling out:
- Two Cloudflare paths. Media (
assets.tomoda.life) is served by a Worker in front of R2 that checks signed URLs and caches at the edge. API + web traffic (api.tomoda.life,app.tomoda.life,www.tomoda.life) resolves to the server's public IP, where Traefik terminates TLS; prod hostnames are proxied through Cloudflare with origin mTLS. - One ingress, two backends. Traefik routes
/api/v1/*and/ws/*to the Go backend Pod, everything else to the frontend Pod (Nginx serving the Expo web static export). Seek8s/apps/tomoda/base/ingress.yamlin the devops repo. - Frontend is static. The
frontend/container is a multi-stage build (Node 20 → Nginx Alpine).EXPO_PUBLIC_*env vars bake in at build time — see Container images. - Photon is internal-only. The Photon Service is
ClusterIPathttp://photon.platform.svc.cluster.local:2322. No external ingress. - Outbound for third-party APIs. Stripe, Resend, Google OAuth, Google Places — all called from the backend. Webhooks come back inbound through Cloudflare → Traefik → backend.
How the app gets there¶
| Concern | App side | Infra side (devops repo) |
|---|---|---|
| Image build | images.yml → GHCR |
OVH bare metal (registry pull) |
| Deployment | n/a — GitOps via Argo CD | Argo CD, Tomoda K8s app, Deploy runbook |
| Postgres | DSN env var (DB_HOST, DB_USER, DB_PASSWORD) |
CNPG cluster |
| Redis | URL env var (REDIS_*) |
Bitnami Redis |
| Object storage | S3 SDK against R2 via object-storage-credentials; signed URLs with ASSET_SIGNING_KEY |
Cloudflare → R2 |
| Photon | PHOTON_URL env var → in-cluster service DNS |
Photon |
| Secrets | envFrom: backend-secrets and object-storage-credentials |
Secrets Management, External Secrets |
| TLS | n/a — ingress-level | cert-manager, TLS |
| DNS | n/a | Cloudflare, External-DNS |
Hosting¶
- Cluster: k3s on one OVH Rise bare-metal server, Beauharnois (BHS)
- Images:
ghcr.io/tomoda-labs/tomoda-{backend,frontend} - Object storage: Cloudflare R2 (
tomoda-assets-{dev,prod}and infra buckets) - GCP project
development-485000: Secret Manager, Google OAuth clients, Places API only
What's not in this section¶
- Native (iOS / Android) builds and OTA updates — that's the EAS pipeline. See Native → Release.
- Application-layer concerns (queues, scheduler, WebSocket Hub) — see
backend/infrastructure/. - Cluster operations, disaster recovery, scaling decisions — see DevOps → Operations.