gRPC and worker

This commit is contained in:
2026-02-03 13:40:28 -03:00
parent 67573713bd
commit a5057ba412
9 changed files with 782 additions and 34 deletions

View File

@@ -1,21 +1,28 @@
# MPR Control Environment
# Copy to .env and adjust values
# MPR Environment Configuration
# Copy to .env and adjust values as needed
# Database
POSTGRES_DB=mpr
POSTGRES_USER=mpr_user
POSTGRES_PASSWORD=mpr_pass
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
# Ports (less common to avoid conflicts)
POSTGRES_PORT=5433
REDIS_PORT=6380
DJANGO_PORT=8701
FASTAPI_PORT=8702
TIMELINE_PORT=5173
# Redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}/0
# Django
DEBUG=1
DJANGO_SETTINGS_MODULE=mpr.settings
SECRET_KEY=change-this-in-production
# Worker
MPR_EXECUTOR=local
# Remote deployment (optional)
# SERVER=user@host
# REMOTE_PATH=~/mpr
# gRPC
GRPC_HOST=grpc
GRPC_PORT=50051
GRPC_MAX_WORKERS=10

View File

@@ -3,6 +3,8 @@ x-common-env: &common-env
REDIS_URL: redis://redis:6379/0
DJANGO_SETTINGS_MODULE: mpr.settings
DEBUG: 1
GRPC_HOST: grpc
GRPC_PORT: 50051
x-healthcheck-defaults: &healthcheck-defaults
interval: 5s
@@ -93,6 +95,26 @@ services:
redis:
condition: service_healthy
grpc:
build:
context: ..
dockerfile: ctrl/Dockerfile
command: python -m grpc.server
ports:
- "50051:50051"
environment:
<<: *common-env
GRPC_PORT: 50051
GRPC_MAX_WORKERS: 10
volumes:
- ..:/app
- ../media:/app/media
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
celery:
build:
context: ..
@@ -109,6 +131,8 @@ services:
condition: service_healthy
redis:
condition: service_healthy
grpc:
condition: service_started
timeline:
build: