fix: use external sh script to write Traefik config — avoid YAML escaping issues
Some checks failed
Deploy / deploy (push) Failing after 3m41s
Some checks failed
Deploy / deploy (push) Failing after 3m41s
This commit is contained in:
13
.github/workflows/deploy.yml
vendored
13
.github/workflows/deploy.yml
vendored
@@ -39,18 +39,7 @@ jobs:
|
|||||||
docker compose -f docker-compose.production.yml up -d
|
docker compose -f docker-compose.production.yml up -d
|
||||||
|
|
||||||
- name: Register Traefik route
|
- name: Register Traefik route
|
||||||
env:
|
run: sh /workspace/darkcodex/api-ubigeo/scripts/register-traefik.sh
|
||||||
TRAEFIK_RULE: "Host(`api-ubigeo.darkcodex.dev`)"
|
|
||||||
run: |
|
|
||||||
docker run --rm \
|
|
||||||
-e TRAEFIK_RULE \
|
|
||||||
-v /etc/easypanel/traefik/config:/traefik-config \
|
|
||||||
alpine sh -c '
|
|
||||||
OUT=/traefik-config/api-ubigeo.yaml
|
|
||||||
[ -f "$OUT" ] && echo "route already exists" && exit 0
|
|
||||||
printf "http:\n routers:\n ubigeo-api:\n rule: \"%s\"\n service: ubigeo-api\n entryPoints:\n - websecure\n tls:\n certResolver: letsencrypt\n services:\n ubigeo-api:\n loadBalancer:\n servers:\n - url: \"http://ubigeo-api:3200\"\n" "$TRAEFIK_RULE" > "$OUT"
|
|
||||||
echo "Traefik route created"
|
|
||||||
'
|
|
||||||
|
|
||||||
- name: Health check
|
- name: Health check
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
22
scripts/register-traefik.sh
Executable file
22
scripts/register-traefik.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
OUT=/etc/easypanel/traefik/config/api-ubigeo.yaml
|
||||||
|
|
||||||
|
cat > "$OUT" << 'EOF'
|
||||||
|
http:
|
||||||
|
routers:
|
||||||
|
ubigeo-api:
|
||||||
|
rule: "Host(`api-ubigeo.darkcodex.dev`)"
|
||||||
|
service: ubigeo-api
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
tls:
|
||||||
|
certResolver: letsencrypt
|
||||||
|
services:
|
||||||
|
ubigeo-api:
|
||||||
|
loadBalancer:
|
||||||
|
servers:
|
||||||
|
- url: "http://ubigeo-api:3200"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Traefik route written:"
|
||||||
|
cat "$OUT"
|
||||||
Reference in New Issue
Block a user