# Deploy API Maker

> Upgrade API Maker on every server of the cluster from the admin panel, from npm or from a .tgz bundle, with live progress for each server.

Source: https://docs.apimaker.dev/v1/docs/features/deploy-api-maker.html

- Install another version of API Maker on every server of the cluster from the **Deploy API Maker** page of the admin panel.
- This page upgrades API Maker itself. To deploy your APIs, use a Git pull. Learn more [Git](https://docs.apimaker.dev/v1/docs/Git/git.html).

> Diagram : Deploy API Maker : admin panel → Caddy → API Maker → Redis → every server (5 stages, live progress) → restart, wait for the new version, reload
>
> How Deploy API Maker upgrades a cluster : the admin panel sends the chosen npm version or an uploaded bundle through Caddy to API Maker, which downloads it from npm if needed and sends it through Redis to one process of every server. Each server writes and extracts the bundle, clears the old install while keeping .env, local.env and license.txt, copies the new files, runs npm install and writes the environment into the admin panel, and reports every stage live over the WebSocket. When every server is done the page restarts all processes : each one exits and API Maker starts it again on the new files, then the page waits until they answer on the new version and reloads. An error or no answer within 20 minutes restarts nothing.

## Two ways

- **Deploy from NPM**: pick a published version and click **Deploy**. It is downloaded from the official npm registry.
- **Upload a bundle**: select a local API Maker `.tgz` or `.tar.gz` file, up to 100 MB.

## What happens on each server

1. The bundle is written to disk and extracted.
2. The old install is cleared. `.env`, `local.env` and `license.txt` are kept.
3. The new files are copied into place.
4. Dependencies are installed.
5. The environment is written into the bundled admin panel.

- The page shows a card per server and the live log of each stage.
- When every server has installed it, the page restarts all backend processes and waits until they answer on the new version.
- If a server reports an error or does not answer in time, the cluster is not restarted.

## Good to know

- A deployment waits up to 20 minutes for the servers to finish.
- If the WebSocket connection of the page is down, the deployment keeps running and the page reports the result when it ends.
