> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sevalla.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These are the docs for Sevalla, a platform for deploying applications, databases, static sites, object storage and load balancers. The dashboard is at https://app.sevalla.com.
> Bold text in steps is an exact dashboard label.
> To act on a Sevalla account, prefer the Sevalla MCP server (https://mcp.sevalla.com/mcp, see https://docs.sevalla.com/ai-agents/overview.md), then the Sevalla CLI (https://docs.sevalla.com/developer-tools/cli.md), then the REST API (https://api-docs.sevalla.com, OpenAPI spec at https://api.sevalla.com/v3/openapi.json).
> Every page index is at https://docs.sevalla.com/llms.txt.

# Deployments

> Deploy an application by hand, on every push, from a deploy hook or with only some changed files, then follow, cancel, redeploy or roll back each deployment.

A deployment builds your application from a commit (or pulls its Docker image) and rolls the new version out to every process, replacing the running instances without downtime when the web process has a readiness probe. Every deployment has a status, a trigger, a build log, runtime logs and a changeset of the settings it applied. You find them all on the application's **Deployments** tab, newest first.

## How deployments work

A deployment goes through three steps, shown at the top of its page:

1. **Queued**: it waits for the application's previous deployment to finish.
2. **Build**: Sevalla clones the repository at the commit and builds a container image with the application's [build strategy](https://docs.sevalla.com/applications/builds/overview.md). The build is **Skipped** for a Docker image source, a restart, a rollback and a pipeline promotion, which reuse an existing image.
3. **Rollout**: Sevalla runs the jobs set to run before the deployment, rolls the image out to the web process, then the background workers, then the cron jobs, one after another, and finally runs the jobs set to run after it. See [Processes](https://docs.sevalla.com/applications/processes.md) for jobs and their start policies.

### Deployment statuses

| Status | API value | Meaning |
| - | - | - |
| **Queued** | `waiting` | Waiting for another deployment of the application to finish. |
| **Deploying** | `inProgress` | Building or rolling out. |
| **Deployed** | `success` | Every process runs the new version. |
| **Failed** | `failed` | The build, a job or a rollout failed, or the deployment ran out of time. The [build log](#deployment-details) shows where. |
| **Cancelled** | `cancelled` | You cancelled it while it was deploying. |
| **Skipped** | `skipped` | You cancelled it while it was queued, or it was a push whose changed files didn't match the [deploy paths](#deploy-only-when-some-files-change). |

### One deployment at a time

An application deploys one deployment at a time. A deployment you start while another one runs waits as **Queued** and starts when the running one finishes, in the order they were started. A new deployment never cancels the running one, and every push, click or hook call gets its own deployment: three pushes in a row build three times. Different applications deploy in parallel.

### Zero-downtime rollouts

Sevalla rolls out each process gradually: it starts new instances, sends them traffic once they're ready, and only then stops old instances. An old instance is taken out of traffic, then gets `SIGTERM` and the rest of its 30-second shutdown to finish its requests; see [How processes run](https://docs.sevalla.com/applications/processes.md#how-processes-run).

"Ready" means the web process's readiness probe passes. Without a readiness probe, an instance counts as ready as soon as its container starts, which can be before your server listens on its port, so visitors can get errors for a few seconds. Add a readiness probe under **Health checks** when you update the web process; see [Processes](https://docs.sevalla.com/applications/processes.md).

> [!WARNING]
>
> A process with a [disk](https://docs.sevalla.com/applications/disks.md) can't run its old and new instances side by side. Sevalla stops the old instance before it starts the new one, so every rollout interrupts the process briefly, until the new instance is ready.

### Time limits and failures

| Limit | Value | What happens |
| - | - | - |
| Whole deployment (clone, build and rollout) | 30 minutes | The deployment fails. |
| Rollout of one process | 20 minutes | Sevalla rolls that process back to its previous version and the deployment fails. |
| A job run during the deployment | 10 minutes, or the job's **Max run time** (up to 1 hour) | The job is stopped and the deployment fails. |

When a deployment fails during the build or a job that runs before it, nothing changes: the previous version keeps running. When a process's rollout fails, that process goes back to its previous version, but processes rolled out before it keep the new one. The application's status changes to **Deployment failed** in both cases. [Troubleshoot builds and deployments](https://docs.sevalla.com/applications/troubleshooting/builds-and-deployments.md) lists the common errors.

## Deploy your application

> [!NOTE]
>
> Deploying needs permission to update the application.

**1. Open the deploy sheet**

In the sidebar, click **Applications**, then click the application. On the **Deployments** tab, click **Deploy now**.

**2. Choose what to deploy**

For a Git source, check the **Branch**. It starts on the application's default branch, and Sevalla deploys its latest commit. To deploy an earlier commit, paste its full SHA or its commit link in **Commit**. For a Docker image, see [Deploy a Docker image](https://docs.sevalla.com/applications/docker-images.md#deploy-a-new-image-version).

**3. Deploy**

Click **Deploy**.

The new deployment appears at the top of the list as **Queued** or **Deploying**, and a bar at the bottom of the application's pages says **Deployment in progress**. Click it to follow the build log. The status changes to **Deployed** when every process runs the new version.

![The Manual deploy sheet with a Branch selector, a Commit field, and the Skip building (restart latest) and Skip build cache options](https://assets.sevalla.com/screenshots/light/app-deployments-deploy.png)

The **Manual deploy** sheet's fields:

| Field | Source | What it does |
| - | - | - |
| **Branch** | Git | The branch to deploy. A list for private repositories, a text field for public ones. Deploying another branch doesn't change the default branch. |
| **Commit** | Git | Optional. The commit to build instead of the branch's latest one: its full 40-character SHA, or its commit link from GitHub, GitLab or Bitbucket. Empty deploys the branch's latest commit. **Browse commits** opens the branch's commits in your Git provider. |
| **Skip building (restart latest)** | Git | Restarts the image of the last successful deployment with the current settings and runtime environment variables, without building. Build-time variables don't change, because they're part of the image. A restart turns **Commit** off, because it runs the current build. |
| **Tag**, **Digest**, **Resolved image** | Docker image | The image version to pull. See [Deploy a Docker image](https://docs.sevalla.com/applications/docker-images.md#deploy-a-new-image-version). |

A pasted commit link shows as its SHA when you leave the field. The commit must be in the branch's history, or the build fails when Sevalla checks it out. The sheet refuses anything else before deploying:

* A short SHA, a branch name or any other text: `Paste the commit’s full 40-character SHA, or its link`
* A link to a commit in another repository, such as a fork: `Paste a commit from <owner>/<repository>, not another repository`

When Sevalla can't read a deployed commit's message from the repository, the deployment is named by its short SHA, for example **Commit 4e1d9b0**.

An application whose **Source type** is **App** has no source of its own: it gets code only from [pipeline](https://docs.sevalla.com/pipelines/overview.md) promotions, and deploying it applies the current settings and environment variables to the code it already runs.

### Deploy undeployed changes

When you change a setting that needs a deployment (an environment variable, a process, the build strategy, the source), a bar at the bottom of the application's pages shows **1 undeployed change** (or more). Click **Deploy** in the bar to apply them, or click the text to review them first in the **Undeployed changes** sheet:

* **Build changes** are applied by building the application again.
* **Runtime changes** are applied by restarting it, without a new build.

With only runtime changes, **Deploy** restarts the application without building. With both, it builds, unless you turn on **Skip app building**: then it restarts with the latest build and the build changes wait for the next build.

## Deploy automatically on push

With automatic deployments on, Sevalla deploys every push to the application's default branch. They're available for private repositories on GitHub, GitLab and Bitbucket, not for public repositories or Docker images.

**1. Open auto-deploy**

On the application's **Settings** tab, in the **Auto-deploy** section, click **Update auto-deploy**.

**2. Turn it on**

Turn on **Auto-deploy** and choose the **Branch** to deploy from.

**3. Save**

Click **Update auto-deploy**.

The section's **Status** changes to **Enabled** and shows the **Default branch**. From the next push to that branch, a deployment with the trigger **Automatic** (on commit) appears on the **Deployments** tab.

![The Update auto-deploy sheet with the Auto-deploy switch, the repository and the branch](https://assets.sevalla.com/screenshots/light/app-settings-auto-deploy-update.png)

How automatic deployments behave:

* Only pushes to the default branch deploy. Pushes to other branches and pull requests don't (for pull requests, use [preview apps](https://docs.sevalla.com/pipelines/preview-apps.md)).
* Each push deploys the pushed commit and queues behind any running deployment.
* Commit messages such as `[skip ci]` don't skip a deployment. To skip pushes that change only some files, use [deploy paths](#deploy-only-when-some-files-change).
* Pushes to a suspended application, or to an application of a suspended company, don't create deployments.
* Sevalla receives pushes from GitHub through the Kinsta GitHub App, and from GitLab and Bitbucket through a webhook it adds to the repository. If it can't add that webhook, it turns automatic deployments off for the application.

## Deploy only when some files change

Deploy paths decide which pushes start an automatic deployment, by the files each push changes. Use them in a monorepo, where one repository holds more than one application, or to skip deployments for documentation-only changes. They apply only to automatic deployments on push: deploying by hand, with a deploy hook or by promotion always deploys.

**1. Open deploy paths**

On the application's **Settings** tab, in the **Deploy paths** section, click **Update deploy paths**.

**2. Choose the mode**

Click **Allow paths** to deploy only when matching files change, or **Ignore paths** to skip pushes that change only matching files. **No deploy paths** deploys every push.

**3. Add the patterns**

Enter a pattern in **Path #1**, for example `apps/storefront/**`. Click **Add deploy path** for more.

**4. Save**

Click **Update deploy paths**.

The section's **Status** changes to **Only changes in these paths deploy** or **Changes in these paths don't deploy**, followed by your patterns.

| Mode | A push deploys when |
| - | - |
| **No deploy paths** | Always |
| **Allow paths** | At least 1 changed file matches at least 1 pattern |
| **Ignore paths** | At least 1 changed file matches no pattern. If every changed file matches a pattern, the push is skipped. |

An application uses either allow paths or ignore paths, not both. A skipped push still appears on the **Deployments** tab, with the status **Skipped**.

Patterns are glob patterns matched against each changed file's path from the repository root:

| Pattern | Matches |
| - | - |
| `apps/storefront/**` | Every file under `apps/storefront/` |
| `package.json` | `package.json` at the repository root only |
| `*.md` | Markdown files at the repository root only |
| `**/*.md` | Markdown files in any folder |
| `.github/**` | Files under `.github/`. Patterns with `*` or `**` don't match files or folders whose name starts with a dot unless the pattern names the dot. |

Start patterns without `/`, and match the case of your file names: `Docs/**` doesn't match `docs/readme.md`.

> [!WARNING]
>
> Bitbucket pushes don't include the list of changed files, so deploy paths can't filter them: with deploy paths set, every push to an application built from a [Bitbucket](https://docs.sevalla.com/git/bitbucket.md#limitations) repository is skipped, and nothing deploys automatically. Use deploy paths with GitHub and GitLab repositories only.

## Deploy with a deploy hook

A deploy hook is a secret URL that starts a deployment of the application's default branch (or its saved Docker image) when it receives a `POST` request. Use it from CI, a scheduled job, or any tool that can send an HTTP request. It works for Git and Docker image sources.

**1. Enable the hook**

On the application's **Settings** tab, in the **Deploy hook** section, click **Enable deploy hook**, then confirm with **Enable deploy hook**.

**2. Copy the URL**

Copy the **Deploy hook URL**. It looks like `https://hook.sevalla.com/apps/<app-id>/deploy/<secret>`.

**3. Call it**

Send a `POST` request to the URL. It needs no body and no other authentication.

```bash theme={"theme":{"light":"github-dark-default","dark":"github-dark-default"}}
curl -X POST "$SEVALLA_DEPLOY_HOOK_URL"
```

Store the URL as a secret in your CI (here, `SEVALLA_DEPLOY_HOOK_URL`): anyone who has it can deploy the application. A deployment with the trigger **Deploy hook** appears on the **Deployments** tab.

The hook always deploys the latest commit of the default branch: it reads no body, query string or branch. Its responses:

| Status | Response or cause |
| - | - |
| `200` | `{"message": "App is being deployed", "deployment": {"id": "<deployment-id>"}}` |
| `400` | `Deployment hook is not enabled on the app` |
| `401` | The secret in the URL is missing or wrong, for example after you regenerated it. |
| `403` | The application or the company is suspended, or the company is being migrated to Oracle Cloud Infrastructure. |
| `404` | The application doesn't exist. |
| `429` | More than 10 deployments of the application are already queued. |
| `500` | `Cannot deploy the app.` |

While your company is being migrated to Oracle Cloud Infrastructure, deploy hooks return `403` with `Your company is being migrated to new infrastructure. Changes are disabled until the migration finishes.` See [During your migration](https://docs.sevalla.com/platform/oci-migration.md#during-your-migration).

To replace a URL that leaked, click **Regenerate** and confirm: the old URL stops working right away. To turn the hook off, click **Disable deploy hook** and confirm; enabling it again gives a new URL.

## Redeploy a deployment

Redeploying runs an earlier deployment again with the application's current settings and environment variables. For a Git source it builds that deployment's commit again; for a Docker image it pulls that deployment's image again.

**1. Find the deployment**

On the application's **Deployments** tab, click **⋯** at the end of the deployment's row, or open the deployment.

**2. Redeploy**

Click **Redeploy**, then confirm with **Redeploy**.

A new deployment with the trigger **Manual** starts.

## Roll back a deployment

Rolling back puts the previous version of your code back without building it again. Sevalla takes the most recent successful deployment of a different commit than the latest deployment, and rolls its image out as a new deployment. The rollback uses the application's current settings, processes and runtime environment variables; only what's inside the old image (the code and the build-time variables of that build) goes back. Rollback is available for Git sources. For a Docker image source, [redeploy](#redeploy-a-deployment) the earlier deployment instead.

**1. Find the deployment to go back to**

On the application's **Deployments** tab, click **⋯** on the successful deployment before the live one, or open it.

**2. Roll back**

Click **Roll back to this**. The **Roll back** dialog names the commit you'll get. Click **Roll back**.

A new deployment starts with the build **Skipped**. When it's **Deployed**, the application runs the earlier commit. To get the newer code back, deploy again. To stop automatic deployments from replacing the rollback on the next push, turn off [auto-deploy](#deploy-automatically-on-push) until you've fixed the code.

## Cancel a deployment

You can cancel a deployment that's **Queued** or **Deploying**. The application keeps running its current version.

**1. Find the deployment**

Click **Cancel** in the **Deployment in progress** bar at the bottom of the application's pages, click **Cancel deployment** on the deployment's page, or click **⋯** on its row, then **Cancel deployment**.

**2. Confirm**

In the **Cancel deployment** dialog, click **Cancel deployment**. **Keep deploying** closes the dialog without cancelling.

A queued deployment changes to **Skipped** right away. A running one stops and changes to **Cancelled** within a few seconds. A deployment that has already finished can't be cancelled. Build time used before you cancelled is billed.

## Deployment details

Click a deployment's message on the **Deployments** tab to open its page:

| Part | What it shows |
| - | - |
| Summary | The status, the commit message (or the image), the trigger and who started it, the date and the duration, with **Cancel deployment**, **Roll back to this** and **Redeploy** |
| Steps | **Queued**, **Build** and **Rollout**, each **Done**, **In progress**, **Not started**, **Failed**, **Skipped** or **Cancelled** |
| **Build** | The build strategy the deployment used (**Build environment**, **Build cache**, **Build path**, **Dockerfile** and the builder's settings), or **Build step** **Skipped** for a Docker image or a restart |
| **Build log** | Every line of the clone, build, push and rollout, live while the deployment runs |
| **Runtime logs** | What the deployment's processes log, from when it started. **All runtime logs** opens the [Logs](https://docs.sevalla.com/applications/logs.md) tab. |
| **Dockerfile** | Ingot and Dockerfile builds: the Dockerfile and `.dockerignore` the image was built from, and their version. **Changed** marks a Dockerfile that differs from the previous deployment's; **Changes** shows the difference and **Full file** the whole file. **History** opens the [Dockerfile history](https://docs.sevalla.com/applications/builds/overview.md#dockerfile-history). |
| **Details** | **Image**, **Deployed branch**, **Commit**, **By** (the commit author), **Started at**, **Finished at**, **Trigger** and **Data center location** |
| **Changeset** | The settings this deployment applied besides the code, as **Build changes** and **Runtime changes**, each with its old and new value |

Log lines can take up to 2 minutes to appear. When a deployment you're watching finishes, the page switches to its runtime logs. In the list on the **Deployments** tab, **Dockerfile changed** marks a deployment built from a new Dockerfile version.

![A deployment's build log with the Nixpacks build plan, the image push and the rollout](https://assets.sevalla.com/screenshots/light/app-deployments-detail-build-log.png)

The **Trigger** says how the deployment started:

| Trigger | Started by |
| - | - |
| **Automatic** (on commit) | A push to the default branch with [auto-deploy](#deploy-automatically-on-push) on, or a [preview app](https://docs.sevalla.com/pipelines/preview-apps.md) |
| **Manual** | **Deploy now**, **Redeploy**, **Roll back to this**, **Deploy** in the undeployed changes bar, the API or the CLI |
| **Deploy hook** | A call to the [deploy hook](#deploy-with-a-deploy-hook) |
| **Promoted** (from an application) | A [pipeline](https://docs.sevalla.com/pipelines/overview.md) promotion from that application |

Sevalla also passes the deployment's details to the build as environment variables, such as `SVL_DEPLOYMENT_ID`, `SVL_DEPLOYMENT_COMMIT_SHA` and `SVL_DEPLOYMENT_BRANCH`. See [Variables Sevalla sets](https://docs.sevalla.com/applications/environment-variables.md#variables-sevalla-sets).

## API and CLI

| Task | API | CLI |
| - | - | - |
| List deployments | [List deployments](https://api-docs.sevalla.com/v3/applications/list-deployments) | `sevalla apps deployments list --app-id <app-id>` |
| Get a deployment | [Get deployment](https://api-docs.sevalla.com/v3/applications/get-deployment) | `sevalla apps deployments get <deployment-id> --app-id <app-id>` |
| Deploy (a branch, a commit with `commit_sha`, an image, or a restart with `is_restart`) | [Trigger deployment](https://api-docs.sevalla.com/v3/applications/trigger-deployment) | `sevalla apps deployments trigger <app-id> --branch main` |
| Roll back | [Rollback deployment](https://api-docs.sevalla.com/v3/applications/rollback-deployment) | `sevalla apps deployments rollback <app-id>` |
| Cancel a deployment | [Cancel deployment](https://api-docs.sevalla.com/v3/applications/cancel-deployment) | `sevalla apps deployments cancel <deployment-id> --app-id <app-id>` |
| Read the build log | [Get application deployment logs](https://api-docs.sevalla.com/v3/applications/get-application-deployment-logs) | `sevalla apps deployments logs <deployment-id> --app-id <app-id>` |
| Get, enable, regenerate or disable the deploy hook | [Get](https://api-docs.sevalla.com/v3/applications/get-deployment-hook-url), [enable](https://api-docs.sevalla.com/v3/applications/enable-deployment-hook), [regenerate](https://api-docs.sevalla.com/v3/applications/regenerate-deployment-hook), [disable](https://api-docs.sevalla.com/v3/applications/disable-deployment-hook) deployment hook | `sevalla apps deployment-hook get <app-id>` (also `enable`, `regenerate`, `disable`) |
| Turn auto-deploy on or off, set deploy paths | [Update application](https://api-docs.sevalla.com/v3/applications/update-application) (`auto_deploy`, `default_branch`, `allow_deploy_paths`, `ignore_deploy_paths`) | Not available |

In the API, the deployment's `trigger` field holds `MANUAL_DEPLOY`, `AUTO_DEPLOY`, `DEPLOY_HOOK`, `PROMOTE` or `ROLLBACK_DEPLOYMENT`, and `type` is `manual` or `automatic`. The build log endpoint returns the last hour unless you pass `from`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.