# Compose stack for the scientific-infrastructure reference architecture. # # Four "network nodes" on one compose network: # sink influxdb3 (single node) + grafana, plus three one-shots: # token-bootstrap, plugin-installer, influxdb3-init # daq telegraf-daq + collectd (collectd -> UDP 25826 -> telegraf-daq) # compute telegraf-compute (inputs.mock) # storage telegraf-storage (inputs.mock) # # Services are added step by step (see the implementation plan); this file # grows with each step. name: influxdb3-ref-scientific-infrastructure 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. Also writes the # plain-text token (mode 644) that the healthcheck, the Telegraf agents # and Grafana read as non-root users, and creates the plugin directory # the server requires to exist at startup (plugins are uploaded into it # later by the plugin-installer service). token-bootstrap: image: influxdb:3-enterprise container_name: sci-token-bootstrap environment: INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info volumes: - influxdb-data:/var/lib/influxdb3 entrypoint: ["sh", "-c"] command: - | mkdir -p /var/lib/influxdb3/plugins if [ -s /var/lib/influxdb3/.sci-operator-token ]; then echo "[bootstrap] admin token already exists, skipping create" else echo "[bootstrap] generating offline admin token" influxdb3 create token --admin --offline \ --name sci-admin \ --output-file /var/lib/influxdb3/.sci-operator-token chmod 600 /var/lib/influxdb3/.sci-operator-token echo "[bootstrap] admin token written" fi if [ -s /var/lib/influxdb3/.sci-token-plain ]; then echo "[bootstrap] plain-text token already exists, skipping" else sed -n 's/.*"token"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \ /var/lib/influxdb3/.sci-operator-token | head -n1 | tr -d '\n' \ > /var/lib/influxdb3/.sci-token-plain chmod 644 /var/lib/influxdb3/.sci-token-plain echo "[bootstrap] plain-text token written" fi restart: "no" influxdb3: image: influxdb:3-enterprise container_name: sci-influxdb3 depends_on: token-bootstrap: condition: service_completed_successfully environment: INFLUXDB3_LICENSE_EMAIL: ${INFLUXDB3_ENTERPRISE_EMAIL:?set INFLUXDB3_ENTERPRISE_EMAIL in .env} INFLUXDB3_LICENSE_TYPE: ${INFLUXDB3_ENTERPRISE_LICENSE_TYPE:-trial} INFLUXDB3_OBJECT_STORE: file INFLUXDB3_DATA_DIR: /var/lib/influxdb3 INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info command: > serve --node-id sci-node0 --cluster-id sci --mode all --object-store file --data-dir /var/lib/influxdb3 --plugin-dir /var/lib/influxdb3/plugins --virtual-env-location /var/lib/influxdb3/plugin-venv --admin-token-file /var/lib/influxdb3/.sci-operator-token --admin-token-recovery-http-bind 0.0.0.0:8182 volumes: - influxdb-data:/var/lib/influxdb3 ports: - "8181:8181" healthcheck: test: ["CMD-SHELL", "test -s /var/lib/influxdb3/.sci-token-plain && curl -sf --max-time 2 -H \"Authorization: Bearer $$(cat /var/lib/influxdb3/.sci-token-plain)\" http://127.0.0.1:8181/health -o /dev/null"] interval: 5s timeout: 3s retries: 120 start_period: 5s # One-shot: install Processing Engine plugins from the public plugin # registry through the files API (see installer/). Pinned + sha256-verified; # the server needs no plugin bind mount. plugin-installer: build: context: . dockerfile: installer/Dockerfile container_name: sci-plugin-installer depends_on: influxdb3: condition: service_healthy environment: INFLUX_URL: http://influxdb3:8181 TOKEN_FILE: /tokens/.sci-operator-token LOCK_FILE: /installer/plugins.lock REGISTRY_INDEX_URL: ${REGISTRY_INDEX_URL:-https://github.com/influxdata/influxdb3_plugins/releases/download/registry/index.json} INSTALLER_OFFLINE_DIR: ${INSTALLER_OFFLINE_DIR:-} volumes: - influxdb-data:/tokens - ./installer:/installer:ro restart: "no" # One-shot: database, retention, tables, downsampling triggers (influxdb/init.sh) influxdb3-init: image: influxdb:3-enterprise container_name: sci-influxdb3-init depends_on: influxdb3: condition: service_healthy plugin-installer: condition: service_completed_successfully environment: INFLUXDB3_UNSET_VARS: LOG_FILTER INFLUXDB3_LOG_FILTER: info volumes: - influxdb-data:/var/lib/influxdb3 - ./influxdb/init.sh:/usr/local/bin/sci-init.sh:ro - ./installer/plugins.lock:/installer/plugins.lock:ro entrypoint: ["/usr/local/bin/sci-init.sh"] restart: "no" # ── compute node ── Telegraf with inputs.mock; see telegraf/compute.conf telegraf-compute: image: telegraf:1.40 container_name: sci-telegraf-compute depends_on: influxdb3-init: condition: service_completed_successfully volumes: - ./telegraf/compute.conf:/etc/telegraf/telegraf.conf:ro # Demo shortcut: the agent reads the admin token from the shared # volume. A real remote node would get a scoped write token through # its config management (see ARCHITECTURE.md). - influxdb-data:/tokens:ro command: ["sh", "-c", "export INFLUX_TOKEN=$$(cat /tokens/.sci-token-plain) && exec telegraf --config /etc/telegraf/telegraf.conf"] restart: unless-stopped # ── storage node ── same agent shape as compute (telegraf/storage.conf), plus # a simulated outage cycle (telegraf/flap.sh): up STORAGE_UP_S, silent # STORAGE_DOWN_S, forever, so the "Node down" alert fires periodically. telegraf-storage: image: telegraf:1.40 container_name: sci-telegraf-storage depends_on: influxdb3-init: condition: service_completed_successfully environment: STORAGE_FLAP: ${STORAGE_FLAP:-true} STORAGE_UP_S: ${STORAGE_UP_S:-180} STORAGE_DOWN_S: ${STORAGE_DOWN_S:-120} volumes: - ./telegraf/storage.conf:/etc/telegraf/telegraf.conf:ro - ./telegraf/flap.sh:/usr/local/bin/flap.sh:ro - influxdb-data:/tokens:ro command: ["sh", "/usr/local/bin/flap.sh"] restart: unless-stopped # ── daq node ── Telegraf receiving collectd over UDP; see telegraf/daq.conf telegraf-daq: image: telegraf:1.40 container_name: sci-telegraf-daq depends_on: influxdb3-init: condition: service_completed_successfully volumes: - ./telegraf/daq.conf:/etc/telegraf/telegraf.conf:ro - ./telegraf/types.db:/etc/telegraf/types.db:ro - influxdb-data:/tokens:ro command: ["sh", "-c", "export INFLUX_TOKEN=$$(cat /tokens/.sci-token-plain) && exec telegraf --config /etc/telegraf/telegraf.conf"] restart: unless-stopped # collectd on the daq node: cpu/load/memory (+ uptime/interface/df that # Telegraf drops) -> network plugin -> telegraf-daq:25826 collectd: build: context: ./collectd container_name: sci-collectd depends_on: telegraf-daq: condition: service_started restart: unless-stopped # ── sink node UI ── Grafana provisioned from grafana/ (datasource, dashboards, alerts) grafana: image: grafana/grafana:13.2.1 container_name: sci-grafana depends_on: influxdb3-init: condition: service_completed_successfully environment: GF_SECURITY_ADMIN_USER: admin GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin} GF_AUTH_ANONYMOUS_ENABLED: "true" # dashboards open without a login GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer GF_USERS_ALLOW_SIGN_UP: "false" GF_ANALYTICS_REPORTING_ENABLED: "false" GF_NEWS_NEWS_FEED_ENABLED: "false" volumes: - ./grafana/provisioning:/etc/grafana/provisioning:ro - ./grafana/dashboards:/var/lib/grafana/dashboards:ro - influxdb-data:/tokens:ro # datasource token via $__file{} ports: - "${GRAFANA_PORT:-3000}:3000" restart: unless-stopped volumes: influxdb-data: