Files
attack-defense-platform/panel/fix_sidecars.sh
T

33 lines
964 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Bring up only the MISSING sidecars of each team (compose default `up -d`
# would also rebuild the 16 main services, which is slow and unnecessary).
set -uo pipefail
BASE=/opt/gemastik18-final
cd "$BASE/panel"
for t in 1 2 3 4; do
missing=$(python3 -c "
import sys; sys.path.insert(0,'.')
import teams
print(' '.join(teams.missing_sidecars($t)))
" 2>/dev/null)
if [ -z "$missing" ]; then
echo "team$t: nothing missing"
continue
fi
echo "team$t missing: $missing"
# map container name -> compose service name
for cont in $missing; do
svc=${cont#team${t}-}
svc=${svc%-1}
echo " starting $svc"
(cd "$BASE/teams/team$t/services" && \
docker compose -p "team$t" -f docker-compose.yml up -d --no-deps "$svc" 2>&1 | tail -2)
done
done
echo "=== verify ==="
python3 -c "
import sys; sys.path.insert(0,'.')
import teams
for i in (1,2,3,4):
print('team%d still missing:' % i, teams.missing_sidecars(i))
"