Skip to content

GH-454: [DOC][UPDATE] Update Readme and Contribution Guidelines (#453) #66

GH-454: [DOC][UPDATE] Update Readme and Contribution Guidelines (#453)

GH-454: [DOC][UPDATE] Update Readme and Contribution Guidelines (#453) #66

name: Docker Compose Test (Choreo)
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and verify services (Choreo)
run: |
# Build all services
docker compose -f docker-compose-choreo.yml build
# Start all services
echo "Starting all services..."
docker compose -f docker-compose-choreo.yml up -d
# Wait for services to be healthy
echo "Waiting for services to become healthy..."
docker compose -f docker-compose-choreo.yml ps
# Wait for dependencies (databases) to be healthy first
timeout=300
while [ $timeout -gt 0 ]; do
healthy_count=$(docker compose -f docker-compose-choreo.yml ps | grep -c "healthy" || true)
if [ "$healthy_count" -ge 3 ]; then
echo "Dependencies are healthy..."
break
fi
if docker compose -f docker-compose-choreo.yml ps | grep -q "Exit"; then
echo "❌ Some services have failed!"
docker compose -f docker-compose-choreo.yml ps
docker compose -f docker-compose-choreo.yml logs
docker compose -f docker-compose-choreo.yml down
exit 1
fi
echo "Waiting for services to be healthy... ($timeout seconds remaining)"
sleep 5
timeout=$((timeout - 5))
done
if [ $timeout -le 0 ]; then
echo "❌ Timeout waiting for dependencies to be healthy!"
docker compose -f docker-compose-choreo.yml ps
docker compose -f docker-compose-choreo.yml logs
docker compose -f docker-compose-choreo.yml down
exit 1
fi
# Wait for CORE service to become healthy
echo "Waiting for CORE service to become healthy..."
timeout=180
while [ $timeout -gt 0 ]; do
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "healthy"; then
echo "✅ CORE service is healthy!"
break
fi
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "Exit\|unhealthy"; then
echo "❌ CORE service failed!"
docker compose -f docker-compose-choreo.yml logs core-choreo
docker compose -f docker-compose-choreo.yml down
exit 1
fi
sleep 5
timeout=$((timeout - 5))
done
if [ $timeout -le 0 ]; then
echo "❌ CORE service did not become healthy!"
docker compose -f docker-compose-choreo.yml logs core-choreo
docker compose -f docker-compose-choreo.yml down
exit 1
fi
# Wait for Ingestion service to become healthy
echo "Waiting for Ingestion service to become healthy..."
timeout=120
while [ $timeout -gt 0 ]; do
if docker compose -f docker-compose-choreo.yml ps ingestion-choreo | grep -q "healthy"; then
echo "✅ Ingestion service is healthy!"
break
fi
if docker compose -f docker-compose-choreo.yml ps ingestion-choreo | grep -q "Exit\|unhealthy"; then
echo "❌ Ingestion service failed!"
docker compose -f docker-compose-choreo.yml logs ingestion-choreo
docker compose -f docker-compose-choreo.yml down
exit 1
fi
sleep 5
timeout=$((timeout - 5))
done
if [ $timeout -le 0 ]; then
echo "❌ Ingestion service did not become healthy!"
docker compose -f docker-compose-choreo.yml logs ingestion-choreo
docker compose -f docker-compose-choreo.yml down
exit 1
fi
# Wait for Read service to become healthy
echo "Waiting for Read service to become healthy..."
timeout=120
while [ $timeout -gt 0 ]; do
if docker compose -f docker-compose-choreo.yml ps read-choreo | grep -q "healthy"; then
echo "✅ Read service is healthy!"
break
fi
if docker compose -f docker-compose-choreo.yml ps read-choreo | grep -q "Exit\|unhealthy"; then
echo "❌ Read service failed!"
docker compose -f docker-compose-choreo.yml logs read-choreo
docker compose -f docker-compose-choreo.yml down
exit 1
fi
sleep 5
timeout=$((timeout - 5))
done
if [ $timeout -le 0 ]; then
echo "❌ Read service did not become healthy!"
docker compose -f docker-compose-choreo.yml logs read-choreo
docker compose -f docker-compose-choreo.yml down
exit 1
fi
# Final verification - all services should be healthy
echo "=== Final Service Status ==="
docker compose -f docker-compose-choreo.yml ps
echo "=== Service Logs ==="
docker compose -f docker-compose-choreo.yml logs --tail=50
# Verify all services are healthy
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "healthy" && \
docker compose -f docker-compose-choreo.yml ps ingestion-choreo | grep -q "healthy" && \
docker compose -f docker-compose-choreo.yml ps read-choreo | grep -q "healthy"; then
echo "✅ All services (CORE, Ingestion, Read) are healthy and ready!"
else
echo "❌ Not all services are healthy!"
docker compose -f docker-compose-choreo.yml ps
docker compose -f docker-compose-choreo.yml down
exit 1
fi
# Cleanup
docker compose -f docker-compose-choreo.yml down