diff --git a/.github/workflows/deploy-docker.yml b/.github/workflows/deploy-docker.yml index c90e6fb..3f27438 100644 --- a/.github/workflows/deploy-docker.yml +++ b/.github/workflows/deploy-docker.yml @@ -202,22 +202,21 @@ jobs: echo "๐Ÿงน Removing stale target containers by container_name..." # Extract all explicitly defined container_names from compose files and remove them to prevent conflicts + remove_stale_containers() { + local files="$1" + local f + for f in $files; do + if [ -f "$f" ]; then + grep "container_name:" "$f" | awk '{print $2}' | while read -r cname; do + docker rm -f "$cname" >/dev/null 2>&1 || true + done + fi + done + } if [ -n "$TARGET_COMPOSE" ]; then - for f in $TARGET_COMPOSE; do - if [ -f "$f" ]; then - grep "container_name:" "$f" | awk '{print $2}' | while read -r cname; do - docker rm -f "$cname" >/dev/null 2>&1 || true - done - fi - done + remove_stale_containers "$TARGET_COMPOSE" else - for f in $ALL_COMPOSE_FILES; do - if [ -f "$f" ]; then - grep "container_name:" "$f" | awk '{print $2}' | while read -r cname; do - docker rm -f "$cname" >/dev/null 2>&1 || true - done - fi - done + remove_stale_containers "$ALL_COMPOSE_FILES" fi echo "๐Ÿ†™ Starting services..." @@ -234,21 +233,3 @@ jobs: echo "โœ… Traefik reload signal sent" fi EOF - -# - name: Restart coolify-proxy (delay 1 min) -# env: -# SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} -# VPS_HOST: ${{ secrets.VPS_HOST }} -# VPS_USER: ${{ secrets.VPS_USER }} -# run: | -# mkdir -p ~/.ssh -# echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa -# chmod 600 ~/.ssh/id_rsa -# ssh-keyscan -H "$VPS_HOST" >> ~/.ssh/known_hosts -# -# echo "โณ Waiting 60s for containers to settle before restarting proxy..." -# sleep 60 -# -# echo "๐Ÿ”„ Restarting coolify-proxy..." -# ssh "${VPS_USER}@${VPS_HOST}" "docker restart coolify-proxy" -# echo "โœ… coolify-proxy restarted." diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index c6e9b1d..fb46579 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -69,8 +69,6 @@ jobs: echo "rust-auth=$(changed '^(apps/rust-auth(/|$)|\.github/workflows/docker-build-push\.yml$|infra/docker/rust-auth\.Dockerfile$|\.gitmodules$')" >> "$GITHUB_OUTPUT" echo "llm-api=$(changed '^(apps/llm-api(/|$)|\.github/workflows/docker-build-push\.yml$|infra/docker/llm-api\.Dockerfile$|\.gitmodules$')" >> "$GITHUB_OUTPUT" - - name: Parse repository_dispatch payload - - name: Parse repository_dispatch payload id: dispatch if: github.event_name == 'repository_dispatch' @@ -143,7 +141,7 @@ jobs: "elysia-api") REPO="https://github.com/asepharyana/asepharyana-hub-elysia.git" ;; "react-web") REPO="https://github.com/asepharyana/asepharyana-hub-react.git" ;; "rust-auth") REPO="https://github.com/asepharyana/asepharyana-hub-rust-auth.git" ;; - {indent}"llm-api") REPO="https://github.com/asepharyana/asepharyana-hub-llm-api.git" ;; + "llm-api") REPO="https://github.com/asepharyana/asepharyana-hub-llm-api.git" ;; *) echo "::error::Unsupported service '$SERVICE'" exit 1