Skip to content

Commit 5ff94eb

Browse files
authored
Refactor choreo docker (#423)
* Fix choreo neo4j dockerfiles for rancher setup * Update choreo mongodb dockerfiles for rancher setup * Update choreo mongodb dockerfiles with new backup path * Update choreo neo4j dockerfiles with new backup path * Fix choreo postgres dockerfiles for rancher setup * Update choreo core dockerfiles for rancher setup * Update choreo ingestion dockerfiles for rancher setup * Update choreo read dockerfiles for rancher setup * Update choreo e2e dockerfiles for rancher setup * Create admin user for mongodb choreo dockerfile * Update choreo deployment readme * Refactor MongoDB admin user creation in choreo Dockerfile. * Refactor MongoDB admin user creation command in choreo Dockerfile * Add CI workflows for CORE, Ingestion, Read, and Docker Compose tests in Choreo * Update deployment documentation * Enhance CI workflow for Read service in Choreo: rename build step, improve health check logic, and add service verification steps. * Refactor CI workflows for CORE and Ingestion services in Choreo * Refactor MongoDB admin user creation command in Dockerfile to use here-string syntax for improved security
1 parent 12043a3 commit 5ff94eb

File tree

11 files changed

+599
-21
lines changed

11 files changed

+599
-21
lines changed
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: CORE API Test (Choreo)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'opengin/core-api/**'
8+
- 'opengin/core-api/docker/Dockerfile.choreo'
9+
- 'docker-compose-choreo.yml'
10+
pull_request:
11+
branches: [ main ]
12+
paths:
13+
- 'opengin/core-api/**'
14+
- 'opengin/core-api/docker/Dockerfile.choreo'
15+
- 'docker-compose-choreo.yml'
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Build and verify CORE service (Choreo)
28+
run: |
29+
# Build CORE service
30+
docker compose -f docker-compose-choreo.yml build core-choreo
31+
32+
# Start required dependencies
33+
docker compose -f docker-compose-choreo.yml up -d mongodb-choreo neo4j-choreo postgres-choreo
34+
35+
# Wait for dependencies to be healthy
36+
echo "Waiting for MongoDB, Neo4j and Postgres to be healthy..."
37+
docker compose -f docker-compose-choreo.yml ps
38+
39+
# Wait for dependencies to be ready (with timeout)
40+
timeout 300 bash -c 'until docker compose -f docker-compose-choreo.yml ps | grep -q "healthy"; do echo "Waiting for services to be healthy..."; sleep 5; done'
41+
42+
# Start CORE service in detached mode
43+
echo "Starting CORE service (Choreo deployment)..."
44+
docker compose -f docker-compose-choreo.yml up -d core-choreo
45+
46+
# Wait for CORE service to become healthy
47+
echo "Waiting for CORE service to become healthy..."
48+
timeout=180
49+
while [ $timeout -gt 0 ]; do
50+
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "healthy"; then
51+
echo "✅ CORE service is healthy!"
52+
break
53+
fi
54+
# Check if service has failed
55+
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "Exit\|unhealthy"; then
56+
echo "❌ CORE service failed to start or became unhealthy!"
57+
echo "Container logs:"
58+
docker compose -f docker-compose-choreo.yml logs core-choreo
59+
docker compose -f docker-compose-choreo.yml down
60+
exit 1
61+
fi
62+
echo "Waiting for CORE service to be healthy... ($timeout seconds remaining)"
63+
sleep 5
64+
timeout=$((timeout - 5))
65+
done
66+
67+
if [ $timeout -le 0 ]; then
68+
echo "❌ Timeout waiting for CORE service to become healthy!"
69+
echo "Service status:"
70+
docker compose -f docker-compose-choreo.yml ps core-choreo
71+
echo "Container logs:"
72+
docker compose -f docker-compose-choreo.yml logs core-choreo
73+
docker compose -f docker-compose-choreo.yml down
74+
exit 1
75+
fi
76+
77+
# Verify service started successfully - check logs for known startup message
78+
echo "Verifying service started successfully..."
79+
if docker compose -f docker-compose-choreo.yml logs core-choreo | grep -q "=== Starting CORE Service (Choreo Environment) ==="; then
80+
echo "✅ CORE service startup message found in logs!"
81+
else
82+
echo "⚠️ Could not find expected startup message in logs, but service is healthy"
83+
fi
84+
85+
echo "=== CORE Service Logs ==="
86+
docker compose -f docker-compose-choreo.yml logs core-choreo
87+
88+
echo "=== Service Status ==="
89+
docker compose -f docker-compose-choreo.yml ps core-choreo
90+
91+
# Final verification - service should be healthy at this point
92+
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "healthy"; then
93+
echo "✅ CORE API service (Choreo) is healthy and ready!"
94+
else
95+
echo "❌ CORE service is not healthy!"
96+
docker compose -f docker-compose-choreo.yml down
97+
exit 1
98+
fi
99+
100+
# Cleanup
101+
docker compose -f docker-compose-choreo.yml down
102+
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Docker Compose Test (Choreo)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v2
18+
19+
- name: Build and verify services (Choreo)
20+
run: |
21+
# Build all services
22+
docker compose -f docker-compose-choreo.yml build
23+
24+
# Start all services
25+
echo "Starting all services..."
26+
docker compose -f docker-compose-choreo.yml up -d
27+
28+
# Wait for services to be healthy
29+
echo "Waiting for services to become healthy..."
30+
docker compose -f docker-compose-choreo.yml ps
31+
32+
# Wait for dependencies (databases) to be healthy first
33+
timeout=300
34+
while [ $timeout -gt 0 ]; do
35+
healthy_count=$(docker compose -f docker-compose-choreo.yml ps | grep -c "healthy" || true)
36+
if [ "$healthy_count" -ge 3 ]; then
37+
echo "Dependencies are healthy..."
38+
break
39+
fi
40+
if docker compose -f docker-compose-choreo.yml ps | grep -q "Exit"; then
41+
echo "❌ Some services have failed!"
42+
docker compose -f docker-compose-choreo.yml ps
43+
docker compose -f docker-compose-choreo.yml logs
44+
docker compose -f docker-compose-choreo.yml down
45+
exit 1
46+
fi
47+
echo "Waiting for services to be healthy... ($timeout seconds remaining)"
48+
sleep 5
49+
timeout=$((timeout - 5))
50+
done
51+
52+
if [ $timeout -le 0 ]; then
53+
echo "❌ Timeout waiting for dependencies to be healthy!"
54+
docker compose -f docker-compose-choreo.yml ps
55+
docker compose -f docker-compose-choreo.yml logs
56+
docker compose -f docker-compose-choreo.yml down
57+
exit 1
58+
fi
59+
60+
# Wait for CORE service to become healthy
61+
echo "Waiting for CORE service to become healthy..."
62+
timeout=180
63+
while [ $timeout -gt 0 ]; do
64+
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "healthy"; then
65+
echo "✅ CORE service is healthy!"
66+
break
67+
fi
68+
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "Exit\|unhealthy"; then
69+
echo "❌ CORE service failed!"
70+
docker compose -f docker-compose-choreo.yml logs core-choreo
71+
docker compose -f docker-compose-choreo.yml down
72+
exit 1
73+
fi
74+
sleep 5
75+
timeout=$((timeout - 5))
76+
done
77+
78+
if [ $timeout -le 0 ]; then
79+
echo "❌ CORE service did not become healthy!"
80+
docker compose -f docker-compose-choreo.yml logs core-choreo
81+
docker compose -f docker-compose-choreo.yml down
82+
exit 1
83+
fi
84+
85+
# Wait for Ingestion service to become healthy
86+
echo "Waiting for Ingestion service to become healthy..."
87+
timeout=120
88+
while [ $timeout -gt 0 ]; do
89+
if docker compose -f docker-compose-choreo.yml ps ingestion-choreo | grep -q "healthy"; then
90+
echo "✅ Ingestion service is healthy!"
91+
break
92+
fi
93+
if docker compose -f docker-compose-choreo.yml ps ingestion-choreo | grep -q "Exit\|unhealthy"; then
94+
echo "❌ Ingestion service failed!"
95+
docker compose -f docker-compose-choreo.yml logs ingestion-choreo
96+
docker compose -f docker-compose-choreo.yml down
97+
exit 1
98+
fi
99+
sleep 5
100+
timeout=$((timeout - 5))
101+
done
102+
103+
if [ $timeout -le 0 ]; then
104+
echo "❌ Ingestion service did not become healthy!"
105+
docker compose -f docker-compose-choreo.yml logs ingestion-choreo
106+
docker compose -f docker-compose-choreo.yml down
107+
exit 1
108+
fi
109+
110+
# Wait for Read service to become healthy
111+
echo "Waiting for Read service to become healthy..."
112+
timeout=120
113+
while [ $timeout -gt 0 ]; do
114+
if docker compose -f docker-compose-choreo.yml ps read-choreo | grep -q "healthy"; then
115+
echo "✅ Read service is healthy!"
116+
break
117+
fi
118+
if docker compose -f docker-compose-choreo.yml ps read-choreo | grep -q "Exit\|unhealthy"; then
119+
echo "❌ Read service failed!"
120+
docker compose -f docker-compose-choreo.yml logs read-choreo
121+
docker compose -f docker-compose-choreo.yml down
122+
exit 1
123+
fi
124+
sleep 5
125+
timeout=$((timeout - 5))
126+
done
127+
128+
if [ $timeout -le 0 ]; then
129+
echo "❌ Read service did not become healthy!"
130+
docker compose -f docker-compose-choreo.yml logs read-choreo
131+
docker compose -f docker-compose-choreo.yml down
132+
exit 1
133+
fi
134+
135+
# Final verification - all services should be healthy
136+
echo "=== Final Service Status ==="
137+
docker compose -f docker-compose-choreo.yml ps
138+
139+
echo "=== Service Logs ==="
140+
docker compose -f docker-compose-choreo.yml logs --tail=50
141+
142+
# Verify all services are healthy
143+
if docker compose -f docker-compose-choreo.yml ps core-choreo | grep -q "healthy" && \
144+
docker compose -f docker-compose-choreo.yml ps ingestion-choreo | grep -q "healthy" && \
145+
docker compose -f docker-compose-choreo.yml ps read-choreo | grep -q "healthy"; then
146+
echo "✅ All services (CORE, Ingestion, Read) are healthy and ready!"
147+
else
148+
echo "❌ Not all services are healthy!"
149+
docker compose -f docker-compose-choreo.yml ps
150+
docker compose -f docker-compose-choreo.yml down
151+
exit 1
152+
fi
153+
154+
# Cleanup
155+
docker compose -f docker-compose-choreo.yml down

0 commit comments

Comments
 (0)