From 864674bd0925a0e31eec5eaab9cf85b34a4d8681 Mon Sep 17 00:00:00 2001 From: Per Magnus Petersen Date: Fri, 11 Sep 2026 18:52:49 +0200 Subject: [PATCH] Point citadel btcprice at the local btcdata over btc-network omarchy is gone, but the citadel deployment still set BTCDATA_URL=http://192.168.50.42:4102 and ran standalone on its own compose network. Every request that proxies to btcdata failed with httpx.ConnectError: All connection attempts failed. btcdata now runs on citadel too, so attach btcprice to the external btc-network there and reach it by service name at http://btcdata:4102. deploy-citadel.sh creates the network on the remote if missing, as btcdata's own deploy script already does. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01TRkiLhK5qhkZjP2adxpA3e --- .env.citadel | 5 +++-- CLAUDE.md | 7 ++++--- README.md | 10 +++++----- deploy-citadel.sh | 4 ++++ docker-compose.citadel.yml | 10 +++++++++- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.env.citadel b/.env.citadel index ac3d311..44df679 100644 --- a/.env.citadel +++ b/.env.citadel @@ -1,8 +1,9 @@ # Environment for the citadel deployment. deploy-citadel.sh copies this to # $APP_DIR/.env on the target host. No secrets — btcprice has none. -# btcdata runs on omarchy (192.168.50.42), publishing its Docker port 4102. -BTCDATA_URL=http://192.168.50.42:4102 +# btcdata runs on citadel too, in the shared btc-network. Reached by service +# name; the port must match DOCKER_BTCDATA_PORT in ../btcdata/.env. +BTCDATA_URL=http://btcdata:4102 # Host port; container always listens on 4040. BTCPRICE_PORT=4041 diff --git a/CLAUDE.md b/CLAUDE.md index 4a7fad3..787d4cd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,9 +38,10 @@ unused — the port in `CMD` is hardcoded. Mirrors `../elprice/deploy-citadel.sh`; no registry. - `docker-compose.citadel.yml` → remote `docker-compose.yml`; `.env.citadel` → remote `.env`. -- Standalone (no `btc-network`): citadel has no btcdata, so `BTCDATA_URL` points at the btcdata - on omarchy, `http://192.168.50.42:4102`. -- Live at http://192.168.50.195:4041. A separate btcprice also still runs on omarchy at :4041. +- btcdata also runs on citadel, so both attach to the external `btc-network` there and + `BTCDATA_URL` is `http://btcdata:4102` (service name, not a LAN address). The deploy script + creates the network on the remote if it is missing. +- Live at http://192.168.50.195:4041. ## Architecture diff --git a/README.md b/README.md index 619dc2c..03fee90 100644 --- a/README.md +++ b/README.md @@ -49,13 +49,13 @@ architecture (citadel is x86_64 → `linux/amd64`), copies `docker-compose.citad pipes the image over SSH with `docker save | docker load`, and runs `docker compose up -d --no-build`. No registry involved. -Deployed btcprice listens on **http://192.168.50.195:4041** and proxies to the btcdata already -running on omarchy (`http://192.168.50.42:4102`, set via `BTCDATA_URL` in `.env.citadel`) — -citadel runs no btcdata of its own, so the deployment compose is standalone with no -`btc-network`. +Deployed btcprice listens on **http://192.168.50.195:4041** and proxies to the btcdata running +on citadel as well. Both attach to the external `btc-network` there, so `BTCDATA_URL` is +`http://btcdata:4102` (set in `.env.citadel`) — the service name inside the network, not a LAN +address. The deploy script creates `btc-network` on the host if it does not exist yet. Overridable: `BTCPRICE_DEPLOY_HOST`, `BTCPRICE_DEPLOY_DIR`, `BTCPRICE_IMAGE_NAME`, -`BTCPRICE_PLATFORM`. +`BTCPRICE_PLATFORM`, `BTCPRICE_NETWORK`. ## Environment Variables diff --git a/deploy-citadel.sh b/deploy-citadel.sh index 41c6060..997d4e6 100755 --- a/deploy-citadel.sh +++ b/deploy-citadel.sh @@ -7,6 +7,7 @@ IMAGE_NAME="${BTCPRICE_IMAGE_NAME:-btcprice:latest}" PLATFORM="${BTCPRICE_PLATFORM:-}" COMPOSE_FILE="docker-compose.citadel.yml" ENV_FILE=".env.citadel" +NETWORK="${BTCPRICE_NETWORK:-btc-network}" FILES=("$COMPOSE_FILE" "$ENV_FILE") if [[ -z "$PLATFORM" ]]; then @@ -35,6 +36,9 @@ docker build --platform "$PLATFORM" -t "$IMAGE_NAME" . echo "Preparing $APP_DIR on $HOST..." ssh "$HOST" "mkdir -p '$APP_DIR'" +echo "Ensuring external network $NETWORK exists on $HOST..." +ssh "$HOST" "docker network inspect '$NETWORK' >/dev/null 2>&1 || docker network create '$NETWORK'" + echo "Copying $COMPOSE_FILE and $ENV_FILE to $HOST:$APP_DIR..." scp "$COMPOSE_FILE" "$HOST:$APP_DIR/docker-compose.yml" scp "$ENV_FILE" "$HOST:$APP_DIR/.env" diff --git a/docker-compose.citadel.yml b/docker-compose.citadel.yml index 0be161a..29bc954 100644 --- a/docker-compose.citadel.yml +++ b/docker-compose.citadel.yml @@ -1,10 +1,18 @@ # Deployment compose for citadel. Copied to $APP_DIR/docker-compose.yml by # deploy-citadel.sh, which also copies .env.citadel to $APP_DIR/.env. -# Standalone: btcdata is remote, so no btc-network here. +# btcdata also runs on citadel, so both attach to the external btc-network and +# btcprice reaches it by service name. +networks: + btc-network: + name: btc-network + external: true + services: btcprice: image: btcprice:latest restart: unless-stopped + networks: + - btc-network ports: - "${BTCPRICE_PORT:-4041}:4040" environment: