> For the complete documentation index, see [llms.txt](https://docs.nalpeiron.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/local-license-server-installation.md). Agents can also search and read this documentation through its [MCP server](https://docs.nalpeiron.com/~gitbook/mcp).

# Local License Server Installation

Install the Zentitle2 Local License Server (LLS) with Docker and PostgreSQL, from pulling the image and setting the required environment variables to checking that the server is ready.

The Local License Server (LLS) is a Docker application that stores its data in a PostgreSQL database. You can run it with any Docker tool, such as Docker Compose, but Nalpeiron recommends an orchestration platform, such as Docker Swarm or Kubernetes, for production sites.

### Requirements

The customer site needs the following to run the LLS:

| Requirement                     | Details                                                                                                                                                                                                                                                            |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Docker host                     | A host that runs Docker containers.                                                                                                                                                                                                                                |
| PostgreSQL version              | A version that the PostgreSQL project still supports, as listed in its [versioning policy](https://www.postgresql.org/support/versioning/). Nalpeiron recommends the latest minor release of PostgreSQL 18.                                                        |
| PostgreSQL database             | An existing, empty database for the LLS, owned by the database user that the LLS connects as. The LLS creates and changes its tables at startup. While it runs, it also creates log partitions every day, and drops old ones when `LlsLogs__RetentionDays` is set. |
| Package Registry credentials    | A user name and password to pull the LLS image from the Nalpeiron container registry. Create them in Zentitle2, as described in [Package Registry](https://docs.nalpeiron.com/zentitle2-docs/ui-administration/api-credentials/package-registry.md).               |
| Network access for applications | Applications must reach the LLS on the customer's network. The examples on this page use port 6501.                                                                                                                                                                |
| HTTPS, if required              | A certificate for the LLS, also when a reverse proxy serves HTTPS in front of it. See [Serve the LLS over HTTPS](#serve-the-lls-over-https).                                                                                                                       |
| Redis, for several nodes        | Needed only when two or more LLS nodes share one database. See [LLS High Availability](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/high-availability.md).                                                           |

### Download the LLS image

Sign in to the container registry with your Package Registry user name by running the following command, and enter the Package Registry password when Docker asks for it:

```bash
docker login registry.gitlab.com -u <username>
```

Download the image by running the following command, replacing `<version>` with a version from the [LLS Release Notes](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/lls-release-notes.md):

```bash
docker pull registry.gitlab.com/nalpeiron/zentitle/local-license-server:<version>
```

### Required settings

The LLS reads its configuration only from environment variables. Set the following variables on the LLS container:

| Variable                      | Value                                                      |
| ----------------------------- | ---------------------------------------------------------- |
| `ConnectionStrings__Database` | Connection string for the PostgreSQL database              |
| `Authentication__Username`    | User name for the LLS web interface and the Management API |
| `Authentication__Password`    | Password for the LLS web interface and the Management API  |

The LLS listens for HTTP on port 8080 unless `ASPNETCORE_URLS` sets another address. The examples in this guide use port 6501. In a Docker Compose file, an LLS that listens on port 6501 is configured as follows:

```yaml
environment:
  ConnectionStrings__Database: "Server=lls-db;Database=lls;User Id=lls;Password=<password>"
  Authentication__Username: "<user-name>"
  Authentication__Password: "<password>"
  ASPNETCORE_URLS: "http://0.0.0.0:6501"
```

The LLS doesn't start without the connection string and both credentials. For every other setting, see [LLS Configuration Reference](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/configuration-reference.md).

{% hint style="warning" %}
The web interface and the Management API share one user name and password, and the Management API receives them with every request through Basic authentication. Choose a strong password, and use HTTPS when administrators connect over a network.
{% endhint %}

### Start the LLS

When the LLS starts, it applies its database migrations, which create its tables on the first start, and then begins to serve requests. To check that it's ready, send the following request:

```bash
curl http://localhost:6501/health/ready
```

The response is `Healthy` when the LLS can reach its database and has finished starting. The LLS serves the following addresses for administrators:

| Address        | Purpose                                                                                                      |
| -------------- | ------------------------------------------------------------------------------------------------------------ |
| `/ui`          | The LLS web interface. Sign in with the values of `Authentication__Username` and `Authentication__Password`. |
| `/swagger`     | The interactive reference for the LLS Management API                                                         |
| `/health`      | A detailed health report                                                                                     |
| `/health/live` | A check that the process responds, without testing the database                                              |

If applications and administrators reach the LLS from different networks, let application networks reach only the Licensing API, and allow `/ui`, `/swagger`, and `/api/v1/lls` only from administrators' networks, for example with rules in a reverse proxy.

Next, activate the LLS license, as described in [LLS License End-User Management](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/lls-license-end-user-management.md). Until the license is active, the LLS answers Licensing API requests and entitlement operations with HTTP 405.

### Serve the LLS over HTTPS

The examples on this page serve HTTP. To serve the LLS over HTTPS, configure a certificate on the LLS. Set an HTTPS address in `ASPNETCORE_URLS`, and set the certificate file and its password in `ASPNETCORE_Kestrel__Certificates__Default__Path` and `ASPNETCORE_Kestrel__Certificates__Default__Password`.

You can also terminate TLS at a reverse proxy, such as NGINX, HAProxy, or a Kubernetes ingress controller. The LLS still needs its own certificate in that setup, because its web interface calls the LLS API over HTTPS, so the proxy forwards the requests to the LLS over HTTPS.

The setup must meet the following requirements:

* WebSocket connections on `/ui` are allowed, because the web interface keeps a WebSocket connection open to the LLS. If a proxy or a firewall blocks WebSockets, set `Ui__UseLongPollingTransport` to `true`.
* The LLS can reach the address that administrators open in their browsers, and it trusts the certificate served there. The web interface runs on the LLS and calls the LLS API at that address.

The [LLS samples repository](https://github.com/Nalpeiron/samples-lls) has complete setups: the `ssl` sample serves HTTPS from the LLS alone, and the `haproxy-ssl` and `nginx-ssl` samples add a reverse proxy. For more than one LLS node, the load balancer has further requirements, described in [LLS High Availability](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/high-availability.md).

### Upgrade the LLS

To upgrade, pull the new image version and start the LLS with the same database and settings. The LLS applies any new database migrations when it starts, before it serves requests.

When several LLS nodes share one database, upgrade them one at a time, so that the other nodes keep serving applications. If the release notes of the new version say that all nodes must stop, stop every node first, and then start the nodes on the new version one at a time.

{% hint style="warning" %}
LLS 2.0.0 and later can't use a database created by LLS 1.x. Before you move an LLS from version 1.x to 2.x, deactivate its license, and apply the Deactivation Token in Zentitle2 so that its entitlements return to the cloud. Then start version 2.x with a new, empty database, activate its license, and export the entitlements to it again.
{% endhint %}

### Run the demo application

The demo runs the LLS and a PostgreSQL database on your own machine with Docker Compose. It uses the simple sample from the [LLS samples repository on GitHub](https://github.com/Nalpeiron/samples-lls), which also has examples with HTTPS and with several nodes. Follow these steps to start it:

1. Sign in to the container registry, as described in [Download the LLS image](#download-the-lls-image).
2. Download the [simple Docker Compose file](https://github.com/Nalpeiron/samples-lls/blob/master/simple/docker-compose.yml) and save it as `docker-compose.yml`.
3. In the file, set the image tag of the `zentitle-lls` service to a version from the [LLS Release Notes](https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/lls-release-notes.md), replacing the version in the sample.
4. Change the values of `Authentication__Username` and `Authentication__Password`, and the database password in `POSTGRES_PASSWORD` and in the connection string. The sample's values are public.
5. Start the demo by running the following command in the folder that contains the file:

   ```bash
   docker compose -f docker-compose.yml up -d
   ```
6. Open the [LLS web interface on port 6501](http://localhost:6501/ui) and sign in with the credentials from the file.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nalpeiron.com/zentitle2-docs/ui-local-license-server/local-license-server-lls/local-license-server-installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
