version: "3.5"

services:
  mall4cloud-mysql:
    image: mysql:8.0.35
    container_name: mall4cloud-mysql
    restart: always
    environment:
      - TZ=Asia/Shanghai
      - MYSQL_ROOT_PASSWORD=hn02le.34lkdLKD
    network_mode: "host"
    expose:
      - 3306
    volumes:
      - ./mysql/data:/var/lib/mysql
      - ./mysql/conf.d:/etc/mysql/conf.d
      - ./mysql/initdb:/docker-entrypoint-initdb.d

  mall4cloud-minio:
    image: minio/minio:RELEASE.2021-06-17T00-10-46Z
    container_name: mall4cloud-minio
    restart: always
    command: server /data
    network_mode: "host"
    expose:
      - 9000
    volumes:
      - ./minio/data:/data
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=hn02le.34lkdLKD

  mall4cloud-redis:
    image: redis:7.0
    container_name: mall4cloud-redis
    restart: always
    network_mode: "host"
    expose:
      - 6379
    command: redis-server --requirepass hn02le.34lkdLKD

  mall4cloud-aof-redis:
    image: redis:7.0
    container_name: mall4cloud-aof-redis
    restart: always
    network_mode: "host"
    expose:
      - 6389
    volumes:
      - ./redis/redis.conf:/etc/redis/redis.conf
      - ./redis/data:/data
    command: redis-server /etc/redis/redis.conf --requirepass hn02le.34lkdLKD

  mall4cloud-nacos:
    image: nacos/nacos-server:v2.2.3
    container_name: mall4cloud-nacos
    restart: always
    depends_on:
      - mall4cloud-mysql
    network_mode: "host"
    expose:
      - 8848
      - 9848
      - 9849
    environment:
      - JVM_XMS=256m
      - JVM_XMX=256m
      - MODE=standalone
      - PREFER_HOST_MODE=hostname
      - SPRING_DATASOURCE_PLATFORM=mysql
      - MYSQL_SERVICE_HOST=192.168.193.128
      - MYSQL_SERVICE_DB_NAME=mall4cloud_nacos
      - MYSQL_SERVICE_USER=root
      - MYSQL_SERVICE_PASSWORD=hn02le.34lkdLKD
      - NACOS_AUTH_ENABLE=true
      - NACOS_CORE_AUTH_PLUGIN_NACOS_TOKEN_SECRET_KEY=ETDrhi0SaqIrT3OxlGr9ztKShaR8BK4eV
      - NACOS_CORE_AUTH_SERVER_IDENTITY_KEY=mall4j
      - NACOS_CORE_AUTH_SERVER_IDENTITY_VALUE=mall4cloud
    volumes:
      - ./nacos/logs:/home/nacos/logs


  mall4cloud-seata:
    image: seataio/seata-server:2.0.0
    container_name: mall4cloud-seata
    restart: always
    ports:
      - 8091:8091
      - 7091:7091
    environment:
      - TZ
      - STORE_MODE=db
      - SEATA_IP=192.168.193.128
      - SEATA_PORT=8091
    volumes:
      - ./seata/application.yml:/seata-server/resources/application.yml

  mall4cloud-job:
    image: xuxueli/xxl-job-admin:2.4.0
    container_name: mall4cloud-job
    restart: always
    depends_on:
      - mall4cloud-mysql
    network_mode: "host"
    expose:
      - 8080
    environment:
      - PARAMS=--spring.datasource.url=jdbc:mysql://192.168.193.128:3306/mall4cloud_job?Unicode=true&characterEncoding=UTF-8 \
        --spring.datasource.username=root \
        --spring.datasource.password=hn02le.34lkdLKD \
        --spring.mail.host=smtp.qq.com \
        --spring.mail.port=25 \
        --spring.mail.username=xxxx@qq.com \
        --spring.mail.password=xxxx \
        --spring.mail.properties.mail.smtp.auth=true \
        --spring.mail.properties.mail.smtp.starttls.enable=true \
        --spring.mail.properties.mail.smtp.starttls.required=true \
        --spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory \
        --xxl.job.accessToken=default_token \
        --xxl.job.logretentiondays=7

  mall4cloud-elasticsearch:
    image: elasticsearch:7.17.5
    container_name: mall4cloud-elasticsearch
    restart: always
    network_mode: "host"
    expose:
      - 9200
      - 9300
    environment:
      - TAKE_FILE_OWNERSHIP=true
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTIC_PASSWORD=hn02le.34lkdLKD
      - xpack.security.enabled=true
    volumes:
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - ./elasticsearch/data:/usr/share/elasticsearch/data
      - ./elasticsearch/plugins:/usr/share/elasticsearch/plugins

  mall4cloud-canal:
    image: canal/canal-server:v1.1.6
    container_name: mall4cloud-canal
    restart: always
    network_mode: "host"
    expose:
      - 11110
      - 11111
      - 11112
    volumes:
      - ./canal/conf/example:/home/admin/canal-server/conf/example
      - ./canal/conf/canal.properties:/home/admin/canal-server/conf/canal.properties
      - ./canal/logs:/home/admin/canal-server/logs


  mall4cloud-nginx:
    container_name: mall4cloud-nginx
    hostname: mall4cloud-nginx
    image: nginx:1.20
    network_mode: "host"
    expose:
      - 80
      - 443
    restart: always
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/html:/usr/share/nginx/html
      - ./nginx/ssl:/ssl


  mall4cloud-rocketmq-namesrv:
    image: apache/rocketmq:5.1.1
    container_name: mall4cloud-rocketmq-namesrv
    restart: always
    network_mode: "host"
    expose:
      - 9876
    volumes:
      - ./rocketmq/namesrv/logs:/home/rocketmq/logs
      - ./rocketmq/namesrv/store:/home/rocketmq/store
    environment:
      JAVA_OPT_EXT: "-Duser.home=/home/rocketmq -Xms512M -Xmx512M -Xmn128M"
    command: ["sh","mqnamesrv"]

  mall4cloud-rocketmq-broker:
    image: apache/rocketmq:5.1.1
    container_name: mall4cloud-rocketmq-broker
    restart: always
    network_mode: "host"
    expose:
      - 10909
      - 10911
    volumes:
      - ./rocketmq/broker/logs:/home/rocketmq/logs
      - ./rocketmq/broker/store:/home/rocketmq/store
      - ./rocketmq/broker/conf/broker.conf:/etc/rocketmq/broker.conf
    environment:
      JAVA_OPT_EXT: "-Duser.home=/home/rocketmq -Xms512M -Xmx512M -Xmn128M -XX:-AssumeMP"
    command: ["sh","mqbroker","-c","/etc/rocketmq/broker.conf","-n","mall4cloud-rocketmq-namesrv:9876","autoCreateTopicEnable=true"]
    depends_on:
      - mall4cloud-rocketmq-namesrv


  mall4cloud-rocketmq-dashboard:
    image: fsckzy01/rocketmq-dashboard:1.0.1
    container_name: mall4cloud-rocketmq-dashboard
    restart: always
    ports:
      - 8180:8080
    environment:
      JAVA_OPTS: "-Drocketmq.namesrv.addr=mall4cloud-rocketmq-namesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
    depends_on:
      - mall4cloud-rocketmq-namesrv

  mall4cloud-mongo:
    container_name: mall4cloud-mongo
    environment:
      - TZ=Asia/Shanghai
      - MONGO_INITDB_ROOT_USERNAME=root
      - MONGO_INITDB_ROOT_PASSWORD=hn02le.34lkdLKD
      - MONGO_INITDB_DATABASE=mall4cloud
    network_mode: "host"
    expose:
      - 27017
    hostname: mall4cloud-mongo
    image: mongo:6.0.1
    restart: always
    volumes:
      - ./mongo/data:/data/db
      - ./mongo/log:/data/log
      - ./mongo/conf:/etc/mongo
      - ./mongo/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    command: --config /etc/mongo/mongodb.conf

  mall4cloud-shardingsphere:
    image: apache/shardingsphere-proxy:5.4.1
    container_name: mall4cloud-shardingsphere
    restart: always
    environment:
      - TZ=Asia/Shanghai
    expose:
      - 3307
    ports:
      - 3307:3307
    volumes:
      - ./shardingsphere/conf:/opt/shardingsphere-proxy/conf
      - ./shardingsphere/ext-lib:/opt/shardingsphere-proxy/ext-lib