Files
api-ubigeo/.github/workflows/deploy.yml
Gianpierre Mio b7018ffd64
All checks were successful
Deploy / deploy (push) Successful in 4m17s
debug: inspect Traefik config directory and file provider settings
2026-03-10 10:16:47 -05:00

64 lines
3.0 KiB
YAML

name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout
run: |
if [ ! -d /workspace/darkcodex/api-ubigeo/.git ]; then
git clone https://948ee86882f8d9ca46eb94750addfccdace443a6@git.darkcodex.dev/darkcodex/api-ubigeo.git \
/workspace/darkcodex/api-ubigeo
fi
cd /workspace/darkcodex/api-ubigeo
git fetch origin main
git reset --hard origin/main
- name: Sync source
run: |
rsync -a --delete \
--exclude='.git' \
--exclude='node_modules' \
--exclude='dist' \
--exclude='.env' \
/workspace/darkcodex/api-ubigeo/ /home/deployer/api-ubigeo/
- name: Build image
run: |
cd /home/deployer/api-ubigeo
docker build -t ubigeo-api:latest .
- name: Deploy containers
run: |
cd /home/deployer/api-ubigeo
docker compose -f docker-compose.production.yml down --remove-orphans
docker compose -f docker-compose.production.yml up -d
- name: Register Traefik route
run: |
ROUTE_B64="aHR0cDoKICByb3V0ZXJzOgogICAgdWJpZ2VvLWFwaToKICAgICAgcnVsZTogIkhvc3QoYGFwaS11YmlnZW8uZGFya2NvZGV4LmRldmApIgogICAgICBzZXJ2aWNlOiB1YmlnZW8tYXBpCiAgICAgIGVudHJ5UG9pbnRzOgogICAgICAgIC0gd2Vic2VjdXJlCiAgICAgIHRsczoKICAgICAgICBjZXJ0UmVzb2x2ZXI6IGxldHNlbmNyeXB0CiAgc2VydmljZXM6CiAgICB1YmlnZW8tYXBpOgogICAgICBsb2FkQmFsYW5jZXI6CiAgICAgICAgc2VydmVyczoKICAgICAgICAgIC0gdXJsOiAiaHR0cDovL3ViaWdlby1hcGk6MzIwMCIK"
docker run --rm \
-e ROUTE_B64="$ROUTE_B64" \
-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'
- name: Diagnostics
run: |
echo "=== Traefik config directory ==="
docker run --rm -v /etc/easypanel/traefik:/traefik-host alpine sh -c "ls /traefik-host/config/ && echo '---' && cat /traefik-host/config/api-ubigeo.yaml 2>/dev/null || echo 'api-ubigeo.yaml NOT FOUND'"
echo "=== Traefik main config (file provider section) ==="
docker run --rm -v /etc/easypanel/traefik:/traefik-host alpine grep -A 5 "file\|directory\|watch" /traefik-host/traefik.yaml 2>/dev/null || docker run --rm -v /etc/easypanel/traefik:/traefik-host alpine sh -c "ls /traefik-host/ && cat /traefik-host/traefik.yaml 2>/dev/null | head -50"
echo "=== Container networks ==="
docker inspect ubigeo-api --format '{{range $k,$v := .NetworkSettings.Networks}}{{$k}} {{end}}' 2>/dev/null || echo "container not found"
- name: Health check
run: |
sleep 15
STATUS=$(wget -qO- http://ubigeo-api:3200/api/v1/health 2>/dev/null || echo "fail")
echo "Health: $STATUS"
echo "$STATUS" | grep -q "ok" && echo "Deploy OK" || echo "Warning: health check unreachable from runner"