services:
  # Redis
  redis:
    image: eqalpha/keydb
    ports:
      - "6379:6379"

  # MongoDB
  database:
    image: mongo
    ports:
      - "27017:27017"
    volumes:
      - ./.data/db:/data/db
    ulimits:
      nofile:
        soft: 65536
        hard: 65536

  # MinIO
  minio:
    image: minio/minio
    command: server /data
    environment:
      MINIO_ROOT_USER: minioautumn
      MINIO_ROOT_PASSWORD: minioautumn
    volumes:
      - ./.data/minio:/data
    ports:
      - "14009:9000"
      - "14010:9001"
    restart: always

  # Create buckets for minio.
  createbuckets:
    image: minio/mc
    depends_on:
      - minio
    entrypoint: >
      /bin/sh -c "while ! /usr/bin/mc ready minio; do
        /usr/bin/mc alias set minio http://minio:9000 minioautumn minioautumn;
        echo 'Waiting minio...' && sleep 1;
      done; /usr/bin/mc mb minio/revolt-uploads; exit 0;"

  # Rabbit
  rabbit:
    image: rabbitmq:4-management
    environment:
      RABBITMQ_DEFAULT_USER: rabbituser
      RABBITMQ_DEFAULT_PASS: rabbitpass
    volumes:
      - ./.data/rabbit:/var/lib/rabbitmq
      #- ./rabbit_plugins:/opt/rabbitmq/plugins/
      #- ./rabbit_enabled_plugins:/etc/rabbitmq/enabled_plugins
      # uncomment this if you need to enable other plugins
    ports:
      - "5672:5672"
      - "15672:15672" # management UI, for development

  # Mock SMTP server
  maildev:
    image: maildev/maildev
    ports:
      - "14025:25"
      - "14080:8080"
    environment:
      MAILDEV_SMTP_PORT: 25
      MAILDEV_WEB_PORT: 8080
      MAILDEV_INCOMING_USER: smtp
      MAILDEV_INCOMING_PASS: smtp

  livekit:
    image: ghcr.io/stoatchat/livekit-server:v1.9.13
    command: --config /etc/livekit.yml
    network_mode: "host"
    volumes:
      - ./livekit.yml:/etc/livekit.yml
