mcrentcast/docker-compose.yml
Ryan Malloy 723123a6fe Add comprehensive mock Rentcast API for testing
- Complete mock API server with all Rentcast endpoints
- Static test API keys with different tiers and limits
- Rate limiting simulation for testing
- Docker service configuration for mock API
- Integration tests using mock API
- Configuration support for switching between real/mock APIs
- Test script to verify mock API functionality
- Comprehensive documentation for mock API usage

Test API Keys:
- test_key_free_tier: 50 daily limit
- test_key_basic: 100 daily limit
- test_key_pro: 1000 daily limit
- test_key_enterprise: 10000 daily limit
- test_key_rate_limited: 1 daily limit (for testing)
- test_key_invalid: For testing auth errors
2025-09-09 08:56:01 -06:00

124 lines
3.2 KiB
YAML

services:
# Mock Rentcast API for testing (only in development mode)
mock-rentcast-api:
build:
context: .
target: ${MODE:-development}
command: ["uv", "run", "uvicorn", "mcrentcast.mock_api:mock_app", "--host", "0.0.0.0", "--port", "8001", "--reload"]
volumes:
- ./src:/app/src:ro
- ./.env:/app/.env:ro
environment:
- MODE=${MODE:-development}
expose:
- "8001"
labels:
caddy: mock-api.${DOMAIN}
caddy.reverse_proxy: "{{upstreams}}"
networks:
- caddy
- internal
restart: unless-stopped
profiles:
- mock
- test
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
interval: 30s
timeout: 10s
retries: 3
mcrentcast-server:
build:
context: .
target: ${MODE:-development}
volumes:
- ./src:/app/src:ro
- ./docs:/app/docs:ro
- ./data:/app/data
- ./.env:/app/.env:ro
environment:
- MODE=${MODE:-development}
- DATABASE_URL=sqlite:///./data/mcrentcast.db
- RENTCAST_API_KEY=${RENTCAST_API_KEY}
- RENTCAST_BASE_URL=${RENTCAST_BASE_URL}
- DAILY_API_LIMIT=${DAILY_API_LIMIT:-100}
- MONTHLY_API_LIMIT=${MONTHLY_API_LIMIT:-1000}
- REQUESTS_PER_MINUTE=${REQUESTS_PER_MINUTE:-3}
- CACHE_TTL_HOURS=${CACHE_TTL_HOURS:-24}
- MAX_CACHE_SIZE_MB=${MAX_CACHE_SIZE_MB:-100}
expose:
- "3001"
labels:
caddy: api.${DOMAIN}
caddy.reverse_proxy: "{{upstreams}}"
caddy.header.Access-Control-Allow-Origin: "https://${DOMAIN}"
caddy.header.Access-Control-Allow-Methods: "GET, POST, PUT, DELETE, OPTIONS"
caddy.header.Access-Control-Allow-Headers: "Content-Type, Authorization"
networks:
- caddy
- internal
restart: unless-stopped
depends_on:
- mcrentcast-db
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
mcrentcast-db:
image: postgres:16-alpine
environment:
POSTGRES_DB: mcrentcast
POSTGRES_USER: mcrentcast
POSTGRES_PASSWORD: ${DB_PASSWORD:-mcrentcast_dev_password}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
networks:
- internal
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mcrentcast"]
interval: 10s
timeout: 5s
retries: 5
frontend:
build:
context: ./frontend
target: ${MODE:-development}
volumes:
- ./frontend/src:/app/src:ro
- ./frontend/public:/app/public:ro
- ./.env:/app/.env:ro
environment:
- MODE=${MODE:-development}
- PUBLIC_DOMAIN=${DOMAIN}
- PUBLIC_API_URL=https://api.${DOMAIN}
expose:
- "80"
labels:
caddy: ${DOMAIN}
caddy.reverse_proxy: "{{upstreams}}"
networks:
- caddy
restart: unless-stopped
depends_on:
- mcrentcast-server
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
caddy:
external: true
internal:
driver: bridge
volumes:
postgres_data:
driver: local