Skip to content

Commit 7f4f607

Browse files
committed
2 parents 759cf3f + 74b27af commit 7f4f607

4 files changed

Lines changed: 11 additions & 33 deletions

File tree

‎.github/workflows/ci-cd.yaml‎

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -101,35 +101,9 @@ jobs:
101101
run: |
102102
echo "=== Deploying load balancer ==="
103103
nomad job run _nomad/loadbalancer.nomad
104-
105-
echo "=== Waiting for deployment to stabilize ==="
106-
sleep 15
107-
108-
echo "=== Verifying deployment ==="
109-
ALLOC_ID=$(nomad job allocs -json loadbalancer | jq -r '.[0].ID')
110-
STATUS=$(nomad alloc status $ALLOC_ID | grep -A 3 "Task Status" | grep "loadbalancer" | awk '{print $2}')
111-
112-
if [ "$STATUS" != "running" ]; then
113-
echo "::error::Container failed to stay running"
114-
nomad alloc logs $ALLOC_ID loadbalancer
115-
exit 1
116-
fi
117-
118-
echo "=== Verifying health check ==="
119-
PORT=$(nomad alloc status $ALLOC_ID | grep "http" | awk '{print $3}')
120-
if ! curl -sf http://localhost:$PORT/health; then
121-
echo "::error::Health check failed"
122-
nomad alloc logs $ALLOC_ID loadbalancer
123-
exit 1
124-
fi
125-
126-
echo "=== Verifying port accessibility ==="
127-
NODE_ADDR=$(nomad node status -json $(nomad alloc status -json $ALLOC_ID | jq -r '.NodeID') | jq -r '.Attributes."unique.network.ip-address"')
128-
if ! nc -zv $NODE_ADDR $PORT; then
129-
echo "::error::Port $PORT not accessible on $NODE_ADDR"
130-
exit 1
131-
fi
132-
104+
env:
105+
NOMAD_ADDR: ${{ secrets.NOMAD_ADDR }}
106+
NOMAD_TOKEN: ${{ secrets.NOMAD_TOKEN }}
133107

134108
- name: Deploy jobs to Nomad
135109
run: |

‎_nomad/loadbalancer.nomad‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ job "loadbalancer" {
3434

3535
config {
3636
image = "wkwtfigo/load-balancer:latest"
37-
ports = ["http"]
37+
ports = ["http", "communication"]
3838
volumes = [
39-
"/var/log/app-redirect-balancer:/app/.logs"
39+
"/var/log/app-redirect-balancer/:/app/.logs/"
4040
]
4141
}
4242

@@ -55,6 +55,10 @@ job "loadbalancer" {
5555
static = 8000
5656
to = 8000
5757
}
58+
port "communication" {
59+
static = 8001
60+
to = 8001
61+
}
5862
}
5963
}
6064
}

‎balanced_instance/config.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"balancing_address": "151.242.43.104:8000",
33
"balanced_port": 8080,
44
"application_port": 8888,
5-
"log_file": "./.logs/balanced.log"
5+
"log_file": "/app/.logs/balanced.log"
66
}

‎balancer_server/config.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"balancing_port": 8000,
44
"exposed_port": 8001,
55
"type": "redirect",
6-
"log_file": "./.logs/balancer.log"
6+
"log_file": "/app/.logs/balancer.log"
77
}

0 commit comments

Comments
 (0)