Docs/Deploy/Rollbacks

Rollbacks

3 min read
On this page

When a deploy goes wrong, you can go back to an earlier deployment. How Dokwe does that depends on the project's mode: container projects redeploy the older commit, and native projects switch back to an older release already on your server.

Roll back from the dashboard#

  1. Open the deployment history#

    Go to the project's deployments list. Each entry shows its commit, author, status, and how it was triggered.

  2. Choose the deployment to return to#

    Hover over an earlier deployment and select the rollback icon. You can't roll back to the newest deployment, to one that failed, or to one that is still building.

  3. Confirm#

    Pick one of two options:

    • Roll uses GitHub Actions if your GitHub organization is connected to Dokwe, and otherwise rolls back on Dokwe.
    • Here skips GitHub Actions and rolls back on Dokwe.

For a container redeploy, the dashboard opens the build log of the new deployment so you can follow it.

Roll back with the CLI#

Pass the ID of the deployment you want to return to:

bash
dokwe rollback 3f2a9c1e-5b7d-4e8a-9c0f-1a2b3c4d5e6f

You can copy the ID from the deployment's page URL in the dashboard.

Without an ID, the CLI looks at the project's five most recent deployments and uses the newest one that is live or rolled_back:

bash
dokwe rollback

Pass an explicit deployment ID. With no ID, the newest match is often the deployment that is already live.

The CLI reports the result:

  • Rolled back. New deployment: <id> for a container redeploy.
  • Rolled back. current → <release path> for a native project.
  • A message from GitHub Actions when the rollback was sent there.

Container projects#

A container rollback creates a new deployment, marked as a rollback, for the older commit. It goes through the normal build pipeline, the same way a push does.

Like a push, this redeploy targets the environment that tracks the project branch, which is staging in the default pipeline. To put an earlier build back on production, promote it with the commit picker. See Staging and production.

Native projects#

A native rollback doesn't rebuild anything. Dokwe asks the agent on your server to:

  1. Run the release_rollback commands from the manifest of the deployment being undone.
  2. Point the current symlink back at the target deployment's release directory.
  3. Apply the services from the target deployment's manifest.

Then the target deployment becomes live and the one you undid becomes rolled_back.

A few things to know:

  • Only releases still on the host can be restored. Dokwe prunes releases beyond deploy.keepReleases (default 5).
  • The target deployment must have a saved manifest, and the server's agent must be online.
  • If the deployment you undo has no release_rollback commands, only the symlink and services change. Add down-steps for anything your release commands change, such as database migrations. See Container or native.

Rollbacks through GitHub Actions#

If you connected your GitHub organization with Connect GitHub Actions on the Actions page, Roll and dokwe rollback send a repository_dispatch event of type dokwe-rollback to your repository instead of rolling back on Dokwe. The payload includes the project slug, the deployment ID, the commit SHA, and the image tag. Your repository needs a workflow that listens for this event and does the rollback. The run then shows up in your repository's Actions history. If the dispatch fails, Roll falls back to rolling back on Dokwe.

This applies to native projects too. Use Here to skip GitHub Actions.

What a rollback restores#

RestoredNot restored
Your application code, at the older commit or releaseEnvironment variables. The current values are used.
Native service definitions, from the older manifestData in databases, service apps, and storage
Domains and DNS
Files written to persistent paths, such as native shared/ directories

Database changes are only undone if you undo them yourself. In native mode that means release_rollback commands. In container mode, run the down-migration yourself, for example from the terminal. See Logs and terminal.

If you switch a project between container and native mode, earlier deployments stay in history but you can't roll back to them.