# ZeBridge in one command, for evaluation. This file is all you need: every service runs a # published image, nothing is built and no other file is read. # # curl -O https://raw.githubusercontent.com/ndrean/ZeBridge/main/docker-compose.quickstart.yml # docker compose -f docker-compose.quickstart.yml up # # then open the links the `init` service prints (http://localhost:5173/?invite=…). # PostgreSQL, NATS in operator mode, the bridge, the sweeper and the browser demo. # Only the demo (5173) and the bridge's /status and /metrics (27434) are published, on # 127.0.0.1. Not a production layout: see deploy/compose/ for a server. # # Optional settings, in a .env next to this file or in the environment: # ZB_VERSION=0.3.3 the release to run (ghcr.io/ndrean/zebridge, zebridge-web-demo) # QS_WEB_PORT=5173 the demo's port on this machine # QS_SURVEY_PORT=5174 the shared record's port on this machine # QS_BRIDGE_PORT=27434 the bridge's /status and /metrics on this machine # # Start again from scratch: docker compose -f docker-compose.quickstart.yml down -v x-zebridge: &zebridge image: ghcr.io/ndrean/zebridge:${ZB_VERSION:-0.3.3} init: true # an init as PID 1 passes SIGTERM on: a stop takes ms, not 10 s services: postgres: image: postgres:18.6-alpine environment: POSTGRES_DB: app # The compose network only: no port is published, so trust stands in for a # superuser password that would otherwise have to live in this file. POSTGRES_HOST_AUTH_METHOD: trust command: ["postgres", "-c", "wal_level=logical", "-c", "max_slot_wal_keep_size=2GB"] volumes: - pg-data:/var/lib/postgresql healthcheck: test: ["CMD", "pg_isready", "-U", "postgres", "-d", "app"] interval: 2s retries: 30 # The one-time setup, carried by the image: NATS configuration, database, demo tables, # invites. A second `up` finds everything in place. init: <<: *zebridge user: root entrypoint: ["/bin/sh", "/usr/share/zebridge/quickstart/init.sh"] environment: QS_WEB_PORT: ${QS_WEB_PORT:-5173} QS_SURVEY_PORT: ${QS_SURVEY_PORT:-5174} volumes: - zb-nats:/zb-nats depends_on: postgres: { condition: service_healthy } nats: image: nats:2.15.0-alpine command: ["-js", "-c", "/zb-nats/nats-server.conf"] volumes: - zb-nats:/zb-nats depends_on: init: { condition: service_completed_successfully } bridge: <<: *zebridge entrypoint: ["/bin/sh", "-c", "set -a; . /zb-nats/.env.nats; . /zb-nats/.env.bridge; set +a; exec bridge"] environment: # Inside the container: the web service reaches /enroll over the compose # network. The host still sees the port on 127.0.0.1 only (below). BRIDGE_BIND: 0.0.0.0 volumes: - zb-nats:/zb-nats ports: - "127.0.0.1:${QS_BRIDGE_PORT:-27434}:27434" depends_on: nats: { condition: service_started } init: { condition: service_completed_successfully } restart: on-failure sweeper: <<: *zebridge entrypoint: ["/bin/sh", "-c", "set -a; . /zb-nats/.env.nats; . /zb-nats/.env.bridge; set +a; exec bridge_sweeper"] volumes: - zb-nats:/zb-nats depends_on: init: { condition: service_completed_successfully } restart: on-failure # The browser demo (examples/05-tables/web-consumer), served by nginx, which also proxies # /bridge/ and /nats to the services above: the page only talks to its own origin. web: image: ghcr.io/ndrean/zebridge-web-demo:${ZB_VERSION:-0.3.3} ports: - "127.0.0.1:${QS_WEB_PORT:-5173}:5173" depends_on: bridge: { condition: service_started } restart: on-failure # The second page (examples/15-shared-record): one record, several editors, a merge. survey: image: ghcr.io/ndrean/zebridge-survey-demo:${ZB_VERSION:-0.3.3} ports: - "127.0.0.1:${QS_SURVEY_PORT:-5174}:5173" depends_on: bridge: { condition: service_started } restart: on-failure volumes: pg-data: zb-nats: