Files
GMW/infra/docker/docker-compose.yml
T
MythEclipse f04b0f0b42 refactor(voice): optimize recording pipeline and improve performance
Refactor the voice recording and playback systems to improve efficiency, reduce latency, and enhance Docker build performance.

- **Infrastructure**: Optimize Dockerfiles using build mounts for pnpm cache and reorder layers for better caching of dependencies and build tools.
- **Backend/Gateway**:
  - Refactor `broadcast` module to use a generic event-based system instead of hardcoded functions.
  - Simplify voice recording logic by merging metadata and segment management into a unified `segment.ts`.
  - Optimize audio downsampling in `streamSetup.ts` using `Int16Array` views for better performance.
  - Implement `withFallback` utility for more robust Redis/Database command execution.
- **Frontend**:
  - Optimize audio playback visualization using pre-computed level shapes and efficient RMS calculation.
  - Reduce latency in voice commands by prioritizing WebSocket communication over HTTP.
  - Improve base64 encoding efficiency in audio transmission.
- **General**:
  - Add default value for `ADMIN_PASSWORD` in shared config.
  - Fix Docker healthcheck to use `127.0.0.1` instead of `localhost`.
2026-06-09 22:04:05 +07:00

102 lines
2.7 KiB
YAML

version: '3.8'
services:
# Nginx Reverse Proxy — handles /api and /ws routing behind Traefik
proxy:
image: ghcr.io/${OWNER:-mytheclipse}/bete-proxy:latest
container_name: imphenbot-proxy
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.imphenbot.rule=Host(`imphnen.asepharyana.my.id`)"
- "traefik.http.routers.imphenbot.entrypoints=websecure"
- "traefik.http.routers.imphenbot.tls=true"
- "traefik.http.services.imphenbot.loadbalancer.server.port=80"
depends_on:
- backend
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 30s
timeout: 5s
retries: 3
deploy:
resources:
limits:
memory: 64M
networks:
- app-shared-net
# Backend Service (REST API + WebSocket)
backend:
image: ghcr.io/${OWNER:-mytheclipse}/bete-backend:latest
container_name: imphenbot-backend
restart: unless-stopped
env_file:
- .env
environment:
NODE_ENV: production
WEBSERVER_PORT: 3000
# Backend talks to gateway via Redis+Postgres, not directly — no depends_on needed
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
start_period: 15s
retries: 3
deploy:
resources:
limits:
memory: 256M
networks:
- app-shared-net
# Discord Gateway Service (Event capture and processing — no HTTP)
discord-gateway:
image: ghcr.io/${OWNER:-mytheclipse}/bete-discord-gateway:latest
container_name: imphenbot-discord-gateway
restart: unless-stopped
env_file:
- .env
environment:
NODE_ENV: production
volumes:
- ./recordings:/app/recordings
# Gateway has no HTTP server — check if PID 1 (node) is alive
healthcheck:
test: ["CMD-SHELL", "kill -0 1 || exit 1"]
interval: 30s
timeout: 5s
start_period: 30s
retries: 3
deploy:
resources:
limits:
memory: 512M
networks:
- app-shared-net
# Frontend Service (React Dashboard) — Nginx serving static files
frontend:
image: ghcr.io/${OWNER:-mytheclipse}/bete-frontend:latest
container_name: imphenbot-frontend
restart: unless-stopped
# Use 127.0.0.1 instead of localhost — Alpine's BusyBox wget tries IPv6 first
# for 'localhost' which fails since nginx only listens on IPv4
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:3000/"]
interval: 30s
timeout: 5s
start_period: 5s
retries: 3
deploy:
resources:
limits:
memory: 32M
networks:
- app-shared-net
networks:
app-shared-net:
name: app-shared-net
external: true