Learn by Directing AI
All materials

docker-compose.yml

ymldocker-compose.yml
# VERIFICATION: Run `docker compose up -d` and verify all services are healthy before use.
# Expected services: ehr-web, ssh-server, ftp-server, vpn-sim, grafana, loki, alloy
# Expected ports: 80 (EHR), 22 (SSH), 21 (FTP), 3000 (Grafana), 3100 (Loki), 12345 (Alloy)

services:
  ehr-web:
    build: ./ehr-app
    ports:
      - "80:5000"
    depends_on:
      - loki
    networks:
      - clinic-net
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5000/')"]
      interval: 10s
      timeout: 5s
      retries: 3

  ssh-server:
    build: ./ssh-server
    ports:
      - "22:22"
    networks:
      - clinic-net

  ftp-server:
    build: ./ftp-server
    ports:
      - "21:21"
      - "21100-21110:21100-21110"
    networks:
      - clinic-net

  vpn-sim:
    build: ./vpn-sim
    networks:
      - clinic-net

  grafana:
    image: grafana/grafana:10.4.0
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_AUTH_ANONYMOUS_ENABLED=true
    volumes:
      - grafana-data:/var/lib/grafana
      - ./grafana-provisioning:/etc/grafana/provisioning
    depends_on:
      - loki
    networks:
      - clinic-net
    healthcheck:
      test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/api/health"]
      interval: 10s
      timeout: 5s
      retries: 3

  loki:
    image: grafana/loki:2.9.4
    ports:
      - "3100:3100"
    command: -config.file=/etc/loki/local-config.yaml
    networks:
      - clinic-net
    healthcheck:
      test: ["CMD", "wget", "--spider", "-q", "http://localhost:3100/ready"]
      interval: 10s
      timeout: 5s
      retries: 3

  alloy:
    image: grafana/alloy:v1.0.0
    ports:
      - "12345:12345"
    volumes:
      - ./alloy-config.river:/etc/alloy/config.river
      - /var/run/docker.sock:/var/run/docker.sock:ro
    command: run /etc/alloy/config.river
    depends_on:
      - loki
    networks:
      - clinic-net

volumes:
  grafana-data:

networks:
  clinic-net:
    driver: bridge