name: Deploy App on: push: branches: - main jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 - name: Deploy to Server run: | APP_DIR="/opt/aicds/apps/${GITHUB_REPOSITORY#*/}" mkdir -p $APP_DIR cp -a . $APP_DIR/ cd $APP_DIR docker compose down || true docker compose up -d --build docker image prune -f - name: Traefik-Konfiguration run: | echo "-- Mounts --" docker inspect -f '{{range .Mounts}}{{.Type}} {{.Source}} -> {{.Destination}}{{println}}{{end}}' traefik || true echo "-- Env --" docker inspect -f '{{range .Config.Env}}{{.}}{{println}}{{end}}' traefik || true echo "-- Cmd --" docker inspect -f '{{range .Config.Cmd}}{{.}}{{println}}{{end}}' traefik || true echo "-- Konfigdatei im Container --" for f in /etc/traefik/traefik.yml /etc/traefik/traefik.yaml /traefik.yml /traefik.yaml; do echo "### $f"; docker exec traefik cat $f 2>/dev/null || echo "(nicht vorhanden)" done echo "-- compose-Dateien aller Apps --" find /opt/aicds -maxdepth 3 -name 'docker-compose.y*ml' 2>/dev/null | while read f; do echo "### $f"; cat "$f"; echo; done echo "-- Gesundheit des garten-Containers --" sleep 45 docker inspect -f 'health={{if .State.Health}}{{.State.Health.Status}} fails={{.State.Health.FailingStreak}}{{else}}keiner{{end}}' gartenvisualisierung-app-1 || true docker inspect -f '{{if .State.Health}}{{range .State.Health.Log}}exit={{.ExitCode}} out={{.Output}}{{println}}{{end}}{{end}}' gartenvisualisierung-app-1 | tail -3 || true echo "-- Router-Test von innen --" docker run --rm --network agent-net curlimages/curl:latest -sk -o /dev/null -w 'garten: %{http_code}\n' --max-time 10 -H 'Host: garten.aicds.ch' https://traefik/ || true docker run --rm --network agent-net curlimages/curl:latest -sk -o /dev/null -w 'hello: %{http_code}\n' --max-time 10 -H 'Host: hello-test.aicds.ch' https://traefik/ || true