cd819002b4
High-impact reliability: - SQLite job persistence (rv50x.db) — job history and AT sessions survive restarts - Extract _login_and_open_modal() — eliminates ~40 lines of duplicated Playwright login logic - Separate NocoDB view IDs per group via NOCODB_VIEW_ID_ELECTRIC / NOCODB_VIEW_ID_GW env vars - Excel cache TTL (1h) + size cap (20 files) with eviction helpers - In-memory job store pruning (MAX_JOBS_MEMORY, default 200) Functionality: - TCP reachability pre-check before launching Playwright — fails fast on unreachable devices - AT command presets — save/load/delete named command sequences, stored in at_presets.json Ops: - Bind-mount rv50x.db and at_presets.json in docker-compose so data survives rebuilds - Add NOCODB_VIEW_ID_ELECTRIC, NOCODB_VIEW_ID_GW, REACH_TIMEOUT env vars to compose - Ignore runtime files (rv50x.db, at_presets.json, template dirs) in .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
126 lines
5.5 KiB
YAML
126 lines
5.5 KiB
YAML
# ── RV50x Template Manager — Full Stack ────────────────────────────────────
|
|
#
|
|
# Services:
|
|
# rv50x-manager FastAPI web app + Playwright
|
|
# nocodb NocoDB UI and API
|
|
# postgres PostgreSQL database for NocoDB
|
|
#
|
|
# Usage:
|
|
# Start: docker-compose up -d
|
|
# Stop: docker-compose stop
|
|
# Destroy: docker-compose down (data volumes preserved)
|
|
# Logs: docker-compose logs -f rv50x-manager
|
|
#
|
|
# Port mapping — change the LEFT number to use a different host port:
|
|
# rv50x-manager: http://host-ip:YOUR_PORT
|
|
# nocodb: http://host-ip:8090
|
|
# postgres: not exposed (internal only)
|
|
# ───────────────────────────────────────────────────────────────────────────
|
|
|
|
services:
|
|
|
|
# ── RV50x Template Manager ────────────────────────────────────────────────
|
|
rv50x-manager:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: rv50x-manager
|
|
restart: "no" # manual start only
|
|
ports:
|
|
- "8002:8000" # ← change YOUR_PORT to your chosen port
|
|
volumes:
|
|
# Bind mounts — files are directly accessible on the host at these paths.
|
|
# No sudo needed, no docker volume commands needed.
|
|
- /opt/rv50x-manager/template_downloads:/data/template_downloads
|
|
- /opt/rv50x-manager/template_uploads:/data/template_uploads
|
|
- /opt/rv50x-manager/xml_templates:/data/xml_templates
|
|
- /opt/rv50x-manager/certs:/certs:ro # SSL certificates (read-only)
|
|
- /opt/rv50x-manager/rv50x.db:/app/rv50x.db # job history (SQLite)
|
|
- /opt/rv50x-manager/at_presets.json:/app/at_presets.json # AT presets
|
|
environment:
|
|
# ── NocoDB connection ──────────────────────────────────────────────
|
|
# To use the built-in NocoDB from this stack, set NOCODB_URL to:
|
|
# http://nocodb:8080
|
|
# To use an external NocoDB instance, set it to that URL instead.
|
|
NOCODB_URL: ${NOCODB_URL}
|
|
NOCODB_TOKEN: ${NOCODB_TOKEN}
|
|
NOCODB_BASE_ID: ${NOCODB_BASE_ID}
|
|
NOCODB_TABLE_ID: ${NOCODB_TABLE_ID}
|
|
NOCODB_VIEW_ID: ${NOCODB_VIEW_ID}
|
|
NOCODB_VIEW_ID_ELECTRIC: ${NOCODB_VIEW_ID_ELECTRIC:-}
|
|
NOCODB_VIEW_ID_GW: ${NOCODB_VIEW_ID_GW:-}
|
|
# ── SSL certificate paths (inside the container) ───────────────────
|
|
SSL_CERT: /certs/cert.pem
|
|
SSL_KEY: /certs/key.pem
|
|
# ── Tunable timeouts (optional) ────────────────────────────────────
|
|
PAGE_TIMEOUT: ${PAGE_TIMEOUT:-90000}
|
|
DOWNLOAD_TIMEOUT: ${DOWNLOAD_TIMEOUT:-120000}
|
|
UPLOAD_TIMEOUT: ${UPLOAD_TIMEOUT:-120000}
|
|
MAX_RETRIES: ${MAX_RETRIES:-3}
|
|
APP_USERNAME: ${APP_USERNAME}
|
|
APP_PASSWORD: ${APP_PASSWORD}
|
|
SESSION_SECRET: ${SESSION_SECRET}
|
|
SESSION_HOURS: ${SESSION_HOURS:-8}
|
|
depends_on:
|
|
nocodb:
|
|
condition: service_healthy
|
|
networks:
|
|
- rv50x-net
|
|
|
|
# ── NocoDB ───────────────────────────────────────────────────────────────
|
|
nocodb:
|
|
image: nocodb/nocodb:latest
|
|
container_name: rv50x-nocodb
|
|
restart: "no" # manual start only
|
|
ports:
|
|
- "8090:8080" # NocoDB UI on host port 8090
|
|
environment:
|
|
NC_DB: "pg://postgres:5432?u=nocodb&p=${POSTGRES_PASSWORD}&d=nocodb"
|
|
NC_AUTH_JWT_SECRET: ${NC_JWT_SECRET}
|
|
volumes:
|
|
- nocodb_data:/usr/app/data
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
networks:
|
|
- rv50x-net
|
|
|
|
# ── PostgreSQL ───────────────────────────────────────────────────────────
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: rv50x-postgres
|
|
restart: "no" # manual start only
|
|
environment:
|
|
POSTGRES_USER: nocodb
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: nocodb
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U nocodb"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
networks:
|
|
- rv50x-net
|
|
# Postgres is intentionally NOT exposed on a host port.
|
|
# Only NocoDB can reach it via the internal network.
|
|
|
|
# ── Named volumes — only postgres and nocodb use named volumes ───────────────
|
|
# template_downloads, template_uploads, and xml_templates use bind mounts
|
|
# above so files are directly accessible in /opt/rv50x-manager/ on the host.
|
|
volumes:
|
|
postgres_data:
|
|
nocodb_data:
|
|
|
|
# ── Internal network ────────────────────────────────────────────────────────
|
|
networks:
|
|
rv50x-net:
|
|
driver: bridge
|