# Several servers and gradual rollout

Run one site on more than one server, spread visitors with a load balancer, run copies of a Node.js app, try a new version on one server first.

A busy site can run on more than one server, so it answers more visitors and keeps answering if one server stops. Each update then goes to every server.

A site on several servers (**Servers this site runs on**) is part of the Business plan. Load balancers are part of the Pro and Business plans: on Pro, add the site to each website server yourself, with the same address, and publish each one's updates on its own (see [Load balancer](#load-balancer)).

## Servers this site runs on

Open the site's **Settings** tab, then **Servers this site runs on** (technical name: deploy network, multi-server deploy). It lists the servers of the site. The first one is the **Main server**: it is the one with the site's HTTPS certificate, backups, logs and monitoring.

![Servers this site runs on, with the main server, Add a server and what is shared or kept per server](https://internal.fuzops.com/docs-img/site-servers.webp "Servers this site runs on.")

### Add a server

1. Under **Add a server**, choose a **Server**. Only servers of this team that can host websites are listed; a server that cannot take this site says why (for example a missing PHP version).
2. Choose **Add this server**.

The site is installed there the same way, then the live version is published on it. The server's menu on the list has **Set up again** and **Remove from this server**.

### What is shared and what is kept per server

| The same on every server | Kept per server (the site's pages act on the main server) |
|---|---|
| The code and each update, going back to an earlier version | HTTPS certificates (a load balancer can handle HTTPS for all servers) |
| The settings file (Environment) | Backups, logs, visits and errors, uptime |
| The update steps, and builds sent by your CI | Scheduled jobs, so they run once |
| Background workers of the site (a copy on each server) | Uploaded files and other shared folders |
| The after-update check | The database, when it is on the server itself |

> **Warning:**
> Uploaded files stay on the server that received them, and a database on the server itself belongs to that server. Before you add a second server, store uploads in one shared place (a database or file storage) and point the settings file of every server at one database.

## How an update goes across servers

**Update settings** › **Across servers** sets the **Order**:

- **One server at a time**: the main server first. If one fails, the update stops and the servers after it keep the version they have.
- **All servers at the same time**: faster. A failure on one server does not stop the others.

The update page shows one part per server ("server 1 of 2 · main"), with its steps. A server that was not updated says so, for example "Not updated: … kept the version it had".

Your own update steps choose **Where this step runs**: **Every server**, **Only the first server** (the safe default for database changes) or **Chosen servers**.

![Across servers: the order of an update and gradual rollout](https://internal.fuzops.com/docs-img/site-across-servers.webp "Across servers, in Update settings.")

## Gradual rollout

**Try the new version on the main server first** (technical name: canary) updates the main server, then watches it for a few minutes. The update page shows what is watched: **Visits answered**, **Failed answers** (5xx), and the **Check page** with how long it took. The other servers follow only if the after-update check answers and few answers fail. Otherwise the main server goes back to the version before (**Put back**) and the update stops.

The rollout works across servers: it does not send a share of one server's visitors to the new version.

## Load balancer

A **Load balancer** (technical name: HAProxy) is a server that shares visitors between several website servers and keeps your site up if one stops. Create one with **Add a server** and the kind **Load balancer**. Your load balancers are listed under **Load balancers** on the **Sites** page. On the load balancer's **Sites it shares out**, the headline says how many sites it shares across how many servers, and **Share out a site** adds one: give the **Address**, then for each website server pick **Site on it**. Fuzops fills in how to reach it, and uses the servers' private network when they share one. If the server runs something Fuzops did not set up, choose **Another address and number (advanced)** and give the number it answers on. The change is checked before it goes live.

**How visitors are shared** (technical name: balancing method):

| Choice | Technical name | What it does |
| --- | --- | --- |
| **One after another** | Round robin | Each new visitor goes to the next server in turn. |
| **Fewest active visitors** | Least connections | Each new visitor goes to the server that is busy with the fewest people right now. |
| **By visitor address** | Source / IP hash | The same visitor address always goes to the same server. |

Other settings of a shared-out site:

- **Keep each visitor on the same server** (sticky sessions): a small cookie remembers the server, so a signed-in visitor or a shopping cart stays put. Scripts on the page cannot read it, and once HTTPS is on it is only sent over HTTPS. With **By visitor address** it is not needed, so it is turned off.
- **Secure the address with HTTPS** (SSL): the load balancer gets a free Let's Encrypt certificate that renews on its own, and sends plain http:// visitors to https://. Point the address at the load balancer first. Fuzops checks the address before asking: until it points at the load balancer the site shows **Waiting for the domain** with the reason, and Fuzops checks again every 10 minutes for three days. Use **Check HTTPS again** once you have changed the address. If the certificate cannot be issued, the site shows **HTTPS failed** with the reason the certificate authority gave. Turning HTTPS off removes the certificate.
- **Page used to check a server is answering** (health check path): the load balancer asks each server for this page every few seconds. A server that stops answering gets no visitors until it answers again. Usually `/`.

Open a shared-out site to see its servers. **Stop sending new visitors** lets the visitors already on a server finish while new ones go to the others, for example before maintenance; **Send visitors again** undoes it. At least one server keeps taking visitors.

**Live numbers** (technical name: HAProxy stats) shows, for each shared-out site and each server, whether it answers, the visitors right now and per second, the totals since the load balancer last started, errors and the data sent and received. Choose **Refresh**, or leave **Refresh every 15 seconds** on while the panel is open. The numbers are read from the load balancer itself; no stats page is opened to the internet.

The website servers a load balancer sends visitors to see each visitor's own address in their logs and limits, not the load balancer's: Fuzops sets this up when a server is added to a load balancer and undoes it when the server is taken out.

When a site that a load balancer shares out joins another server through **Servers this site runs on**, that server is added to the load balancer automatically, and removed before it leaves. **Servers this site runs on** lists the servers each load balancer sends visitors to, and warns about a server the site runs on that the load balancer does not use yet.

Load balancers created before these settings existed keep working as they are. HTTPS on the load balancer, keeping visitors on one server, the check page, pausing a server and live numbers need a newer load balancer: create a new **Load balancer** and share the sites out from it.

## Copies of the app

A Node.js app can run more than once on the same server, so it answers more visitors at once and keeps answering if one copy stops. Technical name: instances, cluster mode.

1. Open the site's **Updates** › **Update settings**.
2. Set **Copies of the app**: between 1 and the number of processors of the server.
3. Choose **Save and apply**.

Each copy uses its own memory. Most apps work as they are; an app that keeps visitors' sessions in its own memory needs them stored elsewhere first (for example in Redis or the database).

![Copies of the app, with the number of copies and Save and apply](https://internal.fuzops.com/docs-img/site-copies-of-the-app.webp "Copies of the app, for Node.js sites.")

## Related

- [Guide: run one site on two servers](https://internal.fuzops.com/docs/guides/run-one-site-on-two-servers)
- [Updates](https://internal.fuzops.com/docs/updates)
