Question

Eureka server dashboard give me "... does not allow the connection ERR_CONNECTION_REFUSED".

Posted April 2, 2020 137 views
Networking

Hello everyone,

I’m setting up microservices with docker using spring boot and eureka-server. I did a docker-compose -f docker-compose.prod.yml up -d –build with the following docker compose file :

# Run docker-compose build
# Run docker-compose up
# Live long and prosper

version: "2"

services:

  postgres:
    container_name: postgres
    image: postgres
    build:
      context: .
      dockerfile: ./postgres.prod.dockerfile
    networks:
      - helenos-network

  tomcat-eureka-server:
    container_name: tomcat-eureka-server
    image: tomcat-eureka-server
    build:
      context: ./eureka-server
      dockerfile: tomcat-eureka.prod.dockerfile
    ports:
      - "8761:8761"
    expose:
    - "8761"
    networks:
      - helenos-network
    environment:
      - JAVA_OPTS=
        -Dspring.profiles.active=prod

  tomcat-zuul-server:
    container_name: tomcat-zuul-server
    image: tomcat-zuul-server
    build:
      context: ./zuul-server
      dockerfile: tomcat-zuul.prod.dockerfile
    ports:
      - "8762:8762"
    depends_on: 
      - postgres
      - tomcat-eureka-server
    networks:
      - helenos-network
    environment:
      - JAVA_OPTS=
        -Dspring.profiles.active=prod

  tomcat-file:
    container_name: tomcat-file-server
    image: tomcat-file-server
    build:
      context: ./file
      dockerfile: tomcat-file.prod.dockerfile
    ports:
      - "8205:8205"
    depends_on: 
      - tomcat-eureka-server
      - tomcat-zuul-server
    networks:
      - helenos-network
    environment:
      - JAVA_OPTS=
        -Dspring.profiles.active=prod

  tomcat-user:
    container_name: tomcat-user-server
    image: tomcat-user-server
    build:
      context: ./user
      dockerfile: tomcat-user.prod.dockerfile
    ports:
      - "8203:8203"
    depends_on: 
      - tomcat-eureka-server
      - tomcat-zuul-server
    networks:
      - helenos-network
    environment:
      - JAVA_OPTS=
        -Dspring.profiles.active=prod

  tomcat-media:
    container_name: tomcat-media-server
    image: tomcat-media-server
    build:
      context: ./media
      dockerfile: tomcat-media.prod.dockerfile
    ports:
      - "8204:8204"
    depends_on: 
      - tomcat-eureka-server
      - tomcat-zuul-server
    networks:
      - helenos-network
    environment:
      - JAVA_OPTS=
        -Dspring.profiles.active=prod

  tomcat-library:
    container_name: tomcat-library-server
    image: tomcat-library-server
    build:
      context: ./library
      dockerfile: tomcat-library.prod.dockerfile
    ports:
      - "8201:8201"
    depends_on: 
      - tomcat-eureka-server
      - tomcat-zuul-server
    networks:
      - helenos-network
    environment:
      - JAVA_OPTS=
        -Dspring.profiles.active=prod

  nginx:
    container_name: nginx-helenos
    image: nginx-helenos
    build:
     context: ./frontend
     dockerfile:  nginx.prod.dockerfile
    ports:
      - "4200:80"
      - "443:443"
    depends_on:
      - tomcat-zuul-server
    networks:
      - helenos-network

networks:
  helenos-network:
    driver: bridge

Then I can see that my containers are running doing docker ps and when I look the logs for the eureka server it seems like everything is working great. The logs are :

02-Apr-2020 21:00:55.760 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/9.0.20
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: May 3 2019 22:26:00 UTC
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 9.0.20.0
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 4.15.0-58-generic
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-1.8-openjdk/jre
02-Apr-2020 21:00:55.766 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_212-b04
02-Apr-2020 21:00:55.767 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: IcedTea
02-Apr-2020 21:00:55.767 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /usr/local/tomcat
02-Apr-2020 21:00:55.767 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /usr/local/tomcat
02-Apr-2020 21:00:55.773 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
02-Apr-2020 21:00:55.774 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
02-Apr-2020 21:00:55.774 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dspring.profiles.active=prod
02-Apr-2020 21:00:55.774 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
02-Apr-2020 21:00:55.774 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
02-Apr-2020 21:00:55.774 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
02-Apr-2020 21:00:55.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
02-Apr-2020 21:00:55.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
02-Apr-2020 21:00:55.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
02-Apr-2020 21:00:55.775 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
02-Apr-2020 21:00:55.775 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
02-Apr-2020 21:00:55.775 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
02-Apr-2020 21:00:55.776 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
02-Apr-2020 21:00:55.787 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1b 26 Feb 2019]
02-Apr-2020 21:00:56.190 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
02-Apr-2020 21:00:56.230 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
02-Apr-2020 21:00:56.233 INFO [main] org.apache.catalina.startup.Catalina.load Server initialization in [774] milliseconds
02-Apr-2020 21:00:56.283 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
02-Apr-2020 21:00:56.283 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/9.0.20]
02-Apr-2020 21:00:56.318 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/local/tomcat/webapps/ROOT.war]

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.5.RELEASE)

2020-04-02 21:01:15.611 INFO 1 --- [ main] c.h.e.EurekaServerApplication : The following profiles are active: prod
2020-04-02 21:01:21.007 WARN 1 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-04-02 21:01:22.032 INFO 1 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=4b517493-872b-3c3d-bf8d-3f12aba7c8a1
2020-04-02 21:01:22.968 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 7280 ms
2020-04-02 21:01:23.912 WARN 1 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-04-02 21:01:23.928 INFO 1 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-04-02 21:01:24.010 INFO 1 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@6028e183
2020-04-02 21:01:28.382 WARN 1 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-04-02 21:01:28.382 INFO 1 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-04-02 21:01:30.082 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-04-02 21:01:33.099 WARN 1 --- [ main] ockingLoadBalancerClientRibbonWarnLogger : You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
2020-04-02 21:01:34.511 INFO 1 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2020-04-02 21:01:34.867 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2020-04-02 21:01:34.877 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data.
2020-04-02 21:01:34.972 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1585861294954 with initial instances count: 0
2020-04-02 21:01:35.730 INFO 1 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initializing ...
2020-04-02 21:01:35.733 INFO 1 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://tomcat-eureka-server:8761/eureka/]
2020-04-02 21:01:36.504 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2020-04-02 21:01:36.520 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2020-04-02 21:01:36.532 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2020-04-02 21:01:36.533 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2020-04-02 21:01:38.128 INFO 1 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://tomcat-eureka-server:8761/eureka/
2020-04-02 21:01:38.174 INFO 1 --- [ main] c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
2020-04-02 21:01:38.185 INFO 1 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initialized
2020-04-02 21:01:38.293 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-04-02 21:01:38.566 INFO 1 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application EUREKA-SERVER with eureka with status UP
2020-04-02 21:01:38.598 INFO 1 --- [ Thread-15] o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
2020-04-02 21:01:38.681 INFO 1 --- [ Thread-15] o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default
2020-04-02 21:01:38.682 INFO 1 --- [ Thread-15] o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test
2020-04-02 21:01:38.700 INFO 1 --- [ main] c.h.e.EurekaServerApplication : Started EurekaServerApplication in 29.797 seconds (JVM running for 43.68)
2020-04-02 21:01:39.008 INFO 1 --- [ Thread-15] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false
2020-04-02 21:01:39.027 INFO 1 --- [ Thread-15] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context
2020-04-02 21:01:39.032 INFO 1 --- [ Thread-15] c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node
2020-04-02 21:01:39.032 INFO 1 --- [ Thread-15] c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1
2020-04-02 21:01:39.033 INFO 1 --- [ Thread-15] c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP
2020-04-02 21:01:39.089 INFO 1 --- [ Thread-15] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
02-Apr-2020 21:01:39.326 INFO [main] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
02-Apr-2020 21:01:39.640 INFO [main] com.sun.jersey.server.impl.application.WebApplicationImpl._initiate Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2020-04-02 21:01:39.859 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2020-04-02 21:01:39.859 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2020-04-02 21:01:39.859 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2020-04-02 21:01:39.859 INFO 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
02-Apr-2020 21:01:42.070 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/local/tomcat/webapps/ROOT.war] has finished in [45,752] ms
02-Apr-2020 21:01:42.089 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/host-manager]
02-Apr-2020 21:01:42.198 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/host-manager] has finished in [109] ms
02-Apr-2020 21:01:42.212 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/manager]
02-Apr-2020 21:01:42.293 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/manager] has finished in [80] ms
02-Apr-2020 21:01:42.296 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/docs]
02-Apr-2020 21:01:42.365 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [69] ms
02-Apr-2020 21:01:42.368 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples]
02-Apr-2020 21:01:44.861 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/examples] has finished in [2,493] ms
02-Apr-2020 21:01:44.871 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
02-Apr-2020 21:01:45.078 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
02-Apr-2020 21:01:45.207 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [48,973] milliseconds

When I do sudo lsof -i -P -n | grep LISTEN I can see that the port 8761 (port of my eureka-server ) is indeed listening.

Also I have added a firewal in my droplet with a inbound rule on the port 8761. Moreover I did a sudo ufw allow 8761 in the droplet to allow port 8761.

Despite all this when trying to acces my eureka server dashboard at droplet-ip-address:8761 using the browser I get “… does not allow the connection ERRCONNECTIONREFUSED”.

Can someone tell me what I am doing wrong ? Thanks in advance.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!