Enhance deployment script with PM2 process checks and error handling

Update deploy-production.sh to include checks for PM2 installation and process existence before restarting. Implement error messages for failed starts and restarts, improving robustness and user guidance during deployment. Additionally, add useful commands for managing the PM2 process post-deployment.
This commit is contained in:
Torsten Schulz (local)
2026-01-08 11:24:38 +01:00
parent 9c9f2ef1ac
commit cca02dbd20
5 changed files with 115 additions and 18 deletions

View File

@@ -20,19 +20,18 @@ export default defineEventHandler(async (event) => {
})
// CORS-Header für Cross-Device Authentication
// OPTIONS-Requests werden von .options.js behandelt
const allowedOrigin = requestOrigin || webauthnOrigin
if (allowedOrigin) {
setHeader(event, 'Access-Control-Allow-Origin', allowedOrigin)
setHeader(event, 'Access-Control-Allow-Credentials', 'true')
setHeader(event, 'Access-Control-Allow-Methods', 'POST, OPTIONS')
setHeader(event, 'Access-Control-Allow-Headers', 'Content-Type, Authorization, Origin, X-Requested-With')
}
// OPTIONS Preflight-Request
if (getMethod(event) === 'OPTIONS') {
console.log('[DEBUG] OPTIONS preflight request, returning 204')
setResponseStatus(event, 204)
return null
console.log('[DEBUG] CORS headers set for POST', {
origin: allowedOrigin,
requestOrigin,
webauthnOrigin
})
}
const body = await readBody(event)