171 lines
5.2 KiB
YAML
171 lines
5.2 KiB
YAML
name: ndc-mission-core-telemetry
|
|
|
|
x-ndc-labels: &ndc-labels
|
|
com.nodedc.product: mission-core
|
|
com.nodedc.stack: ndc-mission-core-telemetry
|
|
com.nodedc.managed-by: docker-compose
|
|
|
|
services:
|
|
broker:
|
|
image: eclipse-mosquitto:2.1.2-alpine
|
|
container_name: ndc-mission-core-mqtt-broker
|
|
restart: unless-stopped
|
|
read_only: true
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
cap_add:
|
|
- CHOWN
|
|
- SETGID
|
|
- SETUID
|
|
mem_limit: 128m
|
|
pids_limit: 128
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: mqtt-broker
|
|
ports:
|
|
- "${MISSIONCORE_MQTT_BIND_ADDRESS:-127.0.0.1}:${MISSIONCORE_MQTT_PORT:-1883}:1883"
|
|
environment:
|
|
MISSIONCORE_MQTT_HEALTH_USER: "${MISSIONCORE_MQTT_INGEST_USER}"
|
|
MISSIONCORE_MQTT_HEALTH_PASSWORD: "${MISSIONCORE_MQTT_INGEST_PASSWORD}"
|
|
volumes:
|
|
- ./mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
|
|
- ./runtime/mosquitto/passwords:/mosquitto/config/passwords:ro
|
|
- ./runtime/mosquitto/acl:/mosquitto/config/acl:ro
|
|
- broker-data:/mosquitto/data
|
|
tmpfs:
|
|
- /tmp:size=16m,noexec,nosuid
|
|
healthcheck:
|
|
test:
|
|
- CMD-SHELL
|
|
- >-
|
|
mosquitto_sub -h 127.0.0.1 -t '$$SYS/broker/uptime' -C 1 -W 3
|
|
-u "$$MISSIONCORE_MQTT_HEALTH_USER"
|
|
-P "$$MISSIONCORE_MQTT_HEALTH_PASSWORD"
|
|
interval: 10s
|
|
timeout: 4s
|
|
retries: 6
|
|
|
|
timescale:
|
|
image: timescale/timescaledb-ha:pg16.14-ts2.28.2-all-oss
|
|
# The HA image auto-tunes for the Docker VM, not this 1 GiB container.
|
|
command: ["postgres", "-c", "shared_buffers=128MB", "-c", "work_mem=4MB", "-c", "maintenance_work_mem=64MB", "-c", "effective_cache_size=512MB", "-c", "max_parallel_workers_per_gather=0", "-c", "max_connections=32"]
|
|
container_name: ndc-mission-core-telemetry-timescaledb
|
|
restart: unless-stopped
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
mem_limit: 1024m
|
|
pids_limit: 256
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: telemetry-database
|
|
environment:
|
|
POSTGRES_DB: "${MISSIONCORE_DB_NAME}"
|
|
POSTGRES_USER: "${MISSIONCORE_DB_USER}"
|
|
POSTGRES_PASSWORD: "${MISSIONCORE_DB_PASSWORD}"
|
|
volumes:
|
|
- timescale-data:/home/postgres/pgdata/data
|
|
- ./timescale/001_telemetry.sql:/docker-entrypoint-initdb.d/001_telemetry.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${MISSIONCORE_DB_USER} -d ${MISSIONCORE_DB_NAME}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
database-bootstrap:
|
|
image: timescale/timescaledb-ha:pg16.14-ts2.28.2-all-oss
|
|
container_name: ndc-mission-core-telemetry-bootstrap
|
|
restart: "no"
|
|
read_only: true
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
mem_limit: 128m
|
|
pids_limit: 64
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: telemetry-database-bootstrap
|
|
depends_on:
|
|
timescale:
|
|
condition: service_healthy
|
|
environment:
|
|
MISSIONCORE_DB_NAME: "${MISSIONCORE_DB_NAME}"
|
|
MISSIONCORE_DB_ADMIN_USER: "${MISSIONCORE_DB_USER}"
|
|
MISSIONCORE_DB_ADMIN_PASSWORD: "${MISSIONCORE_DB_PASSWORD}"
|
|
MISSIONCORE_DB_INGEST_PASSWORD: "${MISSIONCORE_DB_INGEST_PASSWORD}"
|
|
volumes:
|
|
- ./timescale/002_roles_and_retention.sh:/bootstrap.sh:ro
|
|
tmpfs:
|
|
- /tmp:size=16m,noexec,nosuid
|
|
entrypoint: ["/bin/sh", "/bootstrap.sh"]
|
|
|
|
normalizer:
|
|
image: nodedc/mission-core-telemetry-normalizer:local
|
|
container_name: ndc-mission-core-telemetry-normalizer
|
|
build:
|
|
context: ../..
|
|
dockerfile: deploy/telemetry-plane/normalizer/Dockerfile
|
|
restart: unless-stopped
|
|
read_only: true
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
cap_drop:
|
|
- ALL
|
|
mem_limit: 256m
|
|
pids_limit: 128
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: telemetry-normalizer
|
|
depends_on:
|
|
broker:
|
|
condition: service_healthy
|
|
timescale:
|
|
condition: service_healthy
|
|
database-bootstrap:
|
|
condition: service_completed_successfully
|
|
ports:
|
|
- "127.0.0.1:${MISSIONCORE_TELEMETRY_QUERY_PORT:-18030}:18030"
|
|
environment:
|
|
MISSIONCORE_MQTT_HOST: broker
|
|
MISSIONCORE_MQTT_PORT: "1883"
|
|
MISSIONCORE_MQTT_USERNAME: "${MISSIONCORE_MQTT_INGEST_USER}"
|
|
MISSIONCORE_MQTT_PASSWORD: "${MISSIONCORE_MQTT_INGEST_PASSWORD}"
|
|
MISSIONCORE_DATABASE_DSN: >-
|
|
postgresql://missioncore_normalizer:${MISSIONCORE_DB_INGEST_PASSWORD}@timescale:5432/${MISSIONCORE_DB_NAME}
|
|
MISSIONCORE_QUERY_HOST: "0.0.0.0"
|
|
MISSIONCORE_QUERY_PORT: "18030"
|
|
tmpfs:
|
|
- /tmp:size=32m,noexec,nosuid
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- python
|
|
- -c
|
|
- >-
|
|
import urllib.request;
|
|
urllib.request.urlopen('http://127.0.0.1:18030/health', timeout=3).read()
|
|
interval: 10s
|
|
timeout: 4s
|
|
retries: 6
|
|
|
|
volumes:
|
|
broker-data:
|
|
name: ndc-mission-core-mqtt-data
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: mqtt-storage
|
|
timescale-data:
|
|
name: ndc-mission-core-telemetry-timescale-data
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: telemetry-storage
|
|
|
|
networks:
|
|
default:
|
|
name: ndc-mission-core-telemetry
|
|
labels:
|
|
<<: *ndc-labels
|
|
com.nodedc.role: telemetry-network
|