13693261870
10 天以前 5894a4a94bd415e6219a5852b05f127fd03e3aba
docker/docker-compose.yml
@@ -1,55 +1,134 @@
version: '3.8'
version: "3.8"
services:
  # zookeeper
  zookeeper:
    image: zookeeper:3.4.9
  # postgis
  postgis:
    image: postgis/postgis:17.5
    ports:
      - 2181:2181
 #     - 2888:2888
 #     - 3888:3888
      - 5432:5432
    volumes:
      - ./zookeeper_data:/data
      - ./postgis/pgdata:/var/lib/postgresql/data
      - ./postgis/init:/docker-entrypoint-initdb.d
    environment:
      ZOO_MY_ID: 1
      ZOO_SERVERS: server.1=0.0.0.0:2888:3888
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: Postgres!_17_jHs
      ALLOW_IP_RANGE: 0.0.0.0/0
      TZ: Asia/Shanghai
      POSTGRES_DB: jhs
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 2s
      retries: 3
    privileged: true
    networks:
      - kafka_net
  #kafka
  kafka:
    image: bitnami/kafka:3.4
    depends_on:
      - zookeeper
    ports:
      - 9092:9092
      - network-jhs
  # nacos
  nacos:
    image: nacos/nacos-server:v3.0.2
    environment:
      KAFKA_BROKER_ID: 1
      ALLOW_PLAINTEXT_LISTENER: "yes"
      KAFKA_CFG_LISTENERS: PLAINTEXT://:9092
      KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://192.168.11.203:9092
      #KKAFKA_LISTENERS: PLAINTEXT://:9092
      #AFKA_ADVERTISED_LISTENERS: PLAINTEXT://192.168.11.203:9092
      #KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      #KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
      TZ: Asia/Shanghai
      MODE: standalone
      SPRING_DATASOURCE_PLATFORM: postgresql
      DB_URL: jdbc:postgresql://postgis:5432/jhs?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
      DB_USER: postgres
      DB_PASSWORD: Postgres!_17_jHs
      NACOS_AUTH_ENABLE: true
      NACOS_AUTH_IDENTITY_KEY: nacos
      NACOS_AUTH_IDENTITY_VALUE: nAcos_!9#_admIn
      DB_POOL_CONFIG_DRIVERCLASSNAME: org.postgresql.Driver
      NACOS_AUTH_TOKEN: TmFjb3NfUmFuZG9tX1N0cmluZ18zMl9DaGFyc19Pcl9Mb25nZXI=
    volumes:
      - ./kafka_data:/bitnami/kafka
      # 将宿主机的Docker套接字文件挂载到容器内部
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - kafka_net
  # kafka-ui
  kafka-ui:
    image: provectuslabs/kafka-ui
    depends_on:
      - kafka
      - ./nacos/logs/:/home/nacos/logs
      - ./nacos/plugins:/home/nacos/plugins
      #- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:8080 || exit 1"]
      interval: 10s
      timeout: 2s
      retries: 3
      start_period: 7s
    ports:
      - 8081:8080
    environment:
      DYNAMIC_CONFIG_ENABLED: true
      #KAFKA_CLUSTERS_0_NAME: local
      #KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092
      - 8080:8080
      - 8848:8848
      - 9848:9848
    depends_on:
      postgis:
        condition: service_healthy
    privileged: true
    networks:
      - kafka_net
      - network-jhs
    #restart: always
  # redis
  redis:
    image: redis:7
    ports:
      - 6379:6379
    volumes:
      - ./redis/redis.conf:/data/redis.conf
      - ./redis/data:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 2s
      retries: 3
    #command: redis-server --requirepass Redis_s!E_6.2.6
    command: redis-server /data/redis.conf
    networks:
      - network-jhs
  # gateway
  gateway:
    image: openjdk:8-jre
    volumes:
      - ./gateway/logs:/logs
      - ./gateway:/app
    environment:
      TZ: Asia/Shanghai
    #entrypoint: /bin/sh -c "sleep 30 && java -jar /app/se-gateway.jar --spring.config.location=file:/app/"
    entrypoint: java -jar /app/se-gateway.jar --spring.config.location=file:/app/
    depends_on:
      redis:
        condition: service_healthy
      nacos:
        condition: service_healthy
    networks:
      - network-jhs
  # system
  system:
    image: openjdk8-422-gdal:3.5.2
    volumes:
      - ./system/logs:/logs
      - ./system:/app
    environment:
      TZ: Asia/Shanghai
    #entrypoint: /bin/sh -c "sleep 30 && java -jar /app/se-system.jar --spring.config.location=file:/app/"
    entrypoint: java -jar /app/se-system.jar --spring.config.location=file:/app/
    depends_on:
      postgis:
        condition: service_healthy
      redis:
        condition: service_healthy
      nacos:
        condition: service_healthy
    networks:
      - network-jhs
  # nginx
  nginx:
    image: nginx:1.29
    ports:
      - 80:80
      - 443:443
    environment:
      TZ: Asia/Shanghai
    volumes:
      - ./nginx/logs:/var/log/nginx
      - ./nginx/html:/usr/share/nginx/html
      - ./nginx/conf/conf.d:/etc/nginx/conf.d
      - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - gateway
      - system
    networks:
      - network-jhs
networks:
  kafka_net:
  network-jhs:
    driver: bridge