For the standard upgrade process (manual or automated), see Updating in the README. This document covers how automated upgrades work and how to recover when something goes wrong.
Two GitHub Actions workflows handle automated upgrades:
Triggered via workflow_dispatch (Actions tab > "Upgrade Event Handler" > Run workflow). This workflow:
- Clones your repo into a temp directory inside the event handler container
- Runs
npm install+npm update thepopebot - If the version changed, creates an
upgrade/thepopebot-<version>-<timestamp>branch - Opens a PR and enables auto-merge with
--delete-branch
This workflow only updates package.json and package-lock.json. It does not run thepopebot init, rebuild, or restart anything. That happens when the PR merges.
Triggered automatically when the upgrade PR merges to main. This workflow detects the version change and:
- Runs
npx thepopebot initinside the container to scaffold updated templates - Commits any template changes back to
main - Updates
THEPOPEBOT_VERSIONin the server's.env - Pulls the new Docker image for the event handler
- Stops the old container and starts a new one
- Runs
npm install --omit=devin the new container - Builds
.nextand restarts PM2
If the version didn't change (normal code push), it skips steps 1-5 and does a fast rebuild only (npm install + build + PM2 reload).
If an automated upgrade fails, SSH into your server and rebuild manually:
docker exec thepopebot-event-handler npm install --omit=dev
docker exec thepopebot-event-handler bash -c 'rm -rf .next-new .next-old && NEXT_BUILD_DIR=.next-new npm run build && mv .next .next-old 2>/dev/null; mv .next-new .next && rm -rf .next-old'
docker exec thepopebot-event-handler npx pm2 restart allIf the upgrade PR has merge conflicts in GitHub, resolve them in the GitHub UI or locally:
git fetch origin
git checkout upgrade/thepopebot-<version>-<timestamp>
git merge main
# resolve conflicts
git pushOnce resolved, the PR merges and rebuild-event-handler.yml takes over.
docker ps -a | grep thepopebot-event-handler # container running?
docker logs thepopebot-event-handler --tail 50 # container logs
docker exec thepopebot-event-handler npx pm2 status # PM2 status
docker exec thepopebot-event-handler npx pm2 logs --lines 30 # app logs