version: '2.1'

services:
  mysql:
    # https://hub.docker.com/r/bitnami/mysql
    image: bitnami/mysql:8.0.32-debian-11-r12
    ports:
      - '21306:3306'
    volumes:
      #- '/octopus-server/mysql/data:/bitnami/mysql/data'
      - 'mysql_data:/bitnami/mysql/data'
      - '/octopus-server/mysql/nacos-2.2.0-initdb.sql:/docker-entrypoint-initdb.d/nacos-2.2.0-initdb.sql'
      # - '/octopus-server/mysql/wdd-server.sql:/docker-entrypoint-initdb.d/wdd-server.sql'
    networks:
      - app-tier
    environment:
      - MYSQL_ROOT_USER=wmm
      - MYSQL_ROOT_PASSWORD=Superwmm.23
      - MYSQL_CHARACTER_SET=utf8mb4
      - MYSQL_COLLATE:utf8_general_ci
      - MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password
    healthcheck:
      test: [ 'CMD', '/opt/bitnami/scripts/mysql/healthcheck.sh' ]
      interval: 15s
      timeout: 5s
      retries: 6
  redis:
    # https://hub.docker.com/r/bitnami/redis
    image: bitnami/redis:6.2.11-debian-11-r1
    networks:
      - app-tier
    environment:
      - REDIS_PASSWORD=boge8tingH
      # Redis 6.0 features a new multi-threading model
      - REDIS_IO_THREADS=4
      - REDIS_IO_THREADS_DO_READS=yes
      - REDIS_PORT_NUMBER=6379
      - REDIS_REPLICATION_MODE=master
      #- REDIS_DISABLE_COMMANDS=FLUSHDB,FLUSHALL
    ports:
      - '21370:6379'
    volumes:
      - 'redis_data:/bitnami/redis/data'
  rabbitmq:
    # https://hub.docker.com/r/bitnami/rabbitmq
    image: docker.io/bitnami/rabbitmq:3.11.10-debian-11-r0
    ports:
      - '4369'
      - '5551'
      - '5552'
      - '20672:5672'
      - '25672'
      - '20678:15672'
    environment:
      - RABBITMQ_VHOST=/
      - RABBITMQ_VHOSTS=/dev
      - RABBITMQ_USERNAME=wmm
      - RABBITMQ_PASSWORD=Superwmm.23
      - RABBITMQ_SECURE_PASSWORD=no
      - RABBITMQ_LOAD_DEFINITIONS=no
      - RABBITMQ_NODE_PORT_NUMBER=5672
      - RABBITMQ_NODE_SSL_PORT_NUMBER=5671
      - RABBITMQ_MANAGEMENT_PORT_NUMBER=15672
    volumes:
      - 'rabbitmq_data:/bitnami/rabbitmq/mnesia'
  nacos:
    # https://hub.docker.com/r/nacos/nacos-server
    image: docker.io/nacos/nacos-server:v2.2.0-slim
    ports:
      - '21060:8848'
      - '22060:9848'
    environment:
      - MODE=standalone
      - MYSQL_SERVICE_HOST=mysql
      - MYSQL_SERVICE_PORT=3306
      - MYSQL_SERVICE_DB_NAME=nacos_config
      - MYSQL_SERVICE_USER=wmm
      - MYSQL_SERVICE_PASSWORD=Superwmm.23
    depends_on:
      - mysql

#  redis-replica:
#    image: redis-image
#    ports:
#      - '6379'
#    networks:
#      - app-tier
#    depends_on:
#      - redis-master
#    environment:
#      - REDIS_REPLICATION_MODE=slave
#      - REDIS_MASTER_HOST=redis-master
#      - REDIS_MASTER_PORT_NUMBER=6379
#      - REDIS_MASTER_PASSWORD=Superwmm.23
#      - REDIS_PASSWORD=Superwmm.23

volumes:
  mysql_data:
    driver: local
  redis_data:
    driver: local
  rabbitmq_data:
    driver: local

networks:
  app-tier:
    driver: bridge