From 4797aca20ffa08d2da44f827573a98beb33e50d0 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Fri, 7 Aug 2026 11:22:29 +0700 Subject: [PATCH] ci(deploy): poll service readiness instead of fixed 3s sleep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit is-active after sleep 3 false-fails when the unit is still activating (e.g. Next standalone boot >3s) — exit 3 flagged the deploy red even though the service came up fine. Poll is-active up to 30s and only fail if it never reaches 'active'. --- .github/workflows/deploy.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 76f2bce..9cf9789 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -118,9 +118,10 @@ jobs: echo "=== Updating profile ===" ssh "$VPS_USER@$VPS_HOST" "sudo /nix/var/nix/profiles/default/bin/nix-env --profile /nix/var/nix/profiles/gmw-${{ matrix.service }} --set '$STORE_PATH'" - echo "=== Restarting service ===" - ssh "$VPS_USER@$VPS_HOST" "sudo systemctl daemon-reload && sudo systemctl restart gmw-${{ matrix.service }} && sleep 3 && sudo systemctl is-active gmw-${{ matrix.service }}" - echo "✅ gmw-${{ matrix.service }} deployed" + echo "=== Restarting service ===\n" + ssh "$VPS_USER@$VPS_HOST" \ + "sudo systemctl daemon-reload && sudo systemctl restart gmw-${{ matrix.service }} && for i in \$(seq 1 15); do state=\$(sudo systemctl is-active gmw-${{ matrix.service }} 2>/dev/null || echo inactive); [ \"\$state\" = \"active\" ] && break; sleep 2; done; echo \"final-state=\$state\"; [ \"\$state\" = \"active\" ]" + echo "✅ gmw-${{ matrix.service }} deployed" cleanup: # Bersihkan sampah Nix di VPS SETELAH semua deploy selesai: hapus generasi