services:
  postgres:
    image: postgres:13
    container_name: postgres
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: persistant-data
      POSTGRES_PASSWORD: persistant-data-pw
      POSTGRES_DB: var
    volumes:
      - postgres-data:/var/lib/postgresql/data
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    ports:
      - "4100:3000"
    depends_on:
      - postgres
    volumes:
      - ./grafana:/var/lib/grafana
  redis:
    container_name: redis
    image: redis/redis-stack:latest
    ports:
      - "6379:6379"
    volumes:
      - "redis_data:/data"

  moodle_database:
    container_name: moodle_database
    image: docker.io/bitnami/mariadb:latest
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - ALLOW_EMPTY_PASSWORD=yes
      - MARIADB_USER=bn_moodle
      - MARIADB_DATABASE=bitnami_moodle
      - MARIADB_CHARACTER_SET=utf8mb4
      - MARIADB_COLLATE=utf8mb4_unicode_ci
    volumes:
      - "moodle_database:/bitnami/mariadb"
  moodle:
    image: bitnami/moodle:latest
    container_name: moodle
    ports:
      - "8081:8080" # Moodle läuft auf http://localhost:8081
    environment:
      - MOODLE_DATABASE_HOST=moodle_database
      - MOODLE_DATABASE_PORT_NUMBER=3306
      - MOODLE_DATABASE_USER=bn_moodle
      - MOODLE_DATABASE_NAME=bitnami_moodle

      - MOODLE_USERNAME=admin
      - MOODLE_PASSWORD=admin123
      - MOODLE_EMAIL=admin@example.com
      - MOODLE_SITE_NAME="Mein Lokales Moodle"
      - MOODLE_SSLPROXY=false
      - ALLOW_EMPTY_PASSWORD=yes
    depends_on:
      - moodle_database
    volumes:
      - moodle_data:/bitnami/moodle
      - moodle_moodledata:/bitnami/moodledata
  # Für den Zugriff auf den Host
  livekit-server:
    image: livekit/livekit-server
    container_name: livekit_server
    restart: unless-stopped
    ports:
      - "7880:7880"
      - "7881:7881"
      - "7882:7882/udp"
    volumes:
      - "./livekit.yaml:/livekit.yaml"
    command:
      - "--config"
      - "/livekit.yaml"
      - "--node-ip=127.0.0.1"

volumes:
  postgres-data:
  moodle_data:
  moodle_database:
  moodle_moodledata:
  redis_data:
    driver: local
