convertor/docker-compose.yml
Dan Mestas 71b52f6c5e feat(api): implement OpenAPI/REST API for file conversions
- Add comprehensive REST API at /api/v1 with modular structure
- Implement authentication endpoints (register, login, logout, me)
- Add converter listing and format discovery endpoints
- Create job management and file download endpoints
- Add health check endpoint for monitoring
- Set up CORS support for browser-based API clients
- Create API middleware for JWT authentication
- Add environment variables for API configuration
- Include comprehensive API documentation and test script

Infrastructure:
- Enhanced CI/CD workflow for custom Docker registries
- Docker Compose setup with dev, prod, and monitoring profiles
- Claude.ai integration files for development workflow
- Environment-based configuration with .env.development

Known limitations:
- JWT authentication context needs fixing (using ALLOW_UNAUTHENTICATED=true)
- Swagger UI temporarily disabled due to composition error
- File upload endpoint needs multipart/form-data support

The API code is isolated in src/api/ directory to maintain separation
from the existing codebase, making it easy to maintain or contribute back.
2025-07-30 14:18:13 -05:00

136 lines
No EOL
3.5 KiB
YAML

version: '3.8'
services:
# Production-like service
convertx:
build:
context: .
dockerfile: Dockerfile
target: release
image: convertx-openapi:local
container_name: convertx-prod
volumes:
- ./data:/app/data
environment:
- ACCOUNT_REGISTRATION=true
- JWT_SECRET=${JWT_SECRET:-aLongAndSecretStringUsedToSignTheJSONWebToken1234}
- HTTP_ALLOWED=${HTTP_ALLOWED:-false}
- ALLOW_UNAUTHENTICATED=${ALLOW_UNAUTHENTICATED:-false}
- AUTO_DELETE_EVERY_N_HOURS=${AUTO_DELETE_EVERY_N_HOURS:-24}
- WEBROOT=${WEBROOT:-}
- TZ=${TZ:-UTC}
# API-specific environment variables
- API_ENABLED=${API_ENABLED:-true}
- API_PREFIX=${API_PREFIX:-/api/v1}
- API_RATE_LIMIT=${API_RATE_LIMIT:-100}
- API_RATE_WINDOW=${API_RATE_WINDOW:-15m}
- API_KEY_ENABLED=${API_KEY_ENABLED:-true}
ports:
- "3000:3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: unless-stopped
# Development service with hot reload
convertx-dev:
build:
context: .
dockerfile: Dockerfile
target: base
image: convertx-openapi:dev
container_name: convertx-dev
working_dir: /app
command: bun run --hot src/index.tsx
volumes:
- ./src:/app/src
- ./public:/app/public
- ./data:/app/data
- ./package.json:/app/package.json
- ./bun.lockb:/app/bun.lockb
- ./tsconfig.json:/app/tsconfig.json
environment:
- NODE_ENV=development
- ACCOUNT_REGISTRATION=true
- JWT_SECRET=dev-secret-key
- HTTP_ALLOWED=true
- ALLOW_UNAUTHENTICATED=true
- AUTO_DELETE_EVERY_N_HOURS=0
- WEBROOT=
- TZ=${TZ:-UTC}
# Development specific
- DEBUG=true
- LOG_LEVEL=debug
ports:
- "3001:3000"
profiles:
- dev
# API documentation server (when implemented)
api-docs:
image: swaggerapi/swagger-ui:latest
container_name: convertx-api-docs
environment:
- SWAGGER_JSON_URL=http://convertx:3000/api/v1/swagger.json
- BASE_URL=/api-docs
ports:
- "3002:8080"
depends_on:
- convertx
profiles:
- docs
# Database viewer for development
db-viewer:
image: sqlitebrowser/sqlitebrowser:latest
container_name: convertx-db-viewer
volumes:
- ./data:/data
environment:
- DISPLAY=${DISPLAY:-:0}
network_mode: host
profiles:
- debug
# Monitoring stack (optional)
prometheus:
image: prom/prometheus:latest
container_name: convertx-prometheus
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
ports:
- "9090:9090"
profiles:
- monitoring
grafana:
image: grafana/grafana:latest
container_name: convertx-grafana
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards
- ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
ports:
- "3003:3000"
depends_on:
- prometheus
profiles:
- monitoring
volumes:
prometheus_data:
grafana_data:
networks:
default:
name: convertx-network