---
url: https://docs.zenavo.app/deploy/how-deploys-work
---

# How Deploys Work

Each service deploys on its own. **Deploy** (or **Redeploy**) on a service builds or pulls that service and restarts it with its current settings; the project's other services keep running exactly as they were. Adding a service deploys it automatically, and networking changes redeploy the service they belong to.

To roll out every service at once, for example after editing several, use **Deploy all** in the project's **Settings**. Deploy all also removes services you deleted from the project.

## Steps

Each service moves through these states, shown on its Overview and in the sidebar:

| State | What is happening |
|---|---|
| **Pending** | Waiting its turn in the deployment |
| **Building** | A Git service is being built on Zenavo's build machines |
| **Deploying** | Kubernetes objects are being applied to the server and the containers start, until they pass their [health check](https://docs.zenavo.app/operations/health-checks) |
| **Running** | All instances are ready |
| **Failed** / **Crashed** | The build or rollout failed, or the container keeps exiting. Open **Logs** for the reason. |

1. **Build.** Git services are cloned and built ([Build Plan](https://docs.zenavo.app/deploy/build-plan)), and the image is stored in Zenavo's image store, one repository per service, from which servers pull it (servers in mainland China from a copy in Shanghai). Image services are resolved to a digest, so a rollback runs exactly the same image.
2. **Apply.** The service is applied; with Deploy all, all services are applied at the same time. Each service ends on its own: it shows **Running** as soon as it is ready, and one that fails does not hold up or fail the others. The deployment as a whole fails if any service failed, and the notification names those services. Dependencies only matter for initialization commands (step 4): they wait until the services the service depends on are ready, and if one of those fails, they do not run and the service fails too.
3. **Roll out.** Services without volumes update with zero downtime: the new instance must be healthy before the old one stops. Services with volumes stop first and then start, so two instances never write to the same data. The old instance has 10 seconds to exit once it is asked to stop (30 seconds for a database such as PostgreSQL, MySQL or Redis) before it is stopped forcibly.
4. **Initialize.** If a service has initialization commands (from a template), they run once in a job with the same image, variables and volumes before the service starts.

## While another deployment runs {#deploy-queue}

You can deploy, and change settings, while a deployment or another operation of the project runs. Deployments of different services run at the same time: each builds on its own, and they roll out one after another. Another deployment of the same service, **Deploy all**, and a service deployment after **Deploy all** wait instead: they are queued and start when the deployment they wait for finishes; the project's Deployments list and the service's Overview show them as **Queued** with what they wait for. Other projects on the same server build at the same time too.

- A queued deployment deploys the settings saved by the time it starts, and the project's other services keep the versions rolled out last, also by a deployment of another service that finished meanwhile, so nothing goes back to an older version.
- Asking again for what is already queued adds nothing: another deploy of the same service joins the queued one, and **Deploy all** replaces the service deploys queued before it.
- Up to 5 deployments of a project can wait at a time.
- **Cancel** removes a queued deployment that has not started. Saved settings stay saved and apply on the next deployment.
- When it starts, a queued deployment is checked again: build minutes, domains, initialization commands. If it is no longer allowed, it fails without changing anything on the server, and you are notified as for any failed deployment.

Rollbacks, restarts, backups and restores, stopping a project and moving it still need the project to themselves: they are refused while a deployment runs or waits. Try again when it finishes, or cancel the queued deployments.

## Build queue

Git builds run on Zenavo's build machines, which every team shares. A team runs as many builds at a time as its plan allows (see [Usage & Billing](https://docs.zenavo.app/account/billing)); further builds wait, and their log says so.

Free and Dev build on the shared build machines (2 vCPU · 8 GB), one build at a time per team. Pro and Team build on priority build machines (4 vCPU · 16 GB), 2 and 4 builds at a time, and use the shared machines too when theirs are busy. A Git service's **Settings** shows its team's **Build spec**: the machine, how many builds run at once, the time limit and this month's build minutes, with the plan that builds faster; team owners can upgrade from there.

When the build machines are busy, a freed machine goes to the waiting build of the highest plan: Team, then Pro, then Dev, then Free, the earliest first within a plan. A build that has waited 10 minutes goes next whatever its plan, so no build waits for long. Deploying a Docker image or a database builds nothing and never waits here.

## If Zenavo restarts during a deployment

Zenavo's control plane restarts now and then, for example when it is updated. A deployment it was running carries on from where it was, and its log says so (*Control plane restarted; resuming from …*):

- **While building:** the deployment is queued again and builds once more.
- **After the build:** the images it built are deployed as they are, without building again.
- **While rolling out:** your server keeps rolling out by itself. Zenavo applies only the services it had not reached yet, waits for the others to become ready, and then marks the deployment succeeded or failed and notifies you as usual.

If a service's initialization command (a database migration, say) was running at that moment, Zenavo neither stops it nor runs it again: the deployment is marked **interrupted**, so you can check the command's result before you deploy again. A deployment resumes after at most 2 restarts; after a third it is marked interrupted as well. Other operations, such as backups or moving a project, are never repeated automatically: they are marked interrupted for you to check.

## When another service fails

Each service has its own deployment result. If a project deployment stops before a service starts rolling out—for example, another service cannot build—that service’s attempt shows **Cancelled**, while the project deployment remains **Failed**. Its previous version keeps running. Only services that actually failed are marked failed; an attempt that never rolled out does not clear an earlier failure.

## Logs

Each deployment's output is under **Logs** → **Build Logs** while it runs and afterwards. See [Logs](https://docs.zenavo.app/operations/logs).
