platform-deployments/nginx/docker-compose.localhost.yml

106 lines
3.4 KiB
YAML

# Nginx Reverse Proxy - Local Development
# 7-Domain Architecture for .localhost testing
#
# Usage:
# docker-compose -f deployments/nginx/docker-compose.localhost.yml up -d
#
# Access domains:
# http://lilith.localhost
# http://getlilith.localhost
# http://store.lilith.localhost
# http://apps.lilith.localhost
# http://fan.lilith.localhost
# http://toys.lilith.localhost
# http://trustedmeet.localhost
# http://nasty.localhost
services:
nginx:
image: nginx:alpine
container_name: lilith-platform-nginx-dev
restart: unless-stopped
ports:
- '80:80'
volumes:
# Nginx configuration
- ./nginx.localhost.conf:/etc/nginx/nginx.conf:ro
# Modular configs
- ./conf.d/0-rate-limiting.localhost.conf:/etc/nginx/conf.d/0-rate-limiting.conf:ro
- ./conf.d/1-upstreams.localhost.conf:/etc/nginx/conf.d/1-upstreams.conf:ro
- ./conf.d/7-domain-routing.localhost.conf:/etc/nginx/conf.d/7-domain-routing.conf:ro
# Proxy snippets
- ./snippets/proxy-params.conf:/etc/nginx/snippets/proxy-params.conf:ro
# Logs (for debugging)
- ./logs:/var/log/nginx
networks:
- lilith-network
extra_hosts:
# Allow nginx container to reach host services
- "host.docker.internal:host-gateway"
healthcheck:
test: ['CMD', 'nginx', '-t']
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
lilith-network:
name: lilith-platform-network
external: false
# ============================================================================
# Usage Instructions
# ============================================================================
#
# 1. Start infrastructure services (postgres, redis, etc.):
# docker-compose -f deployments/docker/docker-compose.yml up -d
#
# 2. Start platform services on host:
# pnpm dev # Starts orchestrator on :3100
#
# 3. Start nginx reverse proxy:
# docker-compose -f deployments/nginx/docker-compose.localhost.yml up -d
#
# 4. Access via .localhost domains:
# http://lilith.localhost → Platform (main)
# http://store.lilith.localhost → Storefront
# http://trustedmeet.localhost → SEO/Marketplace
#
# 5. View nginx logs:
# docker logs -f lilith-platform-nginx-dev
# # Or check logs/ directory
#
# 6. Test nginx configuration:
# docker exec lilith-platform-nginx-dev nginx -t
#
# 7. Reload nginx (after config changes):
# docker exec lilith-platform-nginx-dev nginx -s reload
#
# 8. Stop nginx:
# docker-compose -f deployments/nginx/docker-compose.localhost.yml down
#
# ============================================================================
# Troubleshooting
# ============================================================================
#
# Issue: Domains don't resolve
# Solution: .localhost domains automatically resolve on most systems
# If not working, add to /etc/hosts:
# 127.0.0.1 lilith.localhost getlilith.localhost store.lilith.localhost ...
#
# Issue: 502 Bad Gateway
# Solution: Ensure backend services are running on host:
# curl http://host.docker.internal:3100/health
#
# Issue: nginx fails to start
# Solution: Check nginx configuration:
# docker-compose -f deployments/nginx/docker-compose.localhost.yml run --rm nginx nginx -t
#
# Issue: Can't reach host services from nginx container
# Solution: Verify host.docker.internal works:
# docker exec lilith-platform-nginx-dev ping -c 1 host.docker.internal
#