From 8dc3382f0449d8b140c94da746427f788d079510 Mon Sep 17 00:00:00 2001 From: Nicolas Dreno Date: Tue, 13 Oct 2026 23:55:21 +0200 Subject: [PATCH 1/2] Read the S3 secret from the environment instead of the spec Compiling the specs printed E1070 four times: the s3 dispatcher's secret_access_key was a literal in s3-proxy.yaml, so it was baked into the artifact. It is now env://S3_SECRET_ACCESS_KEY, which the gateway resolves when it loads the artifact, and the compose file sets that variable on the gateway to the RustFS secret. The playground then shows the practice the compiler asks for. Signed-off-by: Nicolas Dreno --- docker-compose.yml | 4 ++++ specs/s3-proxy.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f865666..7fff47f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -60,6 +60,10 @@ services: # mock-oauth, nats) are all internal Docker services, so opt in. Do NOT # enable this in production unless your upstreams are genuinely internal. BARBACANE_ALLOW_INTERNAL_EGRESS: "true" + # specs/s3-proxy.yaml gives the s3 dispatcher's secret_access_key as + # env://S3_SECRET_ACCESS_KEY, resolved when the gateway loads the artifact. + # It must match RUSTFS_SECRET_KEY below. + S3_SECRET_ACCESS_KEY: playground-secret # The compiler is an init container that writes the .bca before the gateway # loads it. compose runtimes that don't strictly honor # service_completed_successfully can start the gateway mid-write; retry so it diff --git a/specs/s3-proxy.yaml b/specs/s3-proxy.yaml index 5adc3d1..93b635e 100644 --- a/specs/s3-proxy.yaml +++ b/specs/s3-proxy.yaml @@ -42,7 +42,7 @@ paths: config: region: us-east-1 access_key_id: playground - secret_access_key: playground-secret + secret_access_key: env://S3_SECRET_ACCESS_KEY endpoint: http://rustfs:9000 force_path_style: true responses: @@ -93,7 +93,7 @@ paths: config: region: us-east-1 access_key_id: playground - secret_access_key: playground-secret + secret_access_key: env://S3_SECRET_ACCESS_KEY endpoint: http://rustfs:9000 force_path_style: true responses: @@ -130,7 +130,7 @@ paths: config: region: us-east-1 access_key_id: playground - secret_access_key: playground-secret + secret_access_key: env://S3_SECRET_ACCESS_KEY endpoint: http://rustfs:9000 force_path_style: true responses: @@ -165,7 +165,7 @@ paths: config: region: us-east-1 access_key_id: playground - secret_access_key: playground-secret + secret_access_key: env://S3_SECRET_ACCESS_KEY endpoint: http://rustfs:9000 force_path_style: true bucket: assets From 1a8da2cb86912b92adaa883613a13d9c4f0e18f3 Mon Sep 17 00:00:00 2001 From: Nicolas Dreno Date: Mon, 16 Nov 2026 17:07:56 +0100 Subject: [PATCH 2/2] Update the playground to Barbacane 1.0.0-rc.1 1.0 removes the web UI and the MCP server, requires signed artifacts, and requires an admin token of at least 32 bytes. - A keygen init container creates an Ed25519 signing key on first start. The compiler signs with it (BARBACANE_SIGNING_KEY) and the gateway pins its public key (BARBACANE_TRUSTED_PUBKEY) from a separate volume. - The control plane publishes only its API (9091); the UI port is gone. The demo admin token is 43 bytes. - x-barbacane-mcp, the MCP requests, the MCP smoke check and the README's MCP section are removed. The smoke test checks the control plane API instead (health, 401 without the token, 200 with it), so CI starts it. - The nightly run tests the .env.example pin while it is a pre-release, since `latest` stays on the last stable release. - The Grafana dashboard queries barbacane_requests_total; its four request panels queried barbacane_requests_total_total, which the gateway has not emitted since barbacane#170. --- .env.example | 12 ++-- .github/workflows/ci.yml | 23 ++++--- README.md | 61 +++++++---------- .../provisioning/dashboards/barbacane.json | 8 +-- docker-compose.yml | 68 ++++++++++++++----- playground.http | 47 ------------- scripts/smoke.sh | 20 ++++-- specs/train-travel-api.yaml | 4 -- 8 files changed, 114 insertions(+), 129 deletions(-) diff --git a/.env.example b/.env.example index 4188b1b..197f437 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,9 @@ # Barbacane image version to pull from ghcr.io/barbacane-dev -# Set to a specific release tag (e.g. 0.12.3) to pin the playground to that version. -# Use "latest" to always pull the most recent release. -BARBACANE_VERSION=0.12.3 +# The playground needs 1.0.0-rc.1 or later. `latest` is the most recent stable +# release, which release candidates do not move. +BARBACANE_VERSION=1.0.0-rc.1 -# Admin token for the control plane. Since 0.8 the control plane refuses to -# start without a non-empty token. This is a demo default — change it for any +# Admin token for the control plane, at least 32 bytes: the control plane +# refuses to start without one. This is a demo default: change it for any # non-local use. -BARBACANE_CONTROL_ADMIN_TOKEN=playground-admin-token +BARBACANE_CONTROL_ADMIN_TOKEN=playground-admin-token-change-me-0123456789 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a29c1a..9a63e90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,8 @@ on: push: branches: [main] schedule: - # Nightly, against the `latest` gateway image, to catch upstream drift. + # Nightly, against the `latest` gateway image (or a newer pre-release pin), + # to catch upstream drift. - cron: '0 5 * * *' workflow_dispatch: inputs: @@ -19,9 +20,9 @@ concurrency: cancel-in-progress: true jobs: - # Resolve which gateway image tag this run tests: the nightly schedule uses - # `latest`, a manual run uses its input, everything else uses the .env.example - # pin. + # Resolve which gateway image tag this run tests: a manual run uses its input, + # the nightly schedule uses `latest` unless the .env.example pin is a + # pre-release (which `latest` does not move to), everything else uses the pin. version: runs-on: ubuntu-latest outputs: @@ -30,12 +31,13 @@ jobs: - uses: actions/checkout@v5 - id: pick run: | - if [ "${{ github.event_name }}" = "schedule" ]; then - TAG=latest - elif [ -n "${{ github.event.inputs.version }}" ]; then + PIN="$(grep '^BARBACANE_VERSION=' .env.example | cut -d= -f2)" + if [ -n "${{ github.event.inputs.version }}" ]; then TAG="${{ github.event.inputs.version }}" + elif [ "${{ github.event_name }}" = "schedule" ] && [ "${PIN#*-}" = "$PIN" ]; then + TAG=latest else - TAG="$(grep '^BARBACANE_VERSION=' .env.example | cut -d= -f2)" + TAG="$PIN" fi echo "tag=$TAG" >> "$GITHUB_OUTPUT" echo "Testing Barbacane image tag: $TAG" @@ -63,8 +65,9 @@ jobs: - name: Start the stack # The observability viewers (Grafana/Loki/Tempo/Alloy) are not needed for # the smoke test; bring up only the gateway, its upstreams, the asset - # seeder and Prometheus. Compose pulls in each service's dependencies. - run: docker compose up -d --pull always barbacane prometheus rustfs-init + # seeder, the control plane and Prometheus. Compose pulls in each + # service's dependencies. + run: docker compose up -d --pull always barbacane control-plane prometheus rustfs-init - name: Run the smoke test run: bash scripts/smoke.sh diff --git a/README.md b/README.md index 9fe4d31..f2bc993 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # Barbacane Playground -A complete demonstration environment for the Barbacane API Gateway featuring a realistic Train Travel API, full observability stack (logs, metrics, traces), control plane UI, S3 object storage proxy, and mock backend services. +A complete demonstration environment for the Barbacane API Gateway featuring a realistic Train Travel API, full observability stack (logs, metrics, traces), signed artifacts, the control plane API, S3 object storage proxy, and mock backend services. ## Quick Start @@ -19,25 +19,29 @@ docker compose ps curl http://localhost:8080/stations ``` -That's it! The API specs are compiled automatically before the gateway starts. +That's it! The API specs are compiled and signed automatically before the gateway starts. ## Version -By default the playground pulls the `latest` images from [GitHub Container Registry](https://github.com/orgs/barbacane-dev/packages). To pin a specific release, copy `.env.example` and set the version: +The playground pulls the Barbacane release `docker-compose.yml` pins (`1.0.0-rc.1`) from [GitHub Container Registry](https://github.com/orgs/barbacane-dev/packages). It needs 1.0.0-rc.1 or later. To run another release, copy `.env.example` and set the version: ```bash cp .env.example .env -# Edit .env and set BARBACANE_VERSION=0.12.3 (or any release tag) +# Edit .env and set BARBACANE_VERSION to a release tag docker compose pull docker compose up -d ``` +## Signed artifacts + +The gateway loads only artifacts signed by the key it pins. On the first start, the `keygen` init container creates an Ed25519 signing key in the `signing_key` volume and writes its public key to the `trusted_key` volume. The `compiler` signs the artifact with the private key (`BARBACANE_SIGNING_KEY`), and the gateway pins the public key (`BARBACANE_TRUSTED_PUBKEY`) and never sees the private one. The key is kept across restarts; `docker compose down -v` deletes it with the other volumes, and the next start creates a new one. + ## Services | Service | URL | Description | |---------|-----|-------------| | **Gateway** | http://localhost:8080 | Barbacane API Gateway (Data Plane) | -| **Control Plane** | http://localhost:3001 | Web UI for managing APIs | +| **Control Plane** | http://localhost:9091 | REST API for projects, specs, artifacts and deployments (admin token) | | **Grafana** | http://localhost:3000 | Dashboards (admin/admin) | | **Prometheus** | http://localhost:9090 | Metrics | | **NATS** | nats://localhost:4222 | Message broker ([monitoring](http://localhost:8222)) | @@ -57,31 +61,6 @@ All requests are in **[playground.http](playground.http)** — open it with the | Events | `POST /events/trips/delayed`, `/events/bookings/confirmed`, `/events/payments/succeeded` | Public | | S3 proxy | `PUT/GET/DELETE /storage/{bucket}/{key+}` | OIDC | | Asset CDN | `GET /assets/{key+}` | Public (rate-limited) | -| MCP Server | `POST /__barbacane/mcp` | JSON-RPC 2.0 | - -### MCP Server (Model Context Protocol) - -The Train Travel API is exposed as an MCP server. AI agents can connect to `POST /__barbacane/mcp` to discover and call API operations via JSON-RPC 2.0. - -```bash -# Initialize a session -curl -s http://localhost:8080/__barbacane/mcp \ - -H "Content-Type: application/json" \ - -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \ - -D - - -# List available tools (use the Mcp-Session-Id from the response above) -curl -s http://localhost:8080/__barbacane/mcp \ - -H "Content-Type: application/json" \ - -H "Mcp-Session-Id: " \ - -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' - -# Call a tool -curl -s http://localhost:8080/__barbacane/mcp \ - -H "Content-Type: application/json" \ - -H "Mcp-Session-Id: " \ - -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"listStations"}}' -``` ### Bookings — OIDC flow @@ -266,12 +245,22 @@ Distributed tracing is available in Grafana (Explore > Tempo). ## Control Plane -The Control Plane UI at http://localhost:3001 provides: -- API specification management -- Gateway configuration -- Plugin management +The control plane's REST API is at http://localhost:9091: projects, specs, compilations, artifacts, plugins, data planes and deployments. Every request but `GET /health` carries the admin token, `BARBACANE_CONTROL_ADMIN_TOKEN` (the demo default is in `.env.example`): + +```bash +TOKEN=playground-admin-token-change-me-0123456789 +curl http://localhost:9091/projects -H "Authorization: Bearer $TOKEN" +``` + +The `barbacane` CLI calls the same API with `barbacane control ` (see the [CLI reference](https://github.com/barbacane-dev/barbacane/blob/main/docs/reference/cli.md#barbacane-control)): + +```bash +export BARBACANE_CONTROL_URL=http://localhost:9091 +export BARBACANE_CONTROL_ADMIN_TOKEN=playground-admin-token-change-me-0123456789 +barbacane control projects list +``` -The Control Plane API is available at http://localhost:9091. +The API describes itself at http://localhost:9091/openapi. ## WireMock Admin @@ -350,7 +339,7 @@ docker compose down -v │ │ │ ┌───────────────┐ │ │ │ Control Plane │ │ - │ │ :3001 │ │ + │ │ :9091 │ │ │ └───────┬───────┘ │ │ │ │ │ ▼ │ diff --git a/configs/grafana/provisioning/dashboards/barbacane.json b/configs/grafana/provisioning/dashboards/barbacane.json index 1fd4c02..c992ea8 100644 --- a/configs/grafana/provisioning/dashboards/barbacane.json +++ b/configs/grafana/provisioning/dashboards/barbacane.json @@ -43,7 +43,7 @@ "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "expr": "sum(rate(barbacane_requests_total_total[1m]))", + "expr": "sum(rate(barbacane_requests_total[1m]))", "refId": "A" } ], @@ -111,7 +111,7 @@ "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "expr": "sum(rate(barbacane_requests_total_total{status=~\"5..\"}[5m])) / sum(rate(barbacane_requests_total_total[5m])) * 100", + "expr": "sum(rate(barbacane_requests_total{status=~\"5..\"}[5m])) / sum(rate(barbacane_requests_total[5m])) * 100", "refId": "A" } ], @@ -203,7 +203,7 @@ "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "expr": "sum by (method, path) (rate(barbacane_requests_total_total[1m]))", + "expr": "sum by (method, path) (rate(barbacane_requests_total[1m]))", "legendFormat": "{{method}} {{path}}", "refId": "A" } @@ -258,7 +258,7 @@ "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "expr": "sum by (status) (rate(barbacane_requests_total_total[1m]))", + "expr": "sum by (status) (rate(barbacane_requests_total[1m]))", "legendFormat": "{{status}}", "refId": "A" } diff --git a/docker-compose.yml b/docker-compose.yml index 7fff47f..2ac0cab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ # # Then visit: # - Gateway: http://localhost:8080 -# - Control Plane UI: http://localhost:3001 +# - Control Plane API: http://localhost:9091 # - Grafana: http://localhost:3000 (admin/admin) # - Prometheus: http://localhost:9090 # - NATS: nats://localhost:4222 @@ -16,19 +16,45 @@ # - RustFS console: http://localhost:9001 (playground/playground-secret) services: + # ========================================================================== + # Signing key (init container - creates the artifact signing key once) + # ========================================================================== + # The private key stays in signing_key, which only the compiler mounts; the + # public key goes to trusted_key, which the gateway pins. The key survives + # restarts; removing the volumes replaces it. + keygen: + image: ghcr.io/barbacane-dev/barbacane-standalone:${BARBACANE_VERSION:-1.0.0-rc.1} + user: "0:0" + entrypoint: ["/bin/sh", "-c"] + command: + - | + set -e + [ -f /keys/private/signing.pk8 ] || barbacane key generate --out /keys/private/signing.pk8 > /dev/null + barbacane key public --key /keys/private/signing.pk8 > /keys/public/signing.pub + volumes: + - signing_key:/keys/private + - trusted_key:/keys/public + restart: "no" + # ========================================================================== # Spec Compiler (init container - compiles specs before gateway starts) # ========================================================================== compiler: - image: ghcr.io/barbacane-dev/barbacane-standalone:${BARBACANE_VERSION:-0.12.3} + image: ghcr.io/barbacane-dev/barbacane-standalone:${BARBACANE_VERSION:-1.0.0-rc.1} command: ["compile", "--spec", "/specs/train-travel-api.yaml", "--spec", "/specs/train-events.yaml", "--spec", "/specs/s3-proxy.yaml", "--spec", "/specs/waf-demo.yaml", "--manifest", "/manifest/barbacane.yaml", "--output", "/output/api.bca", "--allow-plaintext"] - # Run as root so the init container can write the shared artifact volume, - # which is root-owned by default. The gateway mounts it read-only. + # Root, to write the shared artifact volume (root-owned) and read the + # signing key (owner-only). The gateway mounts the artifact read-only. user: "0:0" + environment: + BARBACANE_SIGNING_KEY: /keys/signing.pk8 volumes: - ./specs:/specs:ro - ./barbacane.yaml:/manifest/barbacane.yaml:ro - artifact_data:/output + - signing_key:/keys:ro + depends_on: + keygen: + condition: service_completed_successfully # Only run once, then exit restart: "no" @@ -36,12 +62,16 @@ services: # API Gateway (Data Plane) # ========================================================================== barbacane: - image: ghcr.io/barbacane-dev/barbacane-standalone:${BARBACANE_VERSION:-0.12.3} + image: ghcr.io/barbacane-dev/barbacane-standalone:${BARBACANE_VERSION:-1.0.0-rc.1} + # serve loads only artifacts signed by the key BARBACANE_TRUSTED_PUBKEY + # pins: here, the public key the keygen container wrote. # --admin-bind on 0.0.0.0 exposes the admin API (/health, /metrics, # /provenance) to Prometheus and the host. It defaults to loopback, which # other containers cannot reach. The admin endpoints are unauthenticated; # keep this on an internal network in production. - command: ["serve", "--artifact", "/config/api.bca", "--allow-plaintext-upstream", "--admin-bind", "0.0.0.0:8082"] + entrypoint: ["/bin/sh", "-c"] + command: + - BARBACANE_TRUSTED_PUBKEY="$$(cat /keys/signing.pub)" exec barbacane serve --artifact /config/api.bca --allow-plaintext-upstream --admin-bind 0.0.0.0:8082 ports: - "8080:8080" - "8443:8443" @@ -51,14 +81,15 @@ services: - "127.0.0.1:8082:8082" volumes: - artifact_data:/config:ro + - trusted_key:/keys:ro environment: RUST_LOG: info OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4317 OTEL_SERVICE_NAME: barbacane-playground - # Since 0.8 an SSRF guard blocks upstream calls to internal/private hosts - # by default (fail closed). The playground's upstreams (wiremock, rustfs, - # mock-oauth, nats) are all internal Docker services, so opt in. Do NOT - # enable this in production unless your upstreams are genuinely internal. + # The SSRF guard blocks upstream calls to internal/private hosts by + # default. The playground's upstreams (wiremock, rustfs, mock-oauth, nats) + # are all internal Docker services, so opt in. Do NOT enable this in + # production unless your upstreams are genuinely internal. BARBACANE_ALLOW_INTERNAL_EGRESS: "true" # specs/s3-proxy.yaml gives the s3 dispatcher's secret_access_key as # env://S3_SECRET_ACCESS_KEY, resolved when the gateway loads the artifact. @@ -89,19 +120,18 @@ services: - "logging=alloy" # ========================================================================== - # Control Plane (Web UI + API) + # Control Plane (REST API) # ========================================================================== control-plane: - image: ghcr.io/barbacane-dev/barbacane-control:${BARBACANE_VERSION:-0.12.3} + image: ghcr.io/barbacane-dev/barbacane-control:${BARBACANE_VERSION:-1.0.0-rc.1} ports: - - "3001:80" # Web UI - - "9091:9090" # Control Plane API + - "9091:9090" # Control Plane API (Prometheus has 9090 on the host) environment: DATABASE_URL: postgres://barbacane:barbacane@postgres:5432/barbacane - # Since 0.8 the control plane fails closed: it refuses to start without a - # non-empty admin token (it can mint API keys, upload plugin WASM, and - # deploy artifacts). This is a demo value — set your own in production. - BARBACANE_CONTROL_ADMIN_TOKEN: ${BARBACANE_CONTROL_ADMIN_TOKEN:-playground-admin-token} + # The control plane refuses to start without an admin token of at least + # 32 bytes (it can mint API keys, upload plugin WASM, and deploy + # artifacts). This is a demo value: set your own in production. + BARBACANE_CONTROL_ADMIN_TOKEN: ${BARBACANE_CONTROL_ADMIN_TOKEN:-playground-admin-token-change-me-0123456789} depends_on: postgres: condition: service_healthy @@ -344,3 +374,5 @@ volumes: tempo_data: grafana_data: rustfs_data: + signing_key: + trusted_key: diff --git a/playground.http b/playground.http index ca7e16d..31c80cb 100644 --- a/playground.http +++ b/playground.http @@ -150,53 +150,6 @@ GET {{baseUrl}}/assets/welcome.txt ### No token → 401 Unauthorized GET {{baseUrl}}/storage/playground/hello.txt -# =========================================================================== -# MCP Server (Model Context Protocol · JSON-RPC 2.0) -# AI agents connect to /__barbacane/mcp to discover and call API tools. -# =========================================================================== - -### Initialize MCP session -# @name mcp_init -POST {{baseUrl}}/__barbacane/mcp -Content-Type: application/json - -{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"playground","version":"1.0"}}} - -### List available tools -POST {{baseUrl}}/__barbacane/mcp -Content-Type: application/json -Mcp-Session-Id: {{mcp_init.response.headers.mcp-session-id}} - -{"jsonrpc":"2.0","id":2,"method":"tools/list"} - -### Call tool: list stations -POST {{baseUrl}}/__barbacane/mcp -Content-Type: application/json -Mcp-Session-Id: {{mcp_init.response.headers.mcp-session-id}} - -{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"listStations"}} - -### Call tool: search trips -POST {{baseUrl}}/__barbacane/mcp -Content-Type: application/json -Mcp-Session-Id: {{mcp_init.response.headers.mcp-session-id}} - -{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"searchTrips","arguments":{"origin":"efdbb9d1-02c2-4bc3-afb7-6788d8782b1e","destination":"b2e783e1-c824-4d63-b37a-d8ee6c0b95da","departure_date":"2025-03-15"}}} - -### Call tool: get station details -POST {{baseUrl}}/__barbacane/mcp -Content-Type: application/json -Mcp-Session-Id: {{mcp_init.response.headers.mcp-session-id}} - -{"jsonrpc":"2.0","id":5,"method":"tools/call","params":{"name":"getStation","arguments":{"stationId":"efdbb9d1-02c2-4bc3-afb7-6788d8782b1e"}}} - -### Ping (heartbeat) -POST {{baseUrl}}/__barbacane/mcp -Content-Type: application/json -Mcp-Session-Id: {{mcp_init.response.headers.mcp-session-id}} - -{"jsonrpc":"2.0","id":99,"method":"ping"} - # =========================================================================== # Observability # =========================================================================== diff --git a/scripts/smoke.sh b/scripts/smoke.sh index 2e4aba5..63f4968 100755 --- a/scripts/smoke.sh +++ b/scripts/smoke.sh @@ -8,12 +8,16 @@ # ADMIN_URL (default http://localhost:8082) admin API (metrics/health) # OAUTH_URL (default http://localhost:9099) mock OIDC provider # PROM_URL (default http://localhost:9090) Prometheus +# CONTROL_URL (default http://localhost:9091) control plane API +# BARBACANE_CONTROL_ADMIN_TOKEN (default: the compose file's demo token) set -uo pipefail BASE_URL="${BASE_URL:-http://localhost:8080}" ADMIN_URL="${ADMIN_URL:-http://localhost:8082}" OAUTH_URL="${OAUTH_URL:-http://localhost:9099}" PROM_URL="${PROM_URL:-http://localhost:9090}" +CONTROL_URL="${CONTROL_URL:-http://localhost:9091}" +ADMIN_TOKEN="${BARBACANE_CONTROL_ADMIN_TOKEN:-playground-admin-token-change-me-0123456789}" pass=0 fail=0 @@ -65,7 +69,7 @@ TOKEN="$(curl -s -X POST "$OAUTH_URL/barbacane/token" \ if [ -n "$TOKEN" ]; then echo "PASS got an access token"; pass=$((pass + 1)); else echo "FAIL no access token"; fail=$((fail + 1)); fi AUTH="Authorization: Bearer $TOKEN" -echo "== bookings / events / s3 / mcp ==" +echo "== bookings / events / s3 ==" check "200" "GET /bookings with a token" -H "$AUTH" "$BASE_URL/bookings" check "202 200" "POST /events/trips/delayed (NATS dispatch)" \ -X POST -H 'Content-Type: application/json' \ @@ -74,9 +78,6 @@ check "202 200" "POST /events/trips/delayed (NATS dispatch)" \ check "200 201 204" "PUT /storage/playground/hello.txt" -X PUT -H "$AUTH" -H 'Content-Type: text/plain' -d 'Hello' "$BASE_URL/storage/playground/hello.txt" check "200" "GET /storage/playground/hello.txt" -H "$AUTH" "$BASE_URL/storage/playground/hello.txt" check "200 204" "DELETE /storage/playground/hello.txt" -X DELETE -H "$AUTH" "$BASE_URL/storage/playground/hello.txt" -check "200" "POST /__barbacane/mcp initialize" -X POST -H 'Content-Type: application/json' \ - -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"smoke","version":"1"}}}' \ - "$BASE_URL/__barbacane/mcp" echo "== CORS ==" check "200 204" "OPTIONS /stations (CORS preflight)" \ @@ -98,6 +99,17 @@ echo "== admin API ==" check "200" "GET /health" "$ADMIN_URL/health" check "200" "GET /metrics" "$ADMIN_URL/metrics" +echo "== control plane ==" +i=0 +until [ "$(code "$CONTROL_URL/health")" = "200" ]; do + i=$((i + 1)) + if [ "$i" -gt 30 ]; then echo "warning: control plane not ready after 60s; its checks will report it"; break; fi + sleep 2 +done +check "200" "GET /health" "$CONTROL_URL/health" +check "401" "GET /projects without the admin token" "$CONTROL_URL/projects" +check "200" "GET /projects with the admin token" -H "Authorization: Bearer $ADMIN_TOKEN" "$CONTROL_URL/projects" + echo "== Prometheus scrape ==" # Give Prometheus a scrape interval to reach the gateway. target_up="" diff --git a/specs/train-travel-api.yaml b/specs/train-travel-api.yaml index e4a8d9c..47aca9f 100644 --- a/specs/train-travel-api.yaml +++ b/specs/train-travel-api.yaml @@ -19,10 +19,6 @@ info: name: Train Support email: support@trains.example.com -# MCP Server — exposes all operations as AI-callable tools -x-barbacane-mcp: - enabled: true - servers: - url: http://localhost:8080 description: Playground Gateway