title: Deploy spring boot microservices to heroku
body: <p>I am trying to deploy my microservices to heroku but without success. At first I created application for service registry (eureka) with following configuration:</p>
  
  <pre><code>spring:
    application:
      name: eureka
  
  server:
    port: 8761
  
  eureka:
    instance:
      hostname: localhost
    client:
      registerWithEureka: false
      fetchRegistry: false
      serviceUrl:
        defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
  </code></pre>
  
  <p>Next I deploy application, url of deployed app is like <a href="https://eureka.herokuapp.com" rel="nofollow noreferrer">https://eureka.herokuapp.com</a>. I configure with this url my other apps like gateway and business services.</p>
  
  <p>Example of my gateway configuration</p>
  
  <pre><code>spring:
    application:
      name: gateway
  server:
    port: 8081
  
  eureka:
    client:
      healthcheck:
        enabled: true
      serviceUrl:
        defaultZone: https://eureka.herokuapp.com/eureka/
  </code></pre>
  
  <p>same configuration I used for my user service, just different app name (user-service). When I go to <code>https://gateway.herokuapp.com/user-service/user</code> I cannot receive any response. In heroku logs of gateway app I can see exception because of timeout of user service which I don't understand because when I call <code>https://user.herokuapp.com/user</code> directly I get response</p>
  
  <p>I also find out in my eureka dashboard is not registered replicas, I am not sure if it ok. Can you tell me what I did wrong? Thank you.</p>
  
  <p><a href="https://i.stack.imgur.com/ZdkyN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZdkyN.png" alt="enter image description here"></a></p>
  
  <p>error log from gateway app:</p>
  
  <blockquote>
    <p>2019-12-01T19:53:29.503419+00:00 heroku[router]: at=info method=GET
    path="/user-service/user" host=gateway.herokuapp.com
    request_id=7818f5eb-34af-47f9-94db-7dc4f9609c31 fwd="86.49.253.78"
    dyno=web.1 connect=0ms service=8110ms status=500 bytes=465
    protocol=https</p>
  </blockquote>