diff --git a/compose.yml b/compose.yml index 3a05157..3a22736 100644 --- a/compose.yml +++ b/compose.yml @@ -47,8 +47,11 @@ services: - "host.docker.internal:host-gateway" networks: - y9-share-net - volumes: - - d:/docker-data/consul:/bitnami/consul + environment: + - CONSUL_AGENT_MODE=server + - CONSUL_BOOTSTRAP_EXPECT=1 + - CONSUL_ENABLE_UI=true + - CONSUL_HTTP_PORT_NUMBER=8500 ports: - '8300:8300' - '8301:8301' @@ -56,6 +59,8 @@ services: - '8500:8500' - '8600:8600' - '8600:8600/udp' + volumes: + - d:/docker-data/consul:/bitnami/consul networks: y9-share-net: diff --git a/pom.xml b/pom.xml index 822e7eb..bc30243 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,26 @@ Demo project for Spring Boot 17 + 2022.0.4 + + + + + com.ecwid.consul + consul-api + 1.4.5 + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + org.springframework.boot @@ -57,11 +76,11 @@ runtime - + + org.springframework.cloud + spring-cloud-starter-consul-discovery + + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2ddc0cd..a63a03b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -29,12 +29,25 @@ server: spring: application: name: demo01 + cloud: + consul: + host: localhost + port: 8500 + discovery: + register-health-check: true + healthCheckPath: ${server.servlet.context-path}/actuator/health + healthCheckInterval: 15s + metadata: + metrics: ${server.servlet.context-path}/actuator/prometheus + springboot: true + isv: risesoft + tags: test,y9 datasource: driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/y9_public?serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&useUnicode=true&characterEncoding=utf-8&rewriteBatchedStatements=true&useCompression=true&useSSL=false&allowPublicKeyRetrieval=true username: root password: '12345678' - hikari: + hikari: maximumPoolSize: 20 minimumIdle: 1 jpa: