-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·67 lines (57 loc) · 1.72 KB
/
build.sh
File metadata and controls
executable file
·67 lines (57 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -euo pipefail
SERVICES=(
rust-axum spring-graal-jpa spring-graal-jdbc spring-jpa
spring-graal-reactive python-fastapi go-fiber dotnet-mvc dotnet-aot
)
cd "$(dirname "$0")"
# Parse arguments: optional list of services to build
if [ $# -eq 0 ]; then
targets=("${SERVICES[@]}")
else
targets=("${@}")
fi
echo "=== Building ${#targets[@]} service(s) ==="
# 1. Infrastructure (Postgres + migrations)
echo ""
echo "[infra] Starting database and running migrations..."
docker compose up -d postgres
docker compose up migrations # runs migrations then exits
# 2. Build bench client
echo ""
echo "[bench] Building benchmark client..."
(cd bench/client && cargo build --release)
# 3. Build service images
# GraalVM native-image needs ~4GB RAM each, so build those sequentially to avoid OOM.
# All other services can build in parallel.
GRAAL_SERVICES=(spring-graal-jpa spring-graal-jdbc spring-graal-reactive)
parallel=()
sequential=()
for t in "${targets[@]}"; do
is_graal=false
for g in "${GRAAL_SERVICES[@]}"; do
if [ "$t" = "$g" ]; then is_graal=true; break; fi
done
if $is_graal; then
sequential+=("$t")
else
parallel+=("$t")
fi
done
if [ ${#parallel[@]} -gt 0 ]; then
echo ""
echo "[docker] Building non-GraalVM services in parallel..."
docker compose build "${parallel[@]}"
fi
for svc in "${sequential[@]}"; do
echo ""
echo "[docker] Building ${svc} (GraalVM native — sequential to avoid OOM)..."
docker compose build "$svc"
done
# 4. Summary
echo ""
echo "=== Build complete ==="
echo " Services: ${targets[*]}"
echo " Bench client: bench/client/target/release/bench-client"
echo ""
echo "Run ./run.sh to start benchmarking (or ./run.sh rust-axum go-fiber for specific targets)."