From 95d0fc9b229d1c51b716e5bf13281e265f32aa33 Mon Sep 17 00:00:00 2001 From: hirst Date: Wed, 5 Jun 2024 09:21:28 +0200 Subject: [PATCH] updated docker profiles --- docker-compose.yml | 13 +++++-------- dummy/src/main/resources/application-docker.yml | 9 ++++++++- dummy/src/main/resources/application.yml | 4 +--- eureka/src/main/resources/application-docker.yml | 9 +++++++++ gateway/src/main/resources/application-docker.yml | 9 ++++++++- 5 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 eureka/src/main/resources/application-docker.yml diff --git a/docker-compose.yml b/docker-compose.yml index aaa5652..e20dec0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ + + version: "3" # https://scribe.rip/@kadampritesh46/microservices-part-4-dockerization-and-beyond-55693a2419e7 networks: @@ -12,10 +14,7 @@ services: networks: - learningpulse environment: - - spring.application.name=eureka-server - - eureka.client.registerWithEureka=false - - eureka.client.fetchRegistry=false - - eureka.server.waitTimeInMsWhenSyncEmpty=0 + - SPRING_PROFILES_ACTIVE=docker # to test # curl http://admin:admin@localhost:8181/api/v1/dummy/test -v; @@ -27,8 +26,7 @@ services: networks: - learningpulse environment: - - eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka - - eureka.instance.preferIpAddress=true + - SPRING_PROFILES_ACTIVE=docker gateway: image: git.4o1x5.dev/learningpulse/server/gateway:dev @@ -41,8 +39,7 @@ services: networks: - learningpulse environment: - - eureka.instance.preferIpAddress=true - - eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka + - SPRING_PROFILES_ACTIVE=docker # # TODO once implemented into gateway # keycloak: diff --git a/dummy/src/main/resources/application-docker.yml b/dummy/src/main/resources/application-docker.yml index a1d77c1..cd845aa 100644 --- a/dummy/src/main/resources/application-docker.yml +++ b/dummy/src/main/resources/application-docker.yml @@ -1,2 +1,9 @@ app: - eureka-server: eureka \ No newline at end of file + eureka: eureka-server + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://${app.eureka}:8761/eureka \ No newline at end of file diff --git a/dummy/src/main/resources/application.yml b/dummy/src/main/resources/application.yml index cce5faa..edae6f7 100644 --- a/dummy/src/main/resources/application.yml +++ b/dummy/src/main/resources/application.yml @@ -27,9 +27,7 @@ management: eureka: client: service-url: - #defaultZone: http://localhost:8761/eureka - # Will only work when docker is used - defaultZone: http://eureka-server:8761/eureka + defaultZone: http://localhost:8761/eureka logging: file: diff --git a/eureka/src/main/resources/application-docker.yml b/eureka/src/main/resources/application-docker.yml new file mode 100644 index 0000000..9d7e1cf --- /dev/null +++ b/eureka/src/main/resources/application-docker.yml @@ -0,0 +1,9 @@ +spring: + application: + name: eureka-server +eureka: + client: + register-with-eureka: false + fetch-registry: false + server: + wait-time-in-ms-when-sync-empty: 0 diff --git a/gateway/src/main/resources/application-docker.yml b/gateway/src/main/resources/application-docker.yml index a1d77c1..199b173 100644 --- a/gateway/src/main/resources/application-docker.yml +++ b/gateway/src/main/resources/application-docker.yml @@ -1,2 +1,9 @@ app: - eureka-server: eureka \ No newline at end of file + eureka-server: eureka + +eureka: + instance: + prefer-ip-address: true + client: + service-url: + defaultZone: http://${app.eureka-server}:8761/eureka \ No newline at end of file -- 2.44.1