From cfdfa41dc0a29b8ecbed821f03069d69a3857471 Mon Sep 17 00:00:00 2001 From: Gianpierre Mio <88248836+DarkCodex29@users.noreply.github.com> Date: Tue, 10 Mar 2026 09:55:57 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20use=20external=20sh=20script=20to=20writ?= =?UTF-8?q?e=20Traefik=20config=20=E2=80=94=20avoid=20YAML=20escaping=20is?= =?UTF-8?q?sues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 13 +------------ scripts/register-traefik.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 12 deletions(-) create mode 100755 scripts/register-traefik.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ba812f3..7dddbb9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,18 +39,7 @@ jobs: docker compose -f docker-compose.production.yml up -d - name: Register Traefik route - env: - 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" - ' + run: sh /workspace/darkcodex/api-ubigeo/scripts/register-traefik.sh - name: Health check run: | diff --git a/scripts/register-traefik.sh b/scripts/register-traefik.sh new file mode 100755 index 0000000..369fd65 --- /dev/null +++ b/scripts/register-traefik.sh @@ -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"