name: influxdb3-ref-bess services: # One-shot: generate an offline admin token on first boot. The server # needs one via --admin-token-file; the recovery endpoint can only # REGENERATE existing tokens, not create the first one. token-bootstrap: image: influxdb:3-enterprise container_name: bess-token-bootstrap environment: # Image defaults set the deprecated LOG_FILTER; unset and replace. INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info volumes: - influxdb-data:/var/lib/influxdb3 entrypoint: ["sh", "-c"] command: - | if [ -s /var/lib/influxdb3/.bess-operator-token ]; then echo "[bootstrap] admin token already exists, skipping" exit 0 fi echo "[bootstrap] generating offline admin token" influxdb3 create token --admin --offline \ --name bess-admin \ --output-file /var/lib/influxdb3/.bess-operator-token chmod 600 /var/lib/influxdb3/.bess-operator-token echo "[bootstrap] admin token written" restart: "no" influxdb3: image: influxdb:3-enterprise container_name: bess-influxdb3 depends_on: token-bootstrap: condition: service_completed_successfully environment: INFLUXDB3_ENTERPRISE_LICENSE_EMAIL: ${INFLUXDB3_ENTERPRISE_EMAIL:?set INFLUXDB3_ENTERPRISE_EMAIL in .env} INFLUXDB3_ENTERPRISE_LICENSE_TYPE: ${INFLUXDB3_ENTERPRISE_LICENSE_TYPE:-trial} INFLUXDB3_PLUGIN_DIR: /plugins INFLUXDB3_NODE_IDENTIFIER_PREFIX: bess-node INFLUXDB3_OBJECT_STORE: file INFLUXDB3_DATA_DIR: /var/lib/influxdb3 INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info command: > serve --node-id bess-node0 --cluster-id bess --mode all --object-store file --data-dir /var/lib/influxdb3 --plugin-dir /plugins --virtual-env-location /var/lib/influxdb3/plugin-venv --admin-token-file /var/lib/influxdb3/.bess-operator-token --admin-token-recovery-http-bind 0.0.0.0:8182 volumes: - influxdb-data:/var/lib/influxdb3 - ./plugins:/plugins:ro - ./influxdb/init.sh:/usr/local/bin/bess-init.sh:ro ports: - "8181:8181" healthcheck: # /health requires auth and returns 401 for unauth'd probes. We don't # care about the status code here — we only want to know the server is # responding. `curl -s --max-time 2 -o /dev/null` exits 0 on any HTTP # round-trip (200, 401, whatever). Also require the operator token file # written by influxdb3-init so downstream services don't start early. test: ["CMD-SHELL", "curl -s --max-time 2 -o /dev/null http://127.0.0.1:8181/health && test -s /var/lib/influxdb3/.bess-operator-token"] interval: 5s timeout: 3s retries: 120 start_period: 5s influxdb3-init: image: influxdb:3-enterprise container_name: bess-influxdb3-init depends_on: influxdb3: condition: service_started environment: INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info volumes: - influxdb-data:/var/lib/influxdb3 - ./influxdb/init.sh:/usr/local/bin/bess-init.sh:ro - ./plugins:/plugins:ro entrypoint: ["/usr/local/bin/bess-init.sh"] restart: "no" simulator: build: context: . dockerfile: simulator/Dockerfile container_name: bess-simulator depends_on: influxdb3: condition: service_healthy environment: INFLUX_URL: http://influxdb3:8181 INFLUX_DB: bess INFLUX_TOKEN_FILE: /tokens/.bess-operator-token SIM_RATE: ${SIM_RATE:-50} SIM_CARDINALITY: ${SIM_CARDINALITY:-4} SIM_SEED: ${SIM_SEED:-} command: ["python", "-m", "simulator.main"] volumes: - influxdb-data:/tokens:ro ui: build: context: . dockerfile: ui/Dockerfile container_name: bess-ui depends_on: influxdb3: condition: service_healthy environment: INFLUX_URL: http://influxdb3:8181 INFLUX_DB: bess INFLUX_TOKEN_FILE: /tokens/.bess-operator-token UI_POLL_KPI_MS: ${UI_POLL_KPI_MS:-2000} UI_POLL_CHART_MS: ${UI_POLL_CHART_MS:-5000} command: ["uvicorn", "ui.app:app", "--host", "0.0.0.0", "--port", "8080"] ports: - "8080:8080" volumes: - influxdb-data:/tokens:ro scenarios: build: context: . dockerfile: simulator/Dockerfile container_name: bess-scenarios profiles: ["scenarios"] depends_on: influxdb3: condition: service_healthy environment: INFLUX_URL: http://influxdb3:8181 INFLUX_DB: bess INFLUX_TOKEN_FILE: /tokens/.bess-operator-token # SCENARIO is read at compose-parse time from the invoking shell # (e.g. `SCENARIO=foo make scenario`) AND can also be overridden at # runtime via `docker compose run -e SCENARIO=foo`. SCENARIO: ${SCENARIO:-} volumes: - influxdb-data:/tokens:ro # $$SCENARIO (double-dollar) escapes compose substitution so the shell # inside the container evaluates it against the runtime environment — # works whether SCENARIO arrived via the environment: section or -e. entrypoint: ["sh", "-c", "test -n \"$$SCENARIO\" || { echo 'SCENARIO env var not set' >&2; exit 2; }; exec python -m simulator.scenarios.$$SCENARIO"] restart: "no" volumes: influxdb-data: