In the case of a JHipster microservices architecture, I run an UAA server named AuthServer in a docker container and the Jhipster registry in another container.
The docker containers run in the same user-bridge network configuration.
As the registry is not in the same container, I configured my UAA server to connect to jhipster-registry machine in my application.yml file
eureka:
instance:
prefer-ip-address: true
client:
service-url:
defaultZone: http://admin:${jhipster.registry.password}@jhipster-registry:8761/eureka/
The same way, I used this in the bootstrap.yml file :
spring:
cloud:
config:
fail-fast: true
retry:
initial-interval: 1000
max-interval: 2000
max-attempts: 100
uri: http://admin:${jhipster.registry.password}@jhipster-registry:8761/config
And finally in my docker-compose file, I also used
version: '3.3'
services:
authserver-app:
image: authserver
environment:
- _JAVA_OPTIONS=-Xmx512m -Xms256m
- SPRING_PROFILES_ACTIVE=prod,swagger
- EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/eureka
- SPRING_CLOUD_CONFIG_URI=http://admin:$${jhipster.registry.password}@jhipster-registry:8761/config
- SPRING_DATASOURCE_URL=jdbc:postgresql://authserver-postgresql:5432/AuthServer
- JHIPSTER_SLEEP=10 # gives time for the JHipster Registry to boot before the application
But when I start the application AuthServer, it keeps on trying to connect to localhost
authserver-app_1 | 2019-01-04 18:07:39.134 DEBUG 1 --- [ restartedMain] c.n.d.s.r.aws.ConfigClusterResolver : Config resolved to [AwsEndpoint{ serviceUrl='http://admin:admin@localhost:8761/eureka/', region='us-east-1', zone='defaultZone'}]
authserver-app_1 | 2019-01-04 18:07:39.141 DEBUG 1 --- [ restartedMain] c.n.d.s.r.a.ZoneAffinityClusterResolver : Local zone=defaultZone; resolved to: [AwsEndpoint{ serviceUrl='http://admin:admin@localhost:8761/eureka/', region='us-east-1', zone='defaultZone'}]
Where does this configuration about localhost come from and how can I fix it?