piomin / sample-spring-microservices-new

Demo for Spring Boot 3(`master` branch)/2(other branches) and Spring Cloud microservices with distributed configuration (Spring Cloud Config), service discovery (Eureka), API gateway (Spring Cloud Gateway, Zuul), Swagger/OpenAPI documentation (Springdoc), logs correlation using Spring Cloud Sleuth/Micrometer OTEL and many more
https://piotrminkowski.com
1.17k stars 744 forks source link

whay jib is used for config-service #86

Closed afattahi54 closed 11 months ago

afattahi54 commented 11 months ago

The readme file mentioned that

we need ji for config-service since it contains curl

Can you describe it more please

piomin commented 11 months ago

In the docker-compose.yml I have the following entry with a health check verification:

  config-service:
    image: piomin/config-service:1.1-SNAPSHOT
    ports:
      - "8088:8088"
    healthcheck:
      test: curl --fail http://localhost:8088/employee/docker  || exit 1
      interval: 5s
      timeout: 2s
      retries: 3

I need it to first verify that config-server container is running, before I'll start another containers. Tha't why I need curl inside that container. For example, Paketo Buildpacks Java images don't have curl installed.

afattahi54 commented 11 months ago

Thanks, just a comment

When I run curl http://127.0.0.1:8088/employee/docker I get :

{"name":"employee","profiles":["docker"],"label":null,"version":null,"state":null,"propertySources":[]}

This shows that the server is up and running. But, is it better to use some thing like curl http://127.0.0.1:8088/employee-service/docker, which returns better results:

{"name":"employee-service","profiles":["docker"],"label":null,"version":null,"state":null,"propertySources":[{"name":"classpath:/config/employee-service-docker.yml","source":{"server.port":8080,"eureka.client.serviceUrl.defaultZone":"http://discovery-service:8061/eureka/","eureka.instance.hostname":"employee-service","logging.pattern.console":"%d{yyyy-MM-dd HH:mm:ss} [%X{traceId:-},%X{spanId:-}] ${LOG_LEVEL_PATTERN:-%5p} %m%n","springdoc.packagesToScan":"pl.piomin.services.employee","spring.output.ansi.enabled":"always","management.tracing.sampling.probability":1.0,"management.zipkin.tracing.endpoint":"http://zipkin:9411/api/v2/spans"}},{"name":"classpath:/config/employee-service.yml","source":{"server.port":0,"eureka.client.serviceUrl.defaultZone":"http://localhost:8061/eureka/","logging.pattern.console":"%d{yyyy-MM-dd HH:mm:ss} [%X{traceId:-},%X{spanId:-}] ${LOG_LEVEL_PATTERN:-%5p} %m%n","springdoc.packagesToScan":"pl.piomin.services.employee","spring.output.ansi.enabled":"always","management.tracing.sampling.probability":1.0}}]}