Product, order and inventory services behind Spring Cloud Gateway (WebMVC), configuration from a Config Server, discovery with Eureka, a Resilience4j circuit breaker on order -> inventory and Brave tracing. Run as six plain jars; output/ holds real transcripts (config, registry, requests, trace propagation, circuit breaker, startup race and the load-balanced RestClient.Builder trap). Dockerfile and docker-compose.yml are included but were not run. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HhW8LD8r3EigoBaCGrQZx5
40 lines
1.7 KiB
YAML
40 lines
1.7 KiB
YAML
# All six services on one network: mvn -DskipTests package && docker compose up --build
|
|
# NOT RUN when this repository was written (no Docker in the sandbox). The same system was run as plain jars with
|
|
# scripts/start.sh, and everything in output/ comes from that. Inside the compose network the services reach each
|
|
# other by service name, so only the three environment variables below differ from the jar run.
|
|
x-service: &service
|
|
restart: on-failure # a service that starts before the config server is up exits and is retried
|
|
environment: &env
|
|
CONFIG_URL: http://config-server:8888
|
|
EUREKA_URL: http://discovery-server:8761/eureka
|
|
|
|
services:
|
|
config-server:
|
|
build: { context: ., args: { SERVICE: config-server } }
|
|
ports: ["8888:8888"]
|
|
discovery-server:
|
|
build: { context: ., args: { SERVICE: discovery-server } }
|
|
ports: ["8761:8761"]
|
|
environment: { EUREKA_HOSTNAME: discovery-server }
|
|
product-service:
|
|
<<: *service
|
|
build: { context: ., args: { SERVICE: product-service } }
|
|
environment: { <<: *env, EUREKA_HOSTNAME: product-service }
|
|
depends_on: [config-server, discovery-server]
|
|
inventory-service:
|
|
<<: *service
|
|
build: { context: ., args: { SERVICE: inventory-service } }
|
|
environment: { <<: *env, EUREKA_HOSTNAME: inventory-service }
|
|
depends_on: [config-server, discovery-server]
|
|
order-service:
|
|
<<: *service
|
|
build: { context: ., args: { SERVICE: order-service } }
|
|
environment: { <<: *env, EUREKA_HOSTNAME: order-service }
|
|
depends_on: [config-server, discovery-server]
|
|
gateway:
|
|
<<: *service
|
|
build: { context: ., args: { SERVICE: gateway } }
|
|
environment: { <<: *env, EUREKA_HOSTNAME: gateway }
|
|
ports: ["8080:8080"]
|
|
depends_on: [config-server, discovery-server]
|