fix: inject ubigeo route directly into Traefik main.yaml using jq
All checks were successful
Deploy / deploy (push) Successful in 4m8s

This commit is contained in:
Gianpierre Mio
2026-03-10 10:38:43 -05:00
parent 9346ccc70a
commit 13060806cc

View File

@@ -40,16 +40,23 @@ jobs:
- name: Register Traefik route - name: Register Traefik route
run: | run: |
ROUTE_B64="aHR0cDoKICByb3V0ZXJzOgogICAgdWJpZ2VvLWFwaToKICAgICAgcnVsZTogIkhvc3QoYGFwaS11YmlnZW8uZGFya2NvZGV4LmRldmApIgogICAgICBzZXJ2aWNlOiB1YmlnZW8tYXBpCiAgICAgIGVudHJ5UG9pbnRzOgogICAgICAgIC0gd2Vic2VjdXJlCiAgICAgIHRsczoKICAgICAgICBjZXJ0UmVzb2x2ZXI6IGxldHNlbmNyeXB0CiAgc2VydmljZXM6CiAgICB1YmlnZW8tYXBpOgogICAgICBsb2FkQmFsYW5jZXI6CiAgICAgICAgc2VydmVyczoKICAgICAgICAgIC0gdXJsOiAiaHR0cDovL3ViaWdlby1hcGk6MzIwMCIK"
docker run --rm \ docker run --rm \
-e ROUTE_B64="$ROUTE_B64" \
-v /etc/easypanel/traefik/config:/traefik-config \ -v /etc/easypanel/traefik/config:/traefik-config \
alpine sh -c 'echo "$ROUTE_B64" | base64 -d > /traefik-config/api-ubigeo.yaml && echo "written:" && cat /traefik-config/api-ubigeo.yaml' alpine sh -c '
apk add jq -q --no-progress 2>/dev/null
FILE=/traefik-config/main.yaml
- name: Diagnostics if jq -e ".http.routers[\"https-ubigeo-0\"]" "$FILE" > /dev/null 2>&1; then
run: | echo "ubigeo route already exists in main.yaml"
echo "=== main.yaml content ===" exit 0
docker run --rm -v /etc/easypanel/traefik/config:/traefik-config alpine cat /traefik-config/main.yaml || echo "FAILED" fi
jq ".http.routers[\"http-ubigeo-0\"] = {\"rule\": \"Host(\\\"api-ubigeo.darkcodex.dev\\\") && PathPrefix(\\\"/\\\")\", \"entryPoints\": [\"http\"], \"middlewares\": [\"redirect-to-https\", \"bad-gateway-error-page\"], \"service\": \"ubigeo_api-0\"} |
.http.routers[\"https-ubigeo-0\"] = {\"rule\": \"Host(\\\"api-ubigeo.darkcodex.dev\\\") && PathPrefix(\\\"/\\\")\", \"entryPoints\": [\"https\"], \"middlewares\": [\"bad-gateway-error-page\"], \"service\": \"ubigeo_api-0\", \"tls\": {\"certResolver\": \"letsencrypt\"}} |
.http.services[\"ubigeo_api-0\"] = {\"loadBalancer\": {\"passHostHeader\": true, \"servers\": [{\"url\": \"http://ubigeo-api:3200/\"}]}}" \
"$FILE" > /tmp/main-new.json && mv /tmp/main-new.json "$FILE"
echo "Traefik route injected into main.yaml"
'
- name: Health check - name: Health check
run: | run: |