Set up a continuous update pipeline in Cerewro that runs git pull, installs dependencies, applies database migrations, restarts services and verifies the app is running. All from the chat or triggered by webhook.
Update the app at C:\projects\my-web: run git pull, install npm dependencies, rebuild the project and restart the PM2 process "my-web"
Set-Location "C:\projects\my-web"
Write-Host "Pulling latest changes..."
git pull origin main
if ($LASTEXITCODE -ne 0) { throw "git pull failed" }
Write-Host "Installing dependencies..."
npm ci --production
Write-Host "Building..."
npm run build
Write-Host "Restarting service..."
pm2 restart my-web
Start-Sleep 3
$resp = Invoke-WebRequest -Uri "http://localhost:3000/health" -UseBasicParsing
if ($resp.StatusCode -eq 200) {
Write-Host "Deploy OK" -ForegroundColor Green
} else {
Write-Warning "Health check failed: $($resp.StatusCode)"
}
git reset --hard HEAD~1, rebuilds and restarts automatically.