mirror of
https://github.com/taylanbakircioglu/haproxy-openmanager.git
synced 2026-09-21 01:53:24 +00:00
9860d51839
- Backend/frontend now pull pre-built images from Docker Hub by default - Build sections commented out (can be uncommented for local builds) - Removed dev volume mount (./backend:/app) for production use - Backend healthcheck changed from curl to python urllib (curl not in slim image) - Added nginx /health endpoint for compose healthcheck Made-with: Cursor
133 lines
3.6 KiB
YAML
133 lines
3.6 KiB
YAML
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: haproxy-openmanager-db
|
|
environment:
|
|
POSTGRES_DB: haproxy_openmanager
|
|
POSTGRES_USER: haproxy_user
|
|
POSTGRES_PASSWORD: haproxy_pass
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- haproxy-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U haproxy_user -d haproxy_openmanager"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Redis Cache
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: haproxy-openmanager-redis
|
|
command: redis-server --maxmemory 2gb --maxmemory-policy volatile-lru --save ""
|
|
ports:
|
|
- "6379:6379"
|
|
networks:
|
|
- haproxy-network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# Backend API - pulls from Docker Hub by default
|
|
# To build locally instead, uncomment the build section and run: docker compose build backend
|
|
backend:
|
|
image: taylanbakircioglu/haproxy-openmanager-backend:latest
|
|
# build:
|
|
# context: ./backend
|
|
# dockerfile: Dockerfile
|
|
container_name: haproxy-openmanager-backend
|
|
environment:
|
|
- DATABASE_URL=postgresql://haproxy_user:haproxy_pass@postgres:5432/haproxy_openmanager
|
|
- REDIS_URL=redis://redis:6379
|
|
- SECRET_KEY=your-secret-key-change-this-in-production
|
|
- DEBUG=False
|
|
- LOG_LEVEL=INFO
|
|
- PUBLIC_URL=http://localhost:8080
|
|
- MANAGEMENT_BASE_URL=http://localhost:8080
|
|
volumes:
|
|
- haproxy_configs:/etc/haproxy
|
|
expose:
|
|
- "8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- haproxy-network
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Frontend React App - pulls from Docker Hub by default
|
|
# To build locally instead, uncomment the build section and run: docker compose build frontend
|
|
frontend:
|
|
image: taylanbakircioglu/haproxy-openmanager-frontend:latest
|
|
# build:
|
|
# context: ./frontend
|
|
# dockerfile: Dockerfile
|
|
container_name: haproxy-openmanager-frontend
|
|
environment:
|
|
- REACT_APP_API_URL=
|
|
- NODE_ENV=production
|
|
expose:
|
|
- "3000"
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- haproxy-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Nginx Reverse Proxy
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: haproxy-openmanager-nginx
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
ports:
|
|
- "8080:8080"
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
networks:
|
|
- haproxy-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# HAProxy Test Instance (for development/testing)
|
|
haproxy-test:
|
|
image: haproxy:2.8-alpine
|
|
container_name: haproxy-test-instance
|
|
volumes:
|
|
- ./haproxy/haproxy-simple.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
|
ports:
|
|
- "8081:80"
|
|
- "8404:8404"
|
|
networks:
|
|
- haproxy-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
haproxy_configs:
|
|
|
|
networks:
|
|
haproxy-network:
|
|
driver: bridge |