-
-
Notifications
You must be signed in to change notification settings - Fork 35
70 lines (57 loc) · 2.3 KB
/
00-deployment-verification.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Deployment Verification
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy-and-test:
runs-on: ubuntu-latest
env:
NETWORK_ONE: zabbix-network
NETWORK_TWO: traefik-network
DOCKER_COMPOSE_FILE: zabbix-traefik-letsencrypt-docker-compose.yml
APP_HOSTNAME: dashboard.zabbix.heyvaldemar.net
APP_TRAEFIK_HOSTNAME: traefik.zabbix.heyvaldemar.net
COMPOSE_PROJECT_NAME: zabbix
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create necessary Docker networks
run: |
docker network create $NETWORK_ONE || true
docker network create $NETWORK_TWO || true
- name: Start up services using Docker Compose
run: docker compose -f $DOCKER_COMPOSE_FILE -p $COMPOSE_PROJECT_NAME up -d
- name: Modify /etc/hosts for internal routing
run: |
echo "127.0.0.1 $APP_HOSTNAME" | sudo tee -a /etc/hosts
echo "127.0.0.1 $APP_TRAEFIK_HOSTNAME" | sudo tee -a /etc/hosts
- name: Print Docker Compose services status
run: docker ps
- name: Wait for the application to be ready via Traefik
run: |
echo "Checking the routing and availability of the application via Traefik..."
timeout 5m bash -c 'while ! curl -fsSLk "https://$APP_HOSTNAME"; do \
echo "Waiting for the application to be ready..."; \
sleep 10; \
done'
- name: Wait for the Traefik dashboard to be ready
run: |
echo "Checking the routing and availability of the Traefik dashboard..."
timeout 5m bash -c 'while ! curl -fsSLk --write-out "%{http_code}" --output /dev/null "https://$APP_TRAEFIK_HOSTNAME" | grep -E "200|401"; do \
echo "Waiting for the application to be ready..."; \
sleep 10; \
done'
- name: Inspect Network Configuration
run: |
docker network inspect $NETWORK_ONE
docker network inspect $NETWORK_TWO
- name: Show container logs on failure
if: failure()
run: docker compose -f $DOCKER_COMPOSE_FILE -p $COMPOSE_PROJECT_NAME logs
- name: Shutdown Docker Compose services
if: always()
run: docker compose -f $DOCKER_COMPOSE_FILE -p $COMPOSE_PROJECT_NAME down