# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0

services:
  mongodb:
    image: docker.io/bitnami/mongodb:latest
    volumes:
      - 'mongodb_data:/bitnami/mongodb'
    environment:
      - MONGODB_ADVERTISED_HOSTNAME=mongodb
      - MONGODB_USERNAME=bn_appsmith
      - MONGODB_DATABASE=bitnami_appsmith
      - MONGODB_PASSWORD=bitnami123
      - MONGODB_ROOT_PASSWORD=password123
      - MONGODB_REPLICA_SET_MODE=primary
      - MONGODB_REPLICA_SET_KEY=replicasetkey123

  mongodb-secondary:
    image: docker.io/bitnami/mongodb:latest
    depends_on:
      - mongodb
    volumes:
      - 'mongodb_secondary_data:/bitnami/mongodb'
    environment:
      - MONGODB_ADVERTISED_HOSTNAME=mongodb-secondary
      - MONGODB_REPLICA_SET_MODE=secondary
      - MONGODB_INITIAL_PRIMARY_HOST=mongodb
      - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=password123
      - MONGODB_REPLICA_SET_KEY=replicasetkey123
  redis:
    image: docker.io/bitnami/redis:latest
    volumes:
      - 'redis_data:/bitnami/redis'
    environment:
      - REDIS_PASSWORD=bitnami123
  appsmith:
    image: docker.io/bitnami/appsmith:1
    environment:
      - APPSMITH_MODE=client
      - APPSMITH_API_HOST=appsmith-api
      - APPSMITH_RTS_HOST=appsmith-rts
    ports:
      - 80:8080
  appsmith-api:
    image: docker.io/bitnami/appsmith:1
    environment:
      - APPSMITH_MODE=backend
      - BITNAMI_DEBUG=true
      - APPSMITH_API_HOST=appsmith-api
      - APPSMITH_DATABASE_HOST=mongodb,mongodb-secondary
      - APPSMITH_DATABASE_PORT_NUMBER=27017
      - APPSMITH_DATABASE_USER=bn_appsmith
      - APPSMITH_DATABASE_NAME=bitnami_appsmith
      - APPSMITH_DATABASE_PASSWORD=bitnami123
      - APPSMITH_REDIS_PASSWORD=bitnami123
      - APPSMITH_ENCRYPTION_PASSWORD=test123
      - APPSMITH_ENCRYPTION_SALT=testsalt123
      # Hack: This is only necessary in docker-compose
      - APPSMITH_DATABASE_INIT_DELAY=90
    volumes:
      - 'appsmith_backend_data:/bitnami/appsmith'
  appsmith-rts:
    image: docker.io/bitnami/appsmith:1
    environment:
      - APPSMITH_MODE=rts
      - APPSMITH_API_HOST=appsmith-api
      - APPSMITH_DATABASE_HOST=mongodb,mongodb-secondary
      - APPSMITH_DATABASE_PORT_NUMBER=27017
      - APPSMITH_DATABASE_USER=bn_appsmith
      - APPSMITH_DATABASE_NAME=bitnami_appsmith
      - APPSMITH_DATABASE_PASSWORD=bitnami123
      # Hack: This is only necessary in docker-compose
      - APPSMITH_DATABASE_INIT_DELAY=60
volumes:
  mongodb_data:
    driver: local
  mongodb_secondary_data:
    driver: local
  redis_data:
    driver: local
  appsmith_backend_data:
    driver: local
