02 / Install & self-host
Runtime and outbound traffic
On this page 7
The switches that decide how an installation holds AI answers, records usage, and calls other hosts. A new install leaves the conservative value in place. Changing one does not change what people see in chat, except a refused outbound call and a server that is too busy to take another stream.
Feature flags (tools, sharing, file work) are on Administration. Approvals are on Tools and approvals. Provider keys and the model catalog are on AI providers and models.
The same keys, for people reading the application repository: docs/RUNTIME_OPTIONS.md.
Where a setting lives#
| Kind | Examples | Takes effect |
|---|---|---|
| Environment variable | Worker counts, the capacity watchdog, the HTTP proxy | When the container starts |
| Operate → System configuration | Outbound mode and the extra host list | On save. No restart. |
A global BCONFIG row, owner 0 |
Usage recording (AI / USAGE_HOOK) |
After the web, worker and scheduler processes start again. There is no screen for this row. |
An environment pin wins over the database for the feature flags on Administration. The settings on this page are not those flags: an empty environment variable does not override them.
PHP worker pools#
Production worker mode (APP_ENV=prod) runs two PHP pools. streams serves the long AI routes: chat and re-attach, the widget message, both coding APIs, the dictation stream, spoken answers and /mcp. api serves every other request, so a server full of streams still answers a short one. A development stack does not use worker mode.
| Variable | Default | Meaning |
|---|---|---|
FRANKENPHP_WORKER_NUM |
16 |
Workers in the api pool |
FRANKENPHP_STREAM_WORKER_NUM |
the same count as the api pool | Workers in the streams pool |
FRANKENPHP_MAX_WAIT_TIME |
15s |
How long a request waits for a free worker |
FRANKENPHP_NUM_THREADS |
unset | Total threads. Leave unset unless you need a cap |
FRANKENPHP_MAX_THREADS |
unset | Upper bound. Leave unset unless you set the total |
A request that waits longer than FRANKENPHP_MAX_WAIT_TIME is answered at once with HTTP 503, a server_busy body and Retry-After: 5. Chat and the widget retry three times, then say the server is busy and offer Try again.
Each stream worker can hold a database connection. Check Galera max_connections before you raise FRANKENPHP_STREAM_WORKER_NUM, and change one server first.
Capacity#
Every role (web, background work, scheduled jobs) starts a small watchdog beside its main process. The watchdog writes how loaded that server is. Operate → Capacity (/admin/capacity) shows one card per server. Administrators only. The page changes nothing.
| Variable | Default | Meaning |
|---|---|---|
SYNAPLAN_WATCHDOG |
1 |
0 does not start the watchdog. Capacity disappears from the menu, and /admin/capacity is not a page. |
SYNAPLAN_SERVER_ID |
the container hostname | The name on the card. Set it when a container id is not a name you recognise. A worker that shares the id appends its role (web1-worker). |
SYNAPLAN_HOST_NAME |
unset | The machine name, when it differs from the server id. |
SYNAPLAN_NODE_ADDRESS |
unset | The machine's address on the card. 127.0.0.1 is never shown. |
Do not put SYNAPLAN_SERVER_ID or SYNAPLAN_NODE_ADDRESS in an environment file that several machines load. They would all report as one server.
A server that has not reported for 24 hours leaves the list. The first report arrives within a minute of the process starting. :8098, where the watchdog listens, stays inside the container unless you publish it.
Usage recording#
Who writes the usage row for an AI call. The row is what Account → Usage and Operate → Overview → Usage show. A new install uses legacy, and a later start does not overwrite a value you chose.
There is no field for this. It is the global row group AI, setting USAGE_HOOK, owner 0.
| Value | What happens |
|---|---|
legacy |
Each caller writes its own usage row. This is the default. |
shadow |
Callers still write the row. The shared pipeline compares its own count and records ai.usage_mismatch when they differ. The event names the action, provider, model and the difference. It does not contain the prompt or the answer. |
on |
The pipeline writes the row for calls that go through it, and the old writer does not write a second one. The rate limit is checked in the pipeline before the call. |
Any other value is read as legacy.
Leave legacy in place until a period of shadow shows no ai.usage_mismatch events on GET /api/v1/admin/logs. Then on is the single writer.
INSERT INTO BCONFIG (BOWNERID, BGROUP, BSETTING, BVALUE, BLOCKED)
VALUES (0, 'AI', 'USAGE_HOOK', 'shadow', 0)
ON DUPLICATE KEY UPDATE BVALUE = 'shadow';
Restart the web, worker and scheduler processes after this statement. A process keeps the value it read first.
Outbound traffic#
Operate → System configuration → Outbound traffic (/admin/config?tab=outbound). Saved immediately.
| Field | BCONFIG |
Default | Meaning |
|---|---|---|---|
| Mode | EGRESS / MODE |
off |
What happens when a program calls a host that is not allowed |
| Extra hosts | EGRESS / ALLOW |
empty | Hosts you add. One per line, or a JSON list |
| Mode | What a person sees |
|---|---|
off |
Nothing changes. The allowlist is not consulted. |
report |
The call still goes out. The installation records egress.would_block with the host and port, so you can allow it. |
enforce |
The call is refused before it connects. The person sees that the service could not be reached. |
An unrecognised mode is off.
The built-in list is the hosts each AI provider class declares, plus the integrations the product ships (payments, messengers, sign-in). A custom OpenAI-compatible base URL is not on that list. In report it shows up as egress.would_block until you add it under extra hosts. Do not switch to enforce until every host you rely on has been quiet in report.
Matching:
api.example.commatches that host on any port.api.example.com:443matches that port only.*.example.orgmatches one name in front ofexample.org, not a name further down.
A URL a person types (a custom HTTP tool, a page to fetch, their own MCP server) is not added to this list. Those calls keep their own address check.
Proxy#
| Variable | Meaning |
|---|---|
HTTPS_PROXY, HTTP_PROXY, NO_PROXY |
The usual environment proxy. Used when EGRESS_PROXY is empty. |
EGRESS_PROXY |
When set, this proxy is used instead. An empty value leaves the environment proxy alone. |
EGRESS_NO_PROXY |
Hosts the proxy is told to skip. Falls back to NO_PROXY. enforce does not refuse those hosts. |
Optional gateway#
The default stack does not run a shared outbound proxy. To send PHP, the worker, the scheduler, voice and the transcriber through one CONNECT gateway:
docker compose -f docker-compose.yml -f docker-compose.egress.yml --profile egress up -d
That file sets EGRESS_GATEWAY=1. File work does not use this proxy. It dials an approved address itself. Leave the profile unloaded unless you want every service to leave through that gateway.