From 35235553540d6c8eb39fd4f84f4fa079784c8765 Mon Sep 17 00:00:00 2001 From: dingzhaojun Date: Fri, 20 Oct 2023 11:44:43 +0800 Subject: [PATCH] update --- compose-dev.yaml | 152 ------------------ compose.yml | 46 ++++++ pom.xml | 2 +- .../net/risesoft/demo/Demo01Application.java | 2 +- src/main/resources/application.yml | 2 +- 5 files changed, 49 insertions(+), 155 deletions(-) delete mode 100644 compose-dev.yaml create mode 100644 compose.yml diff --git a/compose-dev.yaml b/compose-dev.yaml deleted file mode 100644 index a645caf..0000000 --- a/compose-dev.yaml +++ /dev/null @@ -1,152 +0,0 @@ -version: '3.8' -name: app-01-dev -services: - app: - entrypoint: - - sleep - - infinity - image: docker/dev-environments-java:stable-1 - container_name: app-01 - init: true - volumes: - - type: bind - source: /var/run/docker.sock - target: /var/run/docker.sock - - postgres: - image: postgres - container_name: postgre-01 - restart: always - extra_hosts: - - "host.docker.internal:host-gateway" - networks: - - y9-share-net - ports: - - "5432:5432" - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: "12345678" - POSTGRES_DB: y9_public - PGDATA: "/var/lib/postgresql/data/pgdata" - volumes: - - d:/docker-data/postgres:/var/lib/postgresql/data - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres -d y9_public"] - interval: 10s - timeout: 5s - retries: 3 - db: - image: mysql:latest - container_name: mysql01 - restart: always - extra_hosts: - - "host.docker.internal:host-gateway" - networks: - - y9-share-net - ports: - - "3306:3306" - command: --default-authentication-plugin=caching_sha2_password - environment: - MYSQL_ROOT_PASSWORD: '12345678' - MYSQL_DATABASE: 'y9_public' - volumes: - - d:/docker-data/mysql:/var/lib/mysql - - d:/docker-config/mysql-init:/docker-entrypoint-initdb.d - healthcheck: - #test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] - test: "mysql --user=root --password=12345678 --execute='show databases;'" - interval: 5s - timeout: 10s - retries: 8 - - redis: - image: redis:latest - container_name: redis01 - restart: always - extra_hosts: - - "host.docker.internal:host-gateway" - networks: - - y9-share-net - ports: - - "6379:6379" - command: redis-server --requirepass "12345678" - volumes: - - d:/docker-data/redis:/data - - elasticsearch: - image: elasticsearch:8.10.2 - container_name: elastic01 - restart: always - extra_hosts: - - "host.docker.internal:host-gateway" - networks: - - y9-share-net - ports: - - '9200:9200' - - '9300:9300' - volumes: - - d:/docker-data/es:/usr/share/elasticsearch/data - environment: - - discovery.type=single-node - - xpack.security.enabled=false - labels: - org.springframework.boot.service-connection: elasticsearch - - kafka: - image: bitnami/kafka:latest - container_name: kafka01 - restart: always - extra_hosts: - - "host.docker.internal:host-gateway" - networks: - - y9-share-net - ports: - - "9092:9092" - - "9094:9094" - environment: - - KAFKA_CFG_NODE_ID=0 - - KAFKA_CFG_PROCESS_ROLES=controller,broker - - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://0.0.0.0:9094 - - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://localhost:9094 - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT - - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER - - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 - volumes: - - d:/docker-data/kafka:/bitnami/kafka - - nacos: - image: nacos/nacos-server:v2.2.3 - container_name: nacos01 - restart: always - extra_hosts: - - "host.docker.internal:host-gateway" - networks: - - y9-share-net - ports: - - "8848:8848" - - "9848:9848" - depends_on: - db: - condition: service_healthy - environment: - - PREFER_HOST_MODE=hostname - - MODE=standalone - - SPRING_DATASOURCE_PLATFORM=mysql - - MYSQL_SERVICE_HOST=db - - MYSQL_SERVICE_DB_NAME=nacos - - MYSQL_SERVICE_PORT=3306 - - MYSQL_SERVICE_USER=root - - MYSQL_SERVICE_PASSWORD=12345678 - - MYSQL_SERVICE_DB_PARAM=characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true - - NACOS_AUTH_ENABLE=true - - NACOS_AUTH_IDENTITY_KEY=nacos - - NACOS_AUTH_IDENTITY_VALUE=nacos - - NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg= - volumes: - - d:/docker-data/nacos-logs:/home/nacos/logs - -networks: - y9-share-net: - external: true - - diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..5f5280e --- /dev/null +++ b/compose.yml @@ -0,0 +1,46 @@ +version: '3.9' +name: y9-dev-environments +services: + db: + image: mysql:latest + container_name: mysql01 + restart: always + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + - y9-share-net + ports: + - "3306:3306" + command: --default-authentication-plugin=caching_sha2_password + environment: + MYSQL_ROOT_PASSWORD: '12345678' + MYSQL_DATABASE: 'y9_public' + volumes: + - d:/docker-data/mysql:/var/lib/mysql + - d:/docker-config/mysql-init:/docker-entrypoint-initdb.d + healthcheck: + #test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] + test: "mysql --user=root --password=12345678 --execute='show databases;'" + interval: 5s + timeout: 10s + retries: 8 + + redis: + image: redis:latest + container_name: redis01 + restart: always + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + - y9-share-net + ports: + - "6379:6379" + command: redis-server --requirepass "12345678" + volumes: + - d:/docker-data/redis:/data + +networks: + y9-share-net: + external: true + + diff --git a/pom.xml b/pom.xml index 040e67d..822e7eb 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.4 + 3.1.5 net.risesoft diff --git a/src/main/java/net/risesoft/demo/Demo01Application.java b/src/main/java/net/risesoft/demo/Demo01Application.java index 02ac729..8b138ac 100644 --- a/src/main/java/net/risesoft/demo/Demo01Application.java +++ b/src/main/java/net/risesoft/demo/Demo01Application.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Demo01Application { -// + public static void main(String[] args) { SpringApplication.run(Demo01Application.class, args); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 79fe63a..2ddc0cd 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -54,4 +54,4 @@ spring: docker: compose: enabled: false - file: docker-dev.yaml + #file: docker-dev.yml