Skip to content

fix(ci): switch deploy strategy from rsync-to-/current/ to git pull o… - #56

Merged
gamblecodezcom merged 2 commits into
mainfrom
claude/update-prod-runner-script-Lq2gS
Feb 21, 2026
Merged

fix(ci): switch deploy strategy from rsync-to-/current/ to git pull o…#56
gamblecodezcom merged 2 commits into
mainfrom
claude/update-prod-runner-script-Lq2gS

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 21, 2026

Copy link
Copy Markdown
Owner

User description

…n VPS

Root cause of CI/CD failures: the pipeline rsynced code to a new /current/ subdirectory that the existing systemd service and /deploy bot command don't know about, so restarts continued running old code and post-deploy checks probed the wrong paths.

Fix: mirror the working /deploy bot command — SSH to VPS and run
git fetch origin main + git reset --hard origin/main
in the flat /var/www/html/Runewager/ directory that the service already uses.

Changes:

  • deploy.yml: replace archive+rsync steps with git pull approach; save pre-deploy SHA for git-based rollback on failure; remove dead dry-run guard; update all /current/ paths to flat path; rollback now does git reset --hard <pre_sha> + npm ci + restart
  • runewager.service: revert all paths from /current/ back to flat /var/www/html/Runewager/ (service must match deploy target)
  • post-deploy-verify.sh: update DEPLOY_DIR default to flat path

https://claude.ai/code/session_01X3PxGFF5zzKptQwVkjYzzN


CodeAnt-AI Description

Switch production deploy to git pull and target the service's actual install directory

What Changed

  • CI now updates code on the VPS by SSHing and pulling/resetting the repository in /var/www/html/Runewager instead of rsyncing into a /current subdirectory
  • The systemd service, post-deploy checks, smoke tests, env upload, dependency install, and runtime log/data paths were updated to use the flat /var/www/html/Runewager path so restarts run the newly deployed code
  • The workflow saves the pre-deploy commit SHA and, on failure, performs a git-based rollback to that SHA (including dependency install and service restart) and sends clear rollback notifications

Impact

✅ Fewer failed CI deploys due to stale service paths
✅ Fewer stale running versions after deploy
✅ Clearer, automated git rollback with notification

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Chores
    • Enhanced deployment process with automated rollback capability on deployment failures.
    • Improved deployment notifications to include version, commit, and deployment time details.
    • Updated service configuration with enhanced stability and restart settings for improved reliability.

…n VPS

Root cause of CI/CD failures: the pipeline rsynced code to a new
/current/ subdirectory that the existing systemd service and /deploy
bot command don't know about, so restarts continued running old code
and post-deploy checks probed the wrong paths.

Fix: mirror the working /deploy bot command — SSH to VPS and run
  git fetch origin main + git reset --hard origin/main
in the flat /var/www/html/Runewager/ directory that the service
already uses.

Changes:
- deploy.yml: replace archive+rsync steps with git pull approach;
  save pre-deploy SHA for git-based rollback on failure; remove
  dead dry-run guard; update all /current/ paths to flat path;
  rollback now does git reset --hard <pre_sha> + npm ci + restart
- runewager.service: revert all paths from /current/ back to flat
  /var/www/html/Runewager/ (service must match deploy target)
- post-deploy-verify.sh: update DEPLOY_DIR default to flat path

https://claude.ai/code/session_01X3PxGFF5zzKptQwVkjYzzN
@codeant-ai

codeant-ai Bot commented Feb 21, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@coderabbitai

coderabbitai Bot commented Feb 21, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The deployment pipeline is refactored from an archive-rsync approach to git-based updates on the VPS. The directory structure shifts from a current/ subdirectory model to a simplified root-level Runewager/ path. Pre-deploy Git SHA capture is introduced to enable rollback on failure, alongside updated systemd service configuration and verification scripts.

Changes

Cohort / File(s) Summary
Deployment Workflow Configuration
.github/workflows/deploy.yml
Removes dry-run guard; introduces pre-deploy Git SHA capture; replaces archive-rsync with direct git fetch/reset; updates .env and runtime directory paths; refactors rollback logic to use captured SHA; adds conditional rollback messaging and enhanced deploy notifications.
Service Configuration & Verification
runewager.service, scripts/post-deploy-verify.sh
Updates WorkingDirectory, ExecStart, EnvironmentFile, and log file paths from current/ to root Runewager/ structure; adds restart policies and stability settings to service unit; adjusts DEPLOY_DIR default in verification script.

Sequence Diagram

sequenceDiagram
    actor User
    participant Workflow as GitHub<br/>Workflow
    participant VPS as VPS Server
    participant Git as Git Repository
    participant Service as Runewager<br/>Service
    participant Tests as Smoke Tests
    participant Slack as Notifications

    User->>Workflow: Trigger manual deploy
    Workflow->>VPS: Connect via SSH
    VPS->>VPS: Capture pre-deploy SHA (PRE_SHA)
    Workflow->>VPS: Deploy code: git fetch origin main
    VPS->>Git: Fetch latest
    VPS->>VPS: git reset --hard origin/main
    Workflow->>VPS: Copy .env and config
    Workflow->>VPS: npm ci
    Workflow->>VPS: Restart service
    VPS->>Service: Systemctl restart
    Workflow->>Tests: Run smoke tests
    alt Tests Pass
        Workflow->>VPS: Write .release_info
        Workflow->>Slack: Send success notification
    else Tests Fail
        Workflow->>VPS: Check if PRE_SHA available
        alt PRE_SHA Found
            VPS->>Git: git reset --hard PRE_SHA
            VPS->>Service: Restart service
            Workflow->>Slack: Notify rollback completed
        else PRE_SHA Not Found
            Workflow->>Slack: Notify rollback unavailable
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A workflow hops to cleaner ground,
Git branches replace archives' mound,
Pre-deploy SHA captures the way,
Rollback ready, come what may,
Simplified paths—deployment's great day! 🚀


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@gamblecodezcom
gamblecodezcom merged commit 8f14ef1 into main Feb 21, 2026
2 checks passed
@gamblecodezcom
gamblecodezcom deleted the claude/update-prod-runner-script-Lq2gS branch February 21, 2026 07:25
@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Feb 21, 2026
@codeant-ai

codeant-ai Bot commented Feb 21, 2026

Copy link
Copy Markdown

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • EnvironmentFile existence/permissions
    The unit references EnvironmentFile=/var/www/html/Runewager/.env. If that file is absent or has restrictive permissions the service may fail to start or not pick up required secrets. Confirm the deploy ensures the file exists with appropriate permissions (and isn't accidentally committed).

  • Logging directory
    The service now writes logs to /var/www/html/Runewager/logs/*. If that directory does not exist or has incorrect ownership/permissions the service may fail to open the log files or logs will be written to unexpected places. Ensure the deploy process or the service unit creates and owns this directory before ExecStart runs.

@codeant-ai

codeant-ai Bot commented Feb 21, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants