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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TRkiLhK5qhkZjP2adxpA3e
This commit is contained in:
2026-09-11 18:52:49 +02:00
co-authored by Claude Opus 5
parent 2af8b6f62d
commit 864674bd09
5 changed files with 25 additions and 11 deletions
+3 -2
View File
@@ -1,8 +1,9 @@
# Environment for the citadel deployment. deploy-citadel.sh copies this to # Environment for the citadel deployment. deploy-citadel.sh copies this to
# $APP_DIR/.env on the target host. No secrets — btcprice has none. # $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 runs on citadel too, in the shared btc-network. Reached by service
BTCDATA_URL=http://192.168.50.42:4102 # name; the port must match DOCKER_BTCDATA_PORT in ../btcdata/.env.
BTCDATA_URL=http://btcdata:4102
# Host port; container always listens on 4040. # Host port; container always listens on 4040.
BTCPRICE_PORT=4041 BTCPRICE_PORT=4041
+4 -3
View File
@@ -38,9 +38,10 @@ unused — the port in `CMD` is hardcoded.
Mirrors `../elprice/deploy-citadel.sh`; no registry. Mirrors `../elprice/deploy-citadel.sh`; no registry.
- `docker-compose.citadel.yml` → remote `docker-compose.yml`; `.env.citadel` → remote `.env`. - `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 - btcdata also runs on citadel, so both attach to the external `btc-network` there and
on omarchy, `http://192.168.50.42:4102`. `BTCDATA_URL` is `http://btcdata:4102` (service name, not a LAN address). The deploy script
- Live at http://192.168.50.195:4041. A separate btcprice also still runs on omarchy at :4041. creates the network on the remote if it is missing.
- Live at http://192.168.50.195:4041.
## Architecture ## Architecture
+5 -5
View File
@@ -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 pipes the image over SSH with `docker save | docker load`, and runs
`docker compose up -d --no-build`. No registry involved. `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 Deployed btcprice listens on **http://192.168.50.195:4041** and proxies to the btcdata running
running on omarchy (`http://192.168.50.42:4102`, set via `BTCDATA_URL` in `.env.citadel`) — on citadel as well. Both attach to the external `btc-network` there, so `BTCDATA_URL` is
citadel runs no btcdata of its own, so the deployment compose is standalone with no `http://btcdata:4102` (set in `.env.citadel`) — the service name inside the network, not a LAN
`btc-network`. 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`, Overridable: `BTCPRICE_DEPLOY_HOST`, `BTCPRICE_DEPLOY_DIR`, `BTCPRICE_IMAGE_NAME`,
`BTCPRICE_PLATFORM`. `BTCPRICE_PLATFORM`, `BTCPRICE_NETWORK`.
## Environment Variables ## Environment Variables
+4
View File
@@ -7,6 +7,7 @@ IMAGE_NAME="${BTCPRICE_IMAGE_NAME:-btcprice:latest}"
PLATFORM="${BTCPRICE_PLATFORM:-}" PLATFORM="${BTCPRICE_PLATFORM:-}"
COMPOSE_FILE="docker-compose.citadel.yml" COMPOSE_FILE="docker-compose.citadel.yml"
ENV_FILE=".env.citadel" ENV_FILE=".env.citadel"
NETWORK="${BTCPRICE_NETWORK:-btc-network}"
FILES=("$COMPOSE_FILE" "$ENV_FILE") FILES=("$COMPOSE_FILE" "$ENV_FILE")
if [[ -z "$PLATFORM" ]]; then if [[ -z "$PLATFORM" ]]; then
@@ -35,6 +36,9 @@ docker build --platform "$PLATFORM" -t "$IMAGE_NAME" .
echo "Preparing $APP_DIR on $HOST..." echo "Preparing $APP_DIR on $HOST..."
ssh "$HOST" "mkdir -p '$APP_DIR'" 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..." echo "Copying $COMPOSE_FILE and $ENV_FILE to $HOST:$APP_DIR..."
scp "$COMPOSE_FILE" "$HOST:$APP_DIR/docker-compose.yml" scp "$COMPOSE_FILE" "$HOST:$APP_DIR/docker-compose.yml"
scp "$ENV_FILE" "$HOST:$APP_DIR/.env" scp "$ENV_FILE" "$HOST:$APP_DIR/.env"
+9 -1
View File
@@ -1,10 +1,18 @@
# Deployment compose for citadel. Copied to $APP_DIR/docker-compose.yml by # Deployment compose for citadel. Copied to $APP_DIR/docker-compose.yml by
# deploy-citadel.sh, which also copies .env.citadel to $APP_DIR/.env. # 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: services:
btcprice: btcprice:
image: btcprice:latest image: btcprice:latest
restart: unless-stopped restart: unless-stopped
networks:
- btc-network
ports: ports:
- "${BTCPRICE_PORT:-4041}:4040" - "${BTCPRICE_PORT:-4041}:4040"
environment: environment: