Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ops/deploy/deploy-leaderboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ fi
echo "[1/3] Pulling latest GHCR image..."
docker compose --project-directory "${PROJECT_ROOT}" "${ENV_ARGS[@]}" -f "${COMPOSE_FILE}" pull

# Check if worker container is running and an active calculation is in progress
# Check if worker container exists and an active calculation is in progress
CONTAINER_NAME="devimpact-leaderboard-cron"
if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then
echo "[2/3] Checking for active leaderboard calculation..."
while docker exec "${CONTAINER_NAME}" pgrep -f "calculate-next-country" > /dev/null 2>&1 || \
docker exec "${CONTAINER_NAME}" sh -c 'ps aux | grep -v grep | grep -q "calculate-next-country"'; do
docker exec "${CONTAINER_NAME}" sh -c 'ps aux | grep -v grep | grep -q "calculate-next-country"' > /dev/null 2>&1; do
echo " >> A leaderboard calculation job is currently running. Waiting for it to finish..."
sleep 10
done
echo " >> No active calculation running (or active calculation completed)."
echo " >> Removing previous container to prevent name conflicts..."
docker stop "${CONTAINER_NAME}" > /dev/null 2>&1 || true
docker rm -f "${CONTAINER_NAME}" > /dev/null 2>&1 || true
else
echo "[2/3] Worker container is not running yet."
fi
Expand Down
2 changes: 2 additions & 0 deletions ops/docker/leaderboard-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: devimpact-leaderboard

services:
leaderboard-cron:
image: ${LEADERBOARD_IMAGE:-ghcr.io/o2sa/devimpact-leaderboard:latest}
Expand Down
Loading