services:
  mysql:
    image: mysql:8.0.34
    container_name: tydata_mysql
    environment:
      # 时区上海 - Time zone Shanghai (Change if needed)
      TZ: Asia/Shanghai
      # root 密码 - root password
      MYSQL_ROOT_PASSWORD: yfg87gyuYiy1
      MYSQL_DATABASE: tydata
      MYSQL_USER: tydata
      MYSQL_PASSWORD: 5vg67b3UNHu8
    ports:
      - "21001:3306"
    volumes:
      # 数据挂载 - Data mounting
      - ./data/mysql/data:/var/lib/mysql
      # 日志
    command:
      # 将mysql8.0默认密码策略 修改为 原先 策略 (mysql8.0对其默认策略做了更改 会导致密码无法匹配) 
      # Modify the Mysql 8.0 default password strategy to the original strategy (MySQL8.0 to change its default strategy will cause the password to be unable to match)
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --explicit_defaults_for_timestamp=true
      --lower_case_table_names=1
    restart: always
    networks:
      - tydata_net

  redis:
    image: redis:7.4.0
    container_name: tydata_redis
    ports:
      - "21002:6379"
    environment:
      # 时区上海 - Time zone Shanghai (Change if needed)
      TZ: Asia/Shanghai
    volumes:
      # 数据文件 - data files
      - ./data/redis/data:/data:rw
    command: "redis-server --requirepass 3m3WsgyCKWqz  --appendonly yes"
    privileged: true
    restart: always
    networks:
      - tydata_net

  asynqmon:
    image: hibiken/asynqmon:latest
    container_name: tydata_asynqmon
    ports:
      - "21003:8080"
    environment:
      - TZ=Asia/Shanghai
    command:
      - '--redis-addr=tydata_redis:6379'
      - '--redis-password=3m3WsgyCKWqz'
    restart: always
    networks:
      - tydata_net
    depends_on:
      - redis

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: tydata_phpmyadmin
    restart: unless-stopped
    environment:
      PMA_HOST: tydata_mysql
      PMA_PORT: 3306
      PMA_USER: tydata
      PMA_PASSWORD: 5vg67b3UNHu8
    ports:
      - "21004:80"
    depends_on:
      - mysql
    networks:
      - tydata_net
networks:
  tydata_net:
    driver: bridge
