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
27 lines
939 B
Bash
Executable File
27 lines
939 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Starts the six services as plain jars, in dependency order, and waits until each one answers.
|
|
# Logs: run/logs/<service>.log PIDs: run/<service>.pid (stop with scripts/stop.sh)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
mkdir -p run/logs
|
|
unset JAVA_TOOL_OPTIONS
|
|
|
|
start() { # service port
|
|
local name=$1 port=$2
|
|
nohup java -Xmx200m -XX:+UseSerialGC -jar "$name/target/$name-1.0.0.jar" > "run/logs/$name.log" 2>&1 &
|
|
echo $! > "run/$name.pid"
|
|
for _ in $(seq 1 90); do
|
|
if curl -fs "http://localhost:$port/actuator/health" >/dev/null 2>&1; then echo "$name up on :$port"; return; fi
|
|
sleep 1
|
|
done
|
|
echo "$name did not come up; see run/logs/$name.log" >&2; exit 1
|
|
}
|
|
|
|
# the config server must be first: the others read their config from it at startup
|
|
start config-server 8888
|
|
start discovery-server 8761
|
|
start product-service 8081
|
|
start inventory-service 8083
|
|
start order-service 8082
|
|
start gateway 8080
|