A deploy on JetDeploy goes through three steps: build, pre-deploy script, rollout. It can fail in any of them, and which one failed decides two things: whether your users noticed anything, and where to look for the cause. This guide covers both, and how to put the previous version back when you need to.
Step 1: which step failed
The operation ends in FAILURE, and its error_message already says a lot. Read it on the App page, or through the API:
curl -sS -H "Authorization: Bearer $JD_TOKEN" \
https://jetdeploy.com/api/v1/operations/871 | jq '{status, error_message, commit}'- Failed step
- Build, or build over 1200 s
- The previous version
- keeps serving
error_messagecarries- the failing build phase and the last lines of the build log
- Failed step
- Pre-deploy script, or over 510 s
- The previous version
- keeps serving
error_messagecarries- the exit code of the last attempt and the last lines of its output
- Failed step
- New version not ready in time
- The previous version
- the rollout goes on; the new version takes over once ready
error_messagecarries- per process: it exits, it runs out of memory, or nothing listens on its port
Step 2: read the right logs
Build and pre-deploy: the deploy logs
The deploy logs of a run hold three streams: build, predeploy and outcome. Read a page of them:
curl -sS -H "Authorization: Bearer $JD_TOKEN" \
"https://jetdeploy.com/api/v1/apps/42/deploy-logs?operation=871" | jq -r '.rows[] | "\(.stream)\t\(.message)"'What to look for:
Build: the first error, not the last line. With npm, pip or go build, the real cause is usually a few lines above the final summary.
Pre-deploy: each attempt starts with a Pre-deploy attempt N line. A traceback there is from your migration or script, run with the App's environment variables.
Readiness: the logs
When the new version does not become ready, the cause is in the logs of the process named in the error. Filter by level to skip the noise:
curl -sS -H "Authorization: Bearer $JD_TOKEN" \
"https://jetdeploy.com/api/v1/apps/42/logs?pod=7&level=error&level=warn"pod takes the id of the process, as listed in GET /api/v1/apps/42. Repeat level for several levels; a comma-separated value is refused.
The three causes the error message names, and what usually produces them:
- The process exits. A missing environment variable read at startup, a failed connection to a database that is not ready, or a typo in the process command.
- It runs out of memory. The process is killed for using more memory than it may, often at startup from too many worker processes:
gunicorn --workers,pumaworkers, Node cluster mode. - Nothing listens on its port. The server binds
127.0.0.1instead of0.0.0.0, or a port other than the container port. JetDeploy sets noPORTvariable, so a server that readsPORTfalls back to its own default unless you set it.
Step 3: fix forward or roll back
Most failures in the build or the pre-deploy script are fixed forward: correct the code, push again. The previous version is still serving, so there is no hurry.
When a new version went live and misbehaves, go back from git. Find the commit of the last good release:
-
curl -sS -H "Authorization: Bearer $JD_TOKEN" \ https://jetdeploy.com/api/v1/apps/42/releases | jq '.[] | {commit, deployed_at, current}' -
Then revert the commits after it and push:
git revert --no-edit <good-commit>..HEAD git push jetdeploy main
The push deploys the reverted code like any other commit, and you follow its operation as usual. From an AI agent, the releases are the list_releases tool.
What going back this way does and does not do:
It is a normal deploy: build, pre-deploy script, rollout. The broken version keeps serving until the reverted one is ready, and the history in git says what happened.
It runs with the configuration stored now: environment variables, processes, domains and redirect rules as they are saved.
Reverting a migration file does not reverse the migration in the database. The earlier code has to work with the current schema.
current in the releases marks the version the App runs, so you can check which one is live before and after.
A short runbook
- Open the failed operation and read
error_message. - Build or pre-deploy failed? The old version is serving. Read the deploy logs, fix, push.
- Readiness failed? Read the logs of the named process, filtered to errors.
- Is the new version live and broken? Revert to the last good commit and push, then fix forward.
- Did the failed deploy include a migration? Check that the previous version works with it before reverting.
Next step
Most readiness failures come from the process itself: its bind address, its port, its memory at startup. Graceful shutdown in Go and Next.js standalone builds show a correct setup for two common stacks, and Database migrations in the pre-deploy script covers schema changes a rollback can live with.