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

# Run SimpleCloud on multiple machines

> Add serverhosts to one network and keep their shared files synchronized

Use multiple serverhosts when you want one SimpleCloud network to run servers across several machines.

The setup has three parts: add the new serverhost, synchronize the shared files, and verify that the host is ready.

## Before you begin

You need:

* A SimpleCloud network with one working serverhost
* A supported Linux or macOS machine with root or sudo access
* Network access between the serverhosts

Choose the existing serverhost that contains the files you want to keep as the
**primary sync host**. You will run the initialization and approval commands on
this host.

## Add the serverhost

<Steps>
  <Step title="Create an installation command">
    Open the [SimpleCloud dashboard](https://dash.simplecloud.app), select your
    network, and go to **Settings > Server Hosts**. Select **Add Host**.
  </Step>

  <Step title="Install SimpleCloud">
    Copy the generated command and run it on the machine you want to add. The
    command installs SimpleCloud, registers the serverhost, and starts it.

    <Warning>
      The command contains a temporary sign-in code. Treat the complete command
      as sensitive and run it only on the intended machine.
    </Warning>
  </Step>
</Steps>

## Synchronize shared files

Serverhosts need the same files when they can run the same servers. SimpleCloud
does not synchronize these directories by default. After you configure and
enable synchronization, it keeps these directories synchronized:

* `templates/` contains the files used to prepare servers
* `workflows/` contains preparation and cleanup workflows
* `options/` contains configurator settings and platform mappings

The managed cache inside `templates/cache/` is excluded. Each serverhost creates its own cache and archived logs.

<Warning>
  Do not synchronize `secrets/`, `running/`, or `logs/`. Credentials must remain
  unique to each serverhost, and running servers and logs stay on the host that
  created them.
</Warning>

On Linux, the CLI offers to install and start Syncthing when needed. On macOS,
install and start it before continuing:

```bash theme={null}
brew install syncthing jq
brew services start syncthing
```

<Steps>
  <Step title="Initialize synchronization">
    On the primary sync host, run:

    ```bash theme={null}
    sc sync init --name serverhost-1
    ```

    Use a unique, recognizable name for each host. When the command finishes,
    it prints the complete join command for the new host.

    <Note>
      If your serverhost runs as root, add `--as-root` and use that option for
      every `sc sync` command on the host.
    </Note>
  </Step>

  <Step title="Join the new serverhost">
    Run the generated `sc sync join ...` command on the new serverhost. It
    prints an approval command when it finishes.
  </Step>

  <Step title="Approve the serverhost">
    Run the generated `sc sync approve ...` command on the primary sync host.
    Synchronization starts automatically after the hosts connect.
  </Step>
</Steps>

To add another serverhost later, first install it with a new **Add Host** command
from the dashboard. Then run the following command on the primary sync host and
follow the generated join and approval commands:

```bash theme={null}
sc sync add --join-name serverhost-3
```

## Verify the setup

Run this command on both serverhosts:

```bash theme={null}
sc sync status
```

Under **Peers**, each other serverhost should show as `connected`. Under
**Managed folders**, `templates`, `workflows`, and `options` should each show as
`configured`.

<Tip>
  Make changes on one serverhost at a time to avoid synchronization conflicts.
</Tip>

## Fix an interrupted setup

* If you lose the join command, run `sc sync add` again on the primary sync
  host to generate a new one.
* If joining or approval stops with an error, fix the reported problem and
  rerun that command. The commands keep existing synchronization settings.
* If a peer shows as `offline`, confirm both serverhosts are running and can
  reach each other. If a firewall blocks direct connections, allow TCP and UDP
  port `22000` between the hosts.
* If you use `--as-root`, include it when running `sc sync status` or retrying a
  setup command on that host.

If an additional host has the wrong synchronization configuration, run
`sc sync reset` on that host. This removes its synchronization settings but
keeps the synchronized files. Then generate a new join command on the primary
sync host and repeat the join and approval steps.

## Next steps

* [Create and manage templates](/docs/en/manual/setup/templates)
* [Configure workflows](/docs/en/manual/configuration/workflows)
* [Choose which serverhosts run a group](/docs/en/manual/setup/server-groups#choose-where-servers-can-run)
