feat: Update .env.example and Docker Compose configurations to enhance service performance and health checks. Adjust OCR settings for improved document processing efficiency, and refine API Gateway health checks for better service monitoring. Revise desktop application documentation to reflect new API Gateway URL and installation instructions.

This commit is contained in:
erik
2026-07-06 04:30:27 -05:00
parent 081da999d4
commit c37c40663d
39 changed files with 4815 additions and 1232 deletions
+33 -17
View File
@@ -6,22 +6,19 @@ services:
POSTGRES_DB: ipsextractor
POSTGRES_USER: ipsextractor
POSTGRES_PASSWORD: ipsextractor
ports:
- "5432:5432"
volumes:
- ipsextractor_db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ipsextractor -d ipsextractor"]
interval: 5s
timeout: 5s
retries: 10
retries: 15
start_period: 90s
redis:
image: redis:7-alpine
container_name: ipsextractor-redis
command: redis-server --maxmemory 512mb --maxmemory-policy allkeys-lru --save ""
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
@@ -66,11 +63,15 @@ services:
PDF_THREAD_COUNT: ${PDF_THREAD_COUNT:-4}
CONCURRENCY_LIMIT: ${CONCURRENCY_LIMIT:-50}
ALLOWED_DOCUMENT_TYPES: ${ALLOWED_DOCUMENT_TYPES:-CC,TI,CE,RC,PA,PPT,PEP,EPT,NUIP}
ports:
- "8001:8001"
volumes:
- ${IPS_DOCUMENT_ROOT:-./data}:/data
- ips_queue:/tmp/ips_queue
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8001/health', timeout=5)"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# Escala horizontalmente: docker compose up --scale worker=4
worker:
@@ -116,34 +117,39 @@ services:
condition: service_completed_successfully
environment:
DATABASE_URL: postgresql+psycopg://ipsextractor:ipsextractor@database:5432/ipsextractor
ports:
- "8002:8002"
count-api:
build:
context: ./services/services-count-facturas-medicas-serving
dockerfile: Dockerfile
container_name: ipsextractor-count-api
restart: unless-stopped
depends_on:
db-migrations:
condition: service_completed_successfully
environment:
PORT: "8080"
OCR_DPI: ${OCR_DPI:-300}
# OCR_DPI: 150 reduce RAM (~4×) frente a 300; suficiente para contar facturas.
OCR_DPI: ${OCR_DPI:-150}
OCR_LANG: ${OCR_LANG:-spa}
# Con varios lotes paralelos desde el desktop, limitar goroutines evita OOM.
OCR_POOL_SIZE: ${OCR_POOL_SIZE:-4}
SYNC_MAX_FILES: ${SYNC_MAX_FILES:-50}
SYNC_PROCESS_CONCURRENCY: ${SYNC_PROCESS_CONCURRENCY:-4}
MAX_PDF_SIZE_MB: ${MAX_PDF_SIZE_MB:-20}
LOG_PIPELINE_TIMING: ${LOG_PIPELINE_TIMING:-false}
ports:
- "8081:8080"
volumes:
- ./services/services-count-facturas-medicas-serving/models/latest:/app/models:ro
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 90s
deploy:
resources:
limits:
memory: 1g
memory: ${COUNT_API_MEMORY:-4g}
api_gateway:
build:
@@ -151,15 +157,25 @@ services:
dockerfile: Dockerfile
container_name: ipsextractor-api
depends_on:
- extraction
- cleaning
- count-api
extraction:
condition: service_healthy
cleaning:
condition: service_started
count-api:
condition: service_healthy
environment:
EXTRACTION_URL: http://extraction:8001
CLEANING_URL: http://cleaning:8002
COUNT_URL: http://count-api:8080
ports:
- "8000:8000"
# Único puerto expuesto al host. Los demás servicios solo son accesibles en la red Docker.
- "0.0.0.0:8189:8000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health/live"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
volumes:
ipsextractor_db: