services:
  postgres:
    image: postgres:latest
    container_name: postgres_db
    restart: unless-stopped
    environment:
      POSTGRES_USER: asdfuser
      POSTGRES_PASSWORD: asdfpassword
      POSTGRES_DB: asdfdb
    ports:
      - "3335:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

  modsecurity:
    image: owasp/modsecurity-crs:apache-alpine
    container_name: modsecurity
    restart: unless-stopped
    environment:
      BACKEND: "http://localhost:80"
      SERVER_NAME: "localhost"
      PORT: "3331"
      MODSEC_AUDIT_LOG: "/var/log/modsec_audit.log"
      ERRORLOG: "/var/log/modsec_error.log"
      ACCESSLOG: "/var/log/apache2/access.log"
      MODSEC_AUDIT_LOG_FORMAT: "JSON"
      BLOCKING_PARANOIA: 1
      DETECTION_PARANOIA: 1
      EXECUTING_PARANOIA: 1
      PARANOIA: 1
    network_mode: "host"
    volumes:
      - "./logs/host-fs-auditlog.log:/var/log/modsec_audit.log"
      - "./logs/host-fs-errorlog.log:/var/log/modsec_error.log"
      - "./logs/host-fs-accesslog.log:/var/log/apache2/access.log"

  dvwa:
    image: vulnerables/web-dvwa
    container_name: dvwa
    restart: unless-stopped
    ports:
      - "80:80"

  cspj-server:
    image: vomitblood/cspj-server
    container_name: cspj-server
    restart: unless-stopped
    network_mode: host
    depends_on:
      - postgres
    volumes:
      - "${HOME}/build/cspj-application/docker/chungus/logs/:/tmp"
    command: ["server", "-l", "/tmp"]

  cspj-ml-server:
    image: vomitblood/cspj-ml-server
    container_name: cspj-ml-server
    restart: unless-stopped
    ports:
      - "5000:5000"

volumes:
  postgres_data:
