Prepare btcprice for Kubernetes deployment

This commit is contained in:
2026-09-15 17:12:25 +02:00
parent dda00da77a
commit 573eba2d86
8 changed files with 619 additions and 11 deletions
+13 -6
View File
@@ -10,8 +10,7 @@ proxies live price data from btcdata over WebSocket.
- `cp .env.example .env` — optional; `.env` is `-include`d, so a missing one is not fatal
- `make run-local` — Same, but with `BTCDATA_URL=$BTCDATA_LOCAL_URL`
- `make tailwind` — Watch Tailwind CSS for changes
- `make test` — Runs `pytest tests/`, but there is no `tests/` directory yet and pytest is not
in `requirements.txt`
- `make test` — Installs test-only dependencies from `requirements-dev.txt` and runs `pytest tests/`
- `make venv` — Bootstrap the virtualenv without starting the server
## Docker
@@ -27,11 +26,17 @@ Docker runs alongside local dev on different ports:
`btc-network` (`docker network create btc-network` once), and btcdata must be started from
`../btcdata`. Inside the network btcprice reaches it at `http://btcdata:${DOCKER_BTCDATA_PORT:-4102}`.
Note: `Dockerfile` bakes in a stale `ENV BTCDATA_URL=http://btcdata:4101`; compose always
overrides it, so it only matters if the image is run outside compose. `ENV PORT` is likewise
unused — the port in `CMD` is hardcoded.
The image does not set `BTCDATA_URL`; deployments must provide it. `BUILD_SHA` is embedded as
`APP_VERSION` and exposed at `/api/version`. The port in `CMD` is hardcoded to 4040.
## Deployment
## CI/CD
`.gitea/workflows/build.yml` tests pushes to `main` and `v*` tags, then publishes immutable
linux/amd64 images to `harbor.pmagnus.cloud/btcprice/btcprice`. It embeds the short Git SHA as
`APP_VERSION`. CI has no Kubernetes credentials; the planned Flux deployment belongs in
`magnus/deploy` once the shared GitOps gate is complete.
## Legacy deployment
`./deploy-citadel.sh` — build locally for the remote's arch, `docker save | ssh docker load`,
`docker compose up -d --no-build` in `/home/pmp/apps/btcprice` on citadel (192.168.50.195).
@@ -51,6 +56,8 @@ Mirrors `../elprice/deploy-citadel.sh`; no registry.
- **Styling:** Tailwind CSS v4
- **Data backend:** btcdata (separate service at `BTCDATA_URL`, default `http://localhost:4100`)
- **No database** — all data comes from btcdata
- **Probes:** `/api/health` is process-only liveness; `/api/ready` checks btcdata with a 3-second
timeout; `/api/version` exposes the build identifier
### btcdata connection