# ============================================================================= # Nodal AI — Docker Compose stack # # Services: # stellar-quickstart — local Stellar network (Horizon + Soroban RPC) # agent — Nodal AI backend (connects to quickstart) # # Usage: # docker compose up --build # start everything # docker compose up stellar-quickstart # local network only # docker compose run --rm agent npm run test:ts # run TS tests in container # ============================================================================= version: "3.9" services: # ── Local Stellar network ──────────────────────────────────────────────────── stellar-quickstart: image: stellar/quickstart:latest container_name: nodal-stellar platform: linux/amd64 # quickstart only ships amd64 ports: - "8000:8000" # Horizon REST API - "8001:8001" # Soroban RPC environment: NETWORK: local # isolated local network, no real funds command: > --local --enable-soroban-rpc --soroban-rpc-port 8001 healthcheck: test: ["CMD", "curl", "-sf", "http://localhost:8000"] interval: 10s timeout: 5s retries: 12 start_period: 30s networks: - nodal-net # ── Nodal AI agent ─────────────────────────────────────────────────────────── agent: build: context: . dockerfile: Dockerfile target: production container_name: nodal-agent depends_on: stellar-quickstart: condition: service_healthy environment: # Point to the local quickstart network STELLAR_NETWORK: local HORIZON_URL: http://stellar-quickstart:8000 SOROBAN_RPC_URL: http://stellar-quickstart:8001 # Override these via a .env file or CI secrets — never hardcode real keys AGENT_SECRET_KEY: ${AGENT_SECRET_KEY:?AGENT_SECRET_KEY is required} X402_ASSET_CODE: ${X402_ASSET_CODE:-USDC} X402_ASSET_ISSUER: ${X402_ASSET_ISSUER:?X402_ASSET_ISSUER is required} AGENT_SPENDING_LIMIT: ${AGENT_SPENDING_LIMIT:-100} MAX_RETRIES: ${MAX_RETRIES:-3} RETRY_DELAY_MS: ${RETRY_DELAY_MS:-1500} NODE_ENV: production ports: - "3000:3000" healthcheck: test: ["CMD-SHELL", "node -e \"require('./dist/backend/config')\" || exit 1"] interval: 30s timeout: 10s retries: 3 security_opt: - "no-new-privileges:true" cap_drop: - ALL cap_add: - NET_BIND_SERVICE restart: unless-stopped networks: - nodal-net # Mount WASM contract at runtime (optional: already baked into image) # volumes: # - ./contracts/escrow:/app/contracts/escrow:ro # ── Integration test runner (one-shot, not started by default) ─────────────── test-runner: build: context: . dockerfile: Dockerfile target: node-builder # has devDeps + source container_name: nodal-test-runner profiles: - test # only starts with: docker compose --profile test up depends_on: stellar-quickstart: condition: service_healthy environment: STELLAR_NETWORK: local HORIZON_URL: http://stellar-quickstart:8000 SOROBAN_RPC_URL: http://stellar-quickstart:8001 AGENT_SECRET_KEY: ${AGENT_SECRET_KEY:-SBZ7EYXHNB4WPPIWC5YAMH2U4L4QU6DKYXQWG4I55G6O4CLE4BBHCE73} X402_ASSET_CODE: USDC X402_ASSET_ISSUER: ${X402_ASSET_ISSUER:-GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN} AGENT_SPENDING_LIMIT: "100" MAX_RETRIES: "3" RETRY_DELAY_MS: "100" command: npm run test:ts networks: - nodal-net networks: nodal-net: driver: bridge