fix: use docker run to write Traefik config from host volume
All checks were successful
Deploy / deploy (push) Successful in 4m39s
All checks were successful
Deploy / deploy (push) Successful in 4m39s
This commit is contained in:
42
.github/workflows/deploy.yml
vendored
42
.github/workflows/deploy.yml
vendored
@@ -39,38 +39,18 @@ 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:
|
||||||
|
TRAEFIK_RULE: "Host(`api-ubigeo.darkcodex.dev`)"
|
||||||
run: |
|
run: |
|
||||||
TRAEFIK_DIR=/etc/easypanel/traefik/config
|
docker run --rm \
|
||||||
ROUTE_FILE=$TRAEFIK_DIR/api-ubigeo.yaml
|
-e TRAEFIK_RULE \
|
||||||
|
-v /etc/easypanel/traefik/config:/traefik-config \
|
||||||
# Check if we can write there
|
alpine sh -c '
|
||||||
if [ ! -w "$TRAEFIK_DIR" ]; then
|
OUT=/traefik-config/api-ubigeo.yaml
|
||||||
echo "Cannot write to $TRAEFIK_DIR — skipping Traefik config"
|
[ -f "$OUT" ] && echo "route already exists" && exit 0
|
||||||
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"
|
||||||
fi
|
echo "Traefik route created"
|
||||||
|
'
|
||||||
# Only add if not already present
|
|
||||||
if [ ! -f "$ROUTE_FILE" ]; then
|
|
||||||
cat > "$ROUTE_FILE" << '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 created at $ROUTE_FILE"
|
|
||||||
else
|
|
||||||
echo "Traefik route already exists"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Health check
|
- name: Health check
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user