mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-05-18 15:26:00 +02:00
b5fc4c06a0
- Rename compose profile 'receiver' -> 'observer' across all docs - Rename docker-compose service 'packet-capture' -> 'observer' and volume 'packetcapture_data' -> 'observer_data' - Change COMPOSE_PROJECT_NAME fallback from 'hub-dev' to 'hub' across all compose files, Makefile, .env, docs - Remove legacy interface-mock service from test compose file
146 lines
4.0 KiB
YAML
146 lines
4.0 KiB
YAML
# MeshCore Hub - End-to-End Test Docker Compose
|
|
#
|
|
# This configuration runs all services for integration testing.
|
|
#
|
|
# Usage:
|
|
# docker compose -f tests/e2e/docker-compose.test.yml up -d
|
|
# pytest tests/e2e/
|
|
# docker compose -f tests/e2e/docker-compose.test.yml down -v
|
|
|
|
services:
|
|
# MQTT Broker
|
|
mqtt:
|
|
image: ghcr.io/ipnet-mesh/meshcore-mqtt-broker:latest
|
|
container_name: meshcore-test-mqtt
|
|
ports:
|
|
- "11883:1883"
|
|
volumes:
|
|
- test_mqtt_data:/data
|
|
environment:
|
|
- MQTT_WS_PORT=1883
|
|
- MQTT_HOST=0.0.0.0
|
|
- AUTH_EXPECTED_AUDIENCE=mqtt.localhost
|
|
- SUBSCRIBER_MAX_CONNECTIONS_DEFAULT=5
|
|
- SUBSCRIBER_1=test-admin:test-password:1
|
|
- ABUSE_ENFORCEMENT_ENABLED=false
|
|
- ABUSE_DUPLICATE_WINDOW_SIZE=100
|
|
- ABUSE_DUPLICATE_WINDOW_MS=300000
|
|
- ABUSE_DUPLICATE_THRESHOLD=10
|
|
- ABUSE_MAX_DUPLICATES_PER_PACKET=5
|
|
- ABUSE_DUPLICATE_RATE_THRESHOLD=0.3
|
|
- ABUSE_DUPLICATE_RATE_WINDOW_MS=300000
|
|
- ABUSE_BUCKET_CAPACITY=20
|
|
- ABUSE_BUCKET_REFILL_RATE=3
|
|
- ABUSE_MAX_PACKET_SIZE=255
|
|
- ABUSE_MAX_TOPICS_PER_DAY=3
|
|
- ABUSE_ANOMALY_THRESHOLD=10
|
|
- ABUSE_MAX_IATA_CHANGES_24H=3
|
|
- ABUSE_TOPIC_HISTORY_SIZE=50
|
|
- ABUSE_TOPIC_HISTORY_WINDOW_MS=86400000
|
|
- ABUSE_PERSISTENCE_PATH=/data/abuse-detection.db
|
|
- ABUSE_PERSISTENCE_INTERVAL_MS=300000
|
|
healthcheck:
|
|
test: ["CMD", "node", "-e", "const net=require('net');const s=net.createConnection(1883,'127.0.0.1',()=>{s.end();process.exit(0)});s.on('error',()=>process.exit(1));setTimeout(()=>process.exit(1),3000)"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 5s
|
|
|
|
# Collector
|
|
collector:
|
|
build:
|
|
context: ../..
|
|
dockerfile: Dockerfile
|
|
container_name: meshcore-test-collector
|
|
depends_on:
|
|
mqtt:
|
|
condition: service_healthy
|
|
volumes:
|
|
- test_data:/data
|
|
environment:
|
|
- LOG_LEVEL=DEBUG
|
|
- MQTT_HOST=mqtt
|
|
- MQTT_PORT=1883
|
|
- MQTT_PREFIX=test
|
|
- MQTT_TRANSPORT=websockets
|
|
- MQTT_WS_PATH=/
|
|
- MQTT_USERNAME=test-admin
|
|
- MQTT_PASSWORD=test-password
|
|
- DATABASE_URL=sqlite:////data/test.db
|
|
command: ["collector"]
|
|
healthcheck:
|
|
test: ["CMD", "pgrep", "-f", "meshcore-hub"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# API Server
|
|
api:
|
|
build:
|
|
context: ../..
|
|
dockerfile: Dockerfile
|
|
container_name: meshcore-test-api
|
|
depends_on:
|
|
mqtt:
|
|
condition: service_healthy
|
|
collector:
|
|
condition: service_started
|
|
ports:
|
|
- "18000:8000"
|
|
volumes:
|
|
- test_data:/data
|
|
environment:
|
|
- LOG_LEVEL=DEBUG
|
|
- MQTT_HOST=mqtt
|
|
- MQTT_PORT=1883
|
|
- MQTT_PREFIX=test
|
|
- MQTT_TRANSPORT=websockets
|
|
- MQTT_WS_PATH=/
|
|
- MQTT_USERNAME=test-admin
|
|
- MQTT_PASSWORD=test-password
|
|
- DATABASE_URL=sqlite:////data/test.db
|
|
- API_HOST=0.0.0.0
|
|
- API_PORT=8000
|
|
- API_READ_KEY=test-read-key
|
|
- API_ADMIN_KEY=test-admin-key
|
|
command: ["api"]
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Web Dashboard
|
|
web:
|
|
build:
|
|
context: ../..
|
|
dockerfile: Dockerfile
|
|
container_name: meshcore-test-web
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
ports:
|
|
- "18080:8080"
|
|
environment:
|
|
- LOG_LEVEL=DEBUG
|
|
- API_BASE_URL=http://api:8000
|
|
- API_KEY=test-read-key
|
|
- WEB_HOST=0.0.0.0
|
|
- WEB_PORT=8080
|
|
- NETWORK_NAME=Test Network
|
|
command: ["web"]
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
volumes:
|
|
test_data:
|
|
name: meshcore_test_data
|
|
test_mqtt_data:
|
|
name: meshcore_test_mqtt_data
|