#!/usr/bin/env bash # Starts the six services as plain jars, in dependency order, and waits until each one answers. # Logs: run/logs/.log PIDs: run/.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