Files
ukmesh/docker-compose.companions.yml

110 lines
4.3 KiB
YAML

# Add explicitly to the existing live project for the companion origins.
x-projection: &projection
restart: unless-stopped
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
logging:
driver: local
options: {max-size: 5m, max-file: '2'}
x-core: &core
<<: *projection
image: ${CORESCOPE_RELEASE_IMAGE:?Verified CoreScope release digest required}
stop_grace_period: 30s
services:
backend:
networks: [default, companion_origin]
environment:
BEACON_PUBLIC_READ_TOKEN: ${BEACON_PUBLIC_READ_TOKEN:?Distinct authority credential required}
companion-preflight:
image: ${BACKEND_IMAGE:-meshcore-analytics-backend:local}
environment:
MQTT_RAM_PUBLIC_READ_TOKEN: ${MQTT_RAM_PUBLIC_READ_TOKEN:?Public projection authority token required}
BEACON_PUBLIC_READ_TOKEN: ${BEACON_PUBLIC_READ_TOKEN}
entrypoint: [node, /verify.cjs]
command: []
network_mode: none
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
volumes:
- ./deploy/companions/verify-core.cjs:/verify.cjs:ro
- type: bind
source: ${CORESCOPE_PUBLIC_CONFIG}
target: /config/config.json
read_only: true
bind: {create_host_path: false}
corescope-public-ingestor:
<<: *core
depends_on:
companion-preflight: {condition: service_completed_successfully}
entrypoint: [/bin/corescope-ingestor]
command: [-config, /config/config.json]
networks: [default, companion_origin]
mem_limit: 256m
memswap_limit: 256m
environment: {GOMEMLIMIT: 192MiB}
volumes:
- type: bind
source: ${CORESCOPE_PUBLIC_CONFIG:?Public projection configuration required}
target: /config/config.json
read_only: true
bind: {create_host_path: false}
- type: bind
source: ${CORESCOPE_PUBLIC_DATA:?Dedicated projection directory required}
target: /data
bind: {create_host_path: false}
corescope-public:
<<: *core
command: [-config-dir, /config, -db, /data/analyzer.db, -public, /public, -port, '3000', -packet-store-max-mib, '64']
networks: [companion_origin]
mem_limit: 512m
memswap_limit: 512m
environment: {GOMEMLIMIT: 256MiB}
volumes_from: [corescope-public-ingestor]
volumes:
- corescope_assets:/public:ro
companion-origins:
<<: *projection
image: ${BEACON_WEB_RELEASE_IMAGE:?Verified Beacon web release digest required}
depends_on: [corescope-public]
networks: [default, companion_origin]
ports:
- '127.0.0.1:${CORESCOPE_ORIGIN_PORT:-3191}:8081'
- '127.0.0.1:${BEACON_FEED_ORIGIN_PORT:-3192}:8082'
mem_limit: 48m
memswap_limit: 48m
tmpfs: ['/var/cache/nginx:uid=101,gid=101', '/run:uid=101,gid=101']
volumes:
- ./deploy/companions/origins.conf:/etc/nginx/conf.d/default.conf:ro
- ./scripts/full-dev/corescope-app:/etc/nginx/corescope-app:ro
- ./scripts/full-dev/ingress:/etc/nginx/ukmesh-ingress:ro
- type: volume
source: corescope_assets
target: /srv/corescope/public
read_only: true
volume: {nocopy: true}
beacon-public:
<<: *projection
image: ${BEACON_SERVER_RELEASE_IMAGE:?Verified Beacon server release digest required}
# Only Nginx can reach this loopback listener. There is no raw Beacon upstream.
network_mode: service:companion-origins
entrypoint: [/bin/beacon-public]
mem_limit: 192m
memswap_limit: 192m
environment:
BEACON_PUBLIC_LISTEN_ADDR: '127.0.0.1:8088'
BEACON_PUBLIC_PROJECTION_DSN: ${BEACON_PUBLIC_PROJECTION_DSN:?Projection runtime credential required}
BEACON_PUBLIC_PROJECTION_DATABASE: ${BEACON_PUBLIC_PROJECTION_DATABASE:?Separate projection database required}
BEACON_PUBLIC_SOURCE_DSN: ${BEACON_PUBLIC_SOURCE_DSN:?Restricted source reader required}
BEACON_PUBLIC_AUTHORITY_URL: http://backend:3000/internal/beacon/authority
BEACON_PUBLIC_READ_TOKEN: ${BEACON_PUBLIC_READ_TOKEN}
BEACON_PUBLIC_RETENTION_DAYS: ${BEACON_PUBLIC_RETENTION_DAYS:?Match source retention}
BEACON_PUBLIC_LIVE_URL: ${BEACON_PUBLIC_LIVE_URL:-}
BEACON_PUBLIC_LIVE_TOKEN: ${BEACON_PUBLIC_LIVE_TOKEN:-}
networks:
companion_origin: {internal: true}
volumes:
corescope_assets:
name: ${COMPOSE_PROJECT_NAME:-meshcore-analytics}_corescope_assets_${CORESCOPE_ASSET_REVISION:?Use the released CoreScope commit}