# Caddy load balancer install

### Overview

The distributed system installs with multiple Somewear Core application nodes will need a load balancer to distribute traffic.  Cloud-native load balancers are often the best choice, but these cannot always be used in every situation.  When it comes to Azure, their Application Gateway cannot be used since it [does not support HTTP/2 all the way to the backend servers](https://learn.microsoft.com/en-us/azure/application-gateway/configuration-listeners#http2-support).  In this case, we can use a virtual machine running [Caddy](https://caddyserver.com/) to serve as our load balancer.

Interested in an on-premises deployment?  Reach out to <hello@somewearlabs.com> for more info.

### Requirements

* 1 or more servers running Ubuntu or Debian Linux
  * 2 CPU cores
  * 4 GB RAM
  * 40 GB disk storage
  * Somewear Labs Pilot CLI tool

### Installation Steps

Run the installation script.  This will install Caddy, setup the Pilot CLI tool and the pilot user which will be used to run the tool.  The script will also initialize the necessary configuration directories.

```
curl -sSL https://get.somewear.app/core/install_caddy.sh | bash
```

Switch to the pilot user and initialize the Pilot configuration file.

```
sudo su - pilot
pilot load-balancer init
```

Next, use Pilot to create the Caddy's configuration file.

```
pilot load-balancer config
```

Finally, log out of the pilot user account and restart the Caddy service using a privileged user with sudo access.

```
sudo systemctl restart caddy.service
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.somewear.app/self-hosting-docs/caddy-load-balancer-install.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
