Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company 👇

2.6 KB
Raw Blame
# ©AngelaMos | 2026
# compose.yml

name: ${APP_NAME:-siem}

services:
  nginx:
    build:
      context: .
      dockerfile: conf/docker/prod/vite.docker
    container_name: ${APP_NAME:-siem}-nginx
    ports:
      - "${NGINX_HOST_PORT:-8431}:80"
    depends_on:
      backend:
        condition: service_healthy
    networks:
      - frontend
      - backend
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 256M
        reservations:
          cpus: '0.25'
          memory: 64M
    restart: always

  backend:
    build:
      context: .
      dockerfile: conf/docker/prod/flask.docker
    container_name: ${APP_NAME:-siem}-backend
    expose:
      - "5000"
    env_file:
      - .env
    environment:
      - MONGO_URI=mongodb://mongo:27017/${MONGO_DB:-siem}
      - REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
      - DEBUG=false
    depends_on:
      mongo:
        condition: service_healthy
      redis:
        condition: service_healthy
    networks:
      - backend
    deploy:
      resources:
        limits:
          cpus: '2.0'
          memory: 1G
        reservations:
          cpus: '0.5'
          memory: 256M
    healthcheck:
      test: ["CMD", "curl", "-sf", "http://localhost:5000/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 40s
    restart: always

  mongo:
    image: mongo:7.0
    container_name: ${APP_NAME:-siem}-mongo
    volumes:
      - mongo_data:/data/db
    networks:
      - backend
    deploy:
      resources:
        limits:
          cpus: '1.0'
          memory: 512M
        reservations:
          cpus: '0.25'
          memory: 128M
    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
    restart: always

  redis:
    image: redis:7-alpine
    container_name: ${APP_NAME:-siem}-redis
    volumes:
      - redis_data:/data
    command: redis-server --appendonly yes ${REDIS_PASSWORD:+--requirepass ${REDIS_PASSWORD}}
    networks:
      - backend
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: 256M
        reservations:
          cpus: '0.1'
          memory: 64M
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ${REDIS_PASSWORD:+-a ${REDIS_PASSWORD}} ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    restart: always

networks:
  frontend:
    driver: bridge
    ipam:
      config:
        - subnet: 10.202.83.0/24
  backend:
    driver: bridge
    ipam:
      config:
        - subnet: 10.202.84.0/24

volumes:
  mongo_data:
  redis_data: