Update deploy to use PM2, add .next.prev to gitignore
Deploy / release (push) Skipped
Deploy / deploy (push) Failing after 38s

This commit is contained in:
openhands committed 2026-07-23 19:09:05 +02:00
1 parent a058a6e923
commit d9e95c823a
12 files changed
+14 -13

No files matched your search

+10 -9
View File
@@ -251,7 +251,7 @@ jobs:
if [ -n "${STAGE}" ] && [ -d "${STAGE}" ]; then
git -C "${LIVE}" worktree remove --force "${STAGE}" 2>/dev/null || rm -rf "${STAGE}" || true
fi
sudo systemctl start atom-nexst.service || true
pm2 start next || true
exit 1
}
trap 'error_handler $LINENO' ERR
@@ -319,8 +319,8 @@ jobs:
echo "Cutover: stop service (free DB connections), migrate, swap .next..."
CUTOVER_STARTED=1
sudo systemctl stop atom-nexst.service || true
pkill -f 'next-server' || true
pm2 stop next || true
sleep 2
# Give MariaDB a moment to reclaim the live pool.
sleep 2
@@ -372,12 +372,13 @@ jobs:
sudo chown -R www-data:www-data "${LIVE}"
echo "Starting systemd service..."
sudo systemctl start atom-nexst.service
echo "Starting PM2..."
pm2 start next --update-env || pm2 restart next --update-env
sleep 2
if ! systemctl is-active --quiet atom-nexst.service; then
echo "ERROR: atom-nexst.service failed to start!" >&2
sleep 3
if ! pm2 show next 2>/dev/null | grep -q 'online'; then
echo "ERROR: PM2 next failed to start!" >&2
pm2 logs next --lines 20 --nostream >&2 || true
exit 1
fi
@@ -397,7 +398,7 @@ jobs:
if [ "${HEALTH_OK}" != "1" ]; then
echo "ERROR: Health check failed after deploy (${HEALTH_URL})" >&2
echo "Last body: ${BODY:-<empty>}" >&2
journalctl -u atom-nexst.service -n 40 --no-pager >&2 || true
pm2 logs next --lines 40 --nostream >&2 || true
exit 1
fi