Files
Pygentic-AI/compose.yaml
Francis Secada b129cd4f0c feat: modernize deployment pipeline for Komodo integration
Production Deployment Improvements:
- Added .env.example template for secure credential management
- Modernized Docker build workflow with branch sanitization
- Created Komodo deployment trigger workflow
- Updated compose.yaml with environment variable substitution

GitHub Workflows:
- Updated docker-image.yml:
  - Add branch name sanitization (replace / with -)
  - Generate both date-tagged and -latest Docker tags
  - Upgrade to actions/checkout@v4
  - Add pull: true for layer caching

- New komodo-deploy.yml:
  - Triggers after successful Docker Image CI
  - Sends signed webhook to Komodo service
  - Extracts and sanitizes branch names
  - Requires secrets: KOMODO_HOST, KOMODO_STACK_ID_OR_NAME, KOMODO_WEBHOOK_SECRET

Docker Compose Modernization:
- Dynamic IMAGE_TAG with sensible defaults (main-latest)
- Configurable memory limits and reservations
- Environment variable substitution for all configs
- Added container names and restart policies
- Improved healthcheck with Host header
- Updated Traefik labels with Let's Encrypt cert resolver
- Added loadbalancer server URL configuration
- Explicit command paths for reliability

Security:
- .env.example provides safe template (no credentials)
- Actual .env remains in .gitignore (not tracked)

Pattern based on proven Formana deployment architecture.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 16:30:10 -05:00

69 lines
2.2 KiB
YAML

services:
web:
image: s3docker.francissecada.com/pygentic_ai:${IMAGE_TAG:-main-latest}
container_name: pygentic_ai
restart: unless-stopped
deploy:
resources:
limits:
memory: ${MEMORY_LIMIT:-1024mb}
reservations:
memory: ${MEMORY_RESERVATION:-512mb}
ports:
- "0.0.0.0:${PORT:-5051}:${INTERNAL_PORT:-5051}"
env_file:
- ./stack.env
environment:
- PORT=${INTERNAL_PORT:-5051}
- SERVER_ENV=${SERVER_ENV:-prod}
volumes:
- ./src/proxy_urls.db:/opt/pygentic_ai/src/proxy_urls.db
command: bash -c "/opt/pygentic_ai/docker/pygentic_ai/python_start.sh"
healthcheck:
test: ["CMD", "curl", "-f", "-H", "Host: pygenticai.francissecada.com", "http://localhost:${INTERNAL_PORT:-5051}/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
labels:
- traefik.enable=true
- traefik.http.routers.pygentic_ai.rule=Host(`pygenticai.francissecada.com`)
- traefik.http.routers.pygentic_ai.entrypoints=websecure
- traefik.http.routers.pygentic_ai.tls.certresolver=letsencrypt
- traefik.http.services.pygentic_ai.loadbalancer.server.url=http://${DOCKER_HOST_IP:-192.168.99.85}:${PORT:-5051}
networks:
- proxy
celery_service:
image: s3docker.francissecada.com/pygentic_ai:${IMAGE_TAG:-main-latest}
container_name: pygentic_ai_celery
restart: unless-stopped
deploy:
resources:
limits:
memory: ${CELERY_MEMORY_LIMIT:-512mb}
reservations:
memory: ${CELERY_MEMORY_RESERVATION:-256mb}
command: bash -c "/opt/pygentic_ai/docker/celery/start.sh"
env_file:
- ./stack.env
environment:
- PORT=${CELERY_PORT:-5052}
- SERVER_ENV=${SERVER_ENV:-prod}
- C_FORCE_ROOT=true
ports:
- "0.0.0.0:${CELERY_PORT:-5052}:${CELERY_PORT:-5052}"
labels:
- traefik.enable=true
- traefik.http.routers.celery_pygentic_ai.entrypoints=websecure
- traefik.http.routers.celery_pygentic_ai.rule=Host(`celery.pygenticai.francissecada.com`)
- traefik.http.routers.celery_pygentic_ai.tls.certresolver=letsencrypt
networks:
- proxy
depends_on:
- web
networks:
proxy:
external: true