> For the complete documentation index, see [llms.txt](https://docs.layeronecloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layeronecloud.com/network-monitor/operations/central-server.md).

# Central server

Railway is the initial production target; follow docs/railway.md.

Railway is the initial production target; follow `docs/railway.md`. The Compose stack remains available for local or self-hosted operation. For Compose, supply the public HTTPS certificate as `deploy/tls/server.pem` and its key as `deploy/tls/server-key.pem`, then populate `.env` and start the stack.

Run these commands inside the web container after first startup:

```sh
python manage.py migrate
python manage.py ensure_metric_partitions --days-ahead 2
python manage.py create_operator admin
```

`create_operator` provisions TOTP immediately and prints its setup URI and recovery codes once. Active Django users created through another trusted workflow are prompted to enroll TOTP after their first successful password login. Staff users receive write access; non-staff users are enrolled as read-only operators.

The web container runs `collectstatic`, applies all database migrations, and ensures current metric partitions before starting Uvicorn. Railway pre-deploy migrations remain enabled so schema errors stop a deployment before traffic is switched, while the startup step also protects deployments that do not apply the Railway IaC configuration.

Unhandled request exceptions are written to the container's standard error at `ERROR` level with their traceback, while clients receive a generic branded error page. Set `L1_LOG_LEVEL` to control application logging verbosity; it defaults to `INFO`.

Run `maintain_metrics` hourly and `resolve_mac_vendors` every fifteen minutes. The provided Compose definition does both, and the web container itself supervises `run_alert_dispatcher`, `sync_pulsar_inventory --loop`, `sync_pulsar_ddos --loop`, and `run_telemetry_workers`, which keeps as many `process_telemetry` workers running as **Agents & Settings > Telemetry processing** asks for. Configure the Pulsar Operations Admin API URL, token, and site-to-cluster mappings from **Agents & Settings** in the Network Monitor; the token is encrypted in the database and should not be added to `.env`.

Inventory is imported every five minutes by the loop inside the web container, which keeps it inside the fifteen minutes after which imported inventory is too old to name a device from. Set `L1_PULSAR_SYNC=0` to run it elsewhere as `python manage.py sync_pulsar_inventory --loop`, which is safe to run in more than one process because each import is claimed in the database, or `L1_PULSAR_SYNC_SECONDS` to change the interval. **Sync now** in the console runs exactly the same import. In production, the Admin API URL must be a public HTTPS hostname ending in `/api/admin/v1/`. Local loopback HTTP or HTTPS endpoints are accepted only while Django `DEBUG` mode is enabled.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.layeronecloud.com/network-monitor/operations/central-server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
