Skip to content

Commit f2b46d9

Browse files
committed
Create a Github Action to deploy the compose stack
1 parent f4d6651 commit f2b46d9

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Docker Compose Stack Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test-stack:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 15
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Add hosts entries
20+
run: |
21+
echo -e "127.0.0.1 platform.opentdf.local\n127.0.0.1 keycloak.opentdf.local" | sudo tee -a /etc/hosts
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Install Docker Compose
27+
run: |
28+
sudo apt-get update
29+
sudo apt-get install -y docker-compose-plugin
30+
docker compose version
31+
32+
- name: Start Docker Compose stack
33+
working-directory: docs/getting-started
34+
run: |
35+
docker compose up -d
36+
37+
- name: Wait for platform health check
38+
run: |
39+
echo "Waiting for platform to be ready..."
40+
timeout=900 # 15 minutes in seconds
41+
elapsed=0
42+
interval=5
43+
44+
while [ $elapsed -lt $timeout ]; do
45+
echo "Checking health endpoint (${elapsed}s elapsed)..."
46+
47+
# Use -k to allow insecure connections (self-signed cert)
48+
# Use -s for silent mode, -w for response code
49+
response=$(curl -k -s -w "\n%{http_code}" https://platform.opentdf.local:8443/healthz 2>/dev/null || echo "")
50+
51+
if [ -n "$response" ]; then
52+
http_code=$(echo "$response" | tail -n1)
53+
body=$(echo "$response" | head -n1)
54+
55+
echo "HTTP Code: $http_code"
56+
echo "Response Body: $body"
57+
58+
if [ "$http_code" = "200" ] && echo "$body" | grep -q '"status":"SERVING"'; then
59+
echo "✓ Platform is ready!"
60+
exit 0
61+
fi
62+
fi
63+
64+
sleep $interval
65+
elapsed=$((elapsed + interval))
66+
done
67+
68+
echo "✗ Timeout waiting for platform to become ready"
69+
exit 1
70+
71+
- name: Show container logs on failure
72+
if: failure()
73+
working-directory: docs/getting-started
74+
run: |
75+
docker compose ps
76+
docker compose logs

0 commit comments

Comments
 (0)