Files
deploy/compose.yaml
T
julian 1c14974d55 Add multi-service deployment stack for TRM platform
Initial pilot stack: redis + tcp-ingestion. Designed to grow as the
platform's other services land (processor, postgres+timescale, directus,
react-spa).

- compose.yaml: services as image: references with env-var-driven tags
  and ports. Redis is internal-only (no host port). TCP port 5027
  exposed for GPS device traffic. Persisted Redis volume.
- .env.example: documents TCP_INGESTION_TAG, INSTANCE_ID, PORT, LOG_LEVEL.
  Compose has defaults so the stack starts with no env config.
- README: Portainer Repository Stack instructions, manual deploy fallback,
  network model, planned-services list, why-separate-repo rationale.
- .gitignore: ignore .env
2026-04-30 17:30:45 +02:00

70 lines
2.6 KiB
YAML

# TRM platform — deployment stack
#
# Deployed via Portainer Repository Stack:
# Repository: git.dev.microservices.al/trm/deploy
# Compose path: compose.yaml
# Branch: main
#
# Images are built and pushed by each service's own Gitea workflow.
# This file references them by tag and runs them as a coordinated stack.
#
# Before first deploy on the host: `docker login git.dev.microservices.al`
# (Portainer can store registry credentials in its UI; configure once.)
#
# Environment variables are populated from Portainer's stack environment
# config (or a `.env` file alongside this compose for non-Portainer hosts).
# Defaults are provided via `${VAR:-default}` so the stack starts with no
# explicit configuration on a fresh deploy.
name: trm
services:
# -------------------------------------------------------------------
# Redis — telemetry queue + (future) connection registry for Phase 2.
# Internal-only; no host port mapping.
# -------------------------------------------------------------------
redis:
image: redis:7-alpine
expose:
- '6379'
volumes:
- redis-data:/data
restart: unless-stopped
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 3s
retries: 5
# -------------------------------------------------------------------
# tcp-ingestion — Teltonika telemetry TCP server.
# Built by git.dev.microservices.al/trm/tcp-ingestion's Gitea workflow.
# -------------------------------------------------------------------
tcp-ingestion:
image: git.dev.microservices.al/trm/tcp-ingestion:${TCP_INGESTION_TAG:-main}
depends_on:
redis:
condition: service_healthy
ports:
# Devices connect to this port. Use `${HOST_BIND_IP:-0.0.0.0}:5027:5027`
# if you want to restrict which host interface accepts connections.
- '${TCP_INGESTION_PORT:-5027}:5027'
environment:
NODE_ENV: production
INSTANCE_ID: ${TCP_INGESTION_INSTANCE_ID:-stage-1}
REDIS_URL: redis://redis:6379
LOG_LEVEL: ${LOG_LEVEL:-info}
restart: unless-stopped
# -------------------------------------------------------------------
# Future services land here:
# - processor: consumes telemetry from Redis, writes to DB
# - postgres: PostgreSQL with TimescaleDB extension
# - directus: business-plane API + admin UI
# - react-spa: front-end (static, served via nginx or Caddy)
# See ../docs/wiki/ for the platform architecture.
# -------------------------------------------------------------------
volumes:
redis-data: