Skip to content

fix: unicorn-auto-deploy-advanced — resolve PM2 "script not found" by targeting UNICORN_FINAL as app dir#162

Merged
ruffy80 merged 1 commit into
mainfrom
copilot/resolve-error-on-hertzner
Apr 14, 2026
Merged

fix: unicorn-auto-deploy-advanced — resolve PM2 "script not found" by targeting UNICORN_FINAL as app dir#162
ruffy80 merged 1 commit into
mainfrom
copilot/resolve-error-on-hertzner

Conversation

Copilot AI commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

The "Deploy to Hetzner with rollback" step was failing in 4s with [PM2][ERROR] Script not found: ***/src/index.js. The SSH deploy script ran npm install, PM2, and health checks from the git repo root (/opt/unicorn) — but the app lives in UNICORN_FINAL/ subdirectory. ecosystem.config.js, backend/index.js, and client/ are all one level deeper, so every app operation was resolving against the wrong path.

Changes

  • APP_DIR detection: after git pull in REPO_DIR, derive APP_DIR as $REPO_DIR/UNICORN_FINAL when that subdir exists, falling back to $REPO_DIR for servers where the deploy path already points directly at the app:
    APP_DIR=$([ -d "$REPO_DIR/UNICORN_FINAL" ] && echo "$REPO_DIR/UNICORN_FINAL" || echo "$REPO_DIR")
  • npm install, PM2, client build, rollback all cd "$APP_DIR" instead of running from the git root
  • PM2 process name: fallback grep/restart changed unicorn-backendunicorn to match the name defined in ecosystem.config.js
  • Fallback pm2 start: src/index.js --name unicorn-backendbackend/index.js --name unicorn
  • Rollback section: git reset still runs in REPO_DIR, then re-cds into APP_DIR before npm install and PM2

…2 process name

Agent-Logs-Url: https://github.com/ruffy80/ZeusAI/sessions/72c22feb-b3f6-46ee-9cfe-eb198edaaae5

Co-authored-by: ruffy80 <29306714+ruffy80@users.noreply.github.com>
@vercel

vercel Bot commented Apr 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zeusai Ready Ready Preview, Comment Apr 14, 2026 7:12am

Request Review

@ruffy80 ruffy80 marked this pull request as ready for review April 14, 2026 07:12
@ruffy80 ruffy80 merged commit e5e4bb4 into main Apr 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants