Skip to content

Configuration ​

This page lists every setting that you give Sensora through environment variables. Use it to find the name of a variable, its default, and how to apply a change.

Settings that you change in the dashboard, such as notification recipients, API keys and the retention policy, are stored in the database. They are not on this page.

Where the settings live ​

With the bundled Docker Compose stack, all variables go in one file: deploy/.env. The file is optional. Without it, every variable has a default.

  1. Create the file from the example:

    bash
    cp deploy/.env.example deploy/.env
  2. Edit deploy/.env. Each line is NAME=value. A line that starts with # is a comment.

  3. Apply the change:

    bash
    docker compose -f deploy/docker-compose.yml up -d

    Docker Compose replaces the containers whose settings changed. Your data stays in the database volume. Firmware for the browser flasher does not: see Flash a board over USB.

  4. Check that the server is up:

    bash
    curl http://localhost:8090/health

If a value is not valid, the server prints Invalid environment: with the name of the variable and stops. Read the log with docker compose -f deploy/docker-compose.yml logs app.

If you installed a released version with the sensora host command, the file is /opt/sensora/.env. See Operations.

Set these before the first start

For any use beyond a trial on your own computer, set ENCRYPTION_KEY and DB_PASSWORD before the first start. Both are hard to change later. See the notes in the tables below and Security.

Value formats ​

  • Yes or no. true, 1, yes and on mean yes. Anything else means no.
  • Lists. Separate the items with commas.
  • Defaults. To use a default, remove the line or put # in front of it. Do not leave a name with an empty value: for some variables an empty value means no or 0, not the default.

Web ​

VariableDefaultWhat it does
WEB_PORT8090The port on the host where you open the dashboard and where devices send data. To listen on one address only, put the address in front, for example 127.0.0.1:8090. Read by Docker Compose, not by the server
PUBLIC_URLnot setThe address that devices and other machines use to reach this instance, for example http://192.168.1.20:8090. No path at the end. Sensora writes it onto boards in the browser flasher and into the sketch from the get_firmware tool, shows it under Settings › MCP server, prints it in llms.txt, and uses it in the links of shared dashboards, claim codes and the customer app. It must not be localhost if boards should reach it
CORS_ALLOWED_ORIGINSnot setA list of other web addresses whose pages may call the API from a browser. Not set means only the dashboard's own address. * allows every address
SENSORA_ENVproduction in the bundled stackproduction or development. Keep production. development is for work on Sensora itself: it adds internal detail to error answers, and the customer app returns sign-in links in the API answer instead of only by email. Outside the bundled stack the default is development
PORT3001The port the server listens on inside its container. Do not change it in the bundled stack. The web container and the health check expect 3001
SENSORA_VERSIONnot setThe version name shown in the dashboard. Release images set it. Without it the dashboard shows dev
MCP_COMMANDnot setReplaces the stdio command that Settings › MCP server shows. Use it when you run the server without Docker, for example bun run mcp
STORAGE_CAP_GB100The size of your disk in GB, shown as the capacity under Settings › Server & storage. It is only a number on the screen. It does not limit storage

Database ​

VariableDefaultWhat it does
DB_USERpostgresThe PostgreSQL user
DB_PASSWORDpasswordThe PostgreSQL password. Set your own before the first start
DB_NAMEsensoraThe database name
DB_HOSTdb in the bundled stackThe database host. The bundled stack sets it. A value in deploy/.env has no effect there. Outside the stack the default is localhost
DB_PORT5432 in the bundled stackThe database port. The bundled stack sets it. Outside the stack the default is 5433
DB_SSLMODEdisabledisable, require or prefer. require connects with TLS. The other two connect without it. The bundled stack sets disable, because the database is on the same private Docker network
READONLY_DSNnot setA connection string that the Data explorer and Settings › Server & storage show for tools such as Grafana. It is only shown. It does not change how the server connects, and the bundled stack does not publish the database port

Changing DB_PASSWORD later

PostgreSQL stores the password when the database volume is first created. If you change DB_PASSWORD in deploy/.env afterwards, the database still has the old password. The stack then does not start: the migrate container keeps failing with "password authentication failed". Set the password before the first start, or change it inside PostgreSQL as well.

Security ​

VariableDefaultWhat it does
ENCRYPTION_KEYdev-insecure-0123456789abcdefghiThe secret that protects everything else. Sensora uses it to hash device secrets and API keys, to encrypt the signing secret and password of integrations, and to sign dashboard sessions. The default is public, so set your own. Any length works. Generate one with openssl rand -base64 24 | head -c 32
SENSORA_DASHBOARD_PASSWORDnot setOne shared password for the dashboard. Each browser signs in once and stays signed in for 30 days. Setting it locks the API. Changing it signs every browser out
API_KEYSnot setA list of API keys defined in the environment. Each item is name:key or only key. These keys have the Admin scope. Setting it locks the API

Do not change ENCRYPTION_KEY on an instance that is in use

Device secrets and API keys are stored as hashes made with this key. If you change it, every device is refused with status 401, every API key from Settings › API keys stops working, the stored secrets of integrations can no longer be read, and every browser is signed out. Setting the old key again restores all of them. Choose the key before you add the first device, and keep a copy of it with your backups.

With no dashboard password, no API_KEYS and no key under Settings › API keys, the API is open: everyone who can reach the port can read, change and delete everything. See the HTTP API reference.

Sensora has no user accounts and the bundled stack has no HTTPS. For both, see Security.

MQTT ​

Sensora does not contain an MQTT broker. It connects to one broker as a client and subscribes to the topics of your MQTT integrations. The bundled stack starts a NanoMQ broker for this.

VariableDefaultWhat it does
MQTT_ENABLEDtrue in the bundled stackTurns the MQTT client on. Outside the stack the default is off
MQTT_BROKER_URLmqtt://broker:1883 in the bundled stackThe broker that Sensora connects to
MQTT_USERNAMEnot setUser name for the broker
MQTT_PASSWORDnot setPassword for the broker

See Send data over MQTT.

Assistant ​

These variables connect a model for Ask Sensora. Without them the assistant shows "Connect a model". See Ask Sensora.

VariableDefaultWhat it does
ASSISTANT_PROVIDERanthropicanthropic or openai-compatible
ANTHROPIC_API_KEYnot setThe key for the Anthropic provider
ASSISTANT_MODELclaude-opus-4-8 for AnthropicThe model name. Required for openai-compatible
ASSISTANT_BASE_URLnot setThe address of an OpenAI-compatible server such as Ollama, for example http://host.docker.internal:11434/v1. Required for openai-compatible
ASSISTANT_API_KEYnot setOptional key for the OpenAI-compatible server

Email ​

Sensora sends email through an SMTP server that you provide. Email is ready when SMTP_HOST and SMTP_FROM are set. You choose the recipients under Settings › Notifications. See Notifications.

VariableDefaultWhat it does
SMTP_HOSTnot setThe SMTP server
SMTP_PORT587The SMTP port
SMTP_SECUREnot setYes means TLS from the first byte, as used on port 465. Not set means yes when the port is 465, and no otherwise. On ports 587 and 25 the connection is upgraded with STARTTLS
SMTP_USERnot setUser name, when the server needs one
SMTP_PASSWORDnot setPassword, when the server needs one
SMTP_FROMnot setThe sender address

Telegram ​

VariableDefaultWhat it does
TELEGRAM_BOT_TOKENnot setThe token of your Telegram bot, from @BotFather. Telegram is ready when it is set

Firmware and updates ​

VariableDefaultWhat it does
FIRMWARE_PUBLIC_KEYnot setThe ed25519 public key (raw, base64) that a Sensora Agent release must be signed with. Version 0.1.27 has no built-in key, so a release is only accepted when you set this. See Flash a board over USB
FIRMWARE_DIRfirmwareThe folder where the installed Sensora Agent release lives. In the container this is /app/firmware. It is not on a volume
SENSORA_AGENT_RELEASEnot setDo not use it in version 0.1.27. It is a build setting that should put a Sensora Agent release into the image, but the build cannot check the signature of the release and stops with an error. Install the firmware as described in Flash a board over USB
OTA_DIR/data/ota in the bundled stackThe folder for firmware images that you upload for remote updates. The bundled stack sets it and keeps it on a volume. Outside the stack the default is data/ota
OTA_PUBLIC_KEYSnot setA list of ed25519 public keys (raw, base64). An uploaded image must be signed with one of them, or with a key that you add on the Updates page. There is no way to accept an unsigned image
OTA_MAX_IMAGE_BYTES4194304The largest firmware image you can upload, in bytes (4 MB). The web container of the bundled stack accepts at most 10 MB
OTA_SWEEP_SEC60How often, in seconds, Sensora checks running rollouts for timeouts and for the next step. 0 turns the timer off. Checks then run only when a device or the dashboard touches a rollout

See Flash a board over USB and Firmware updates.

Retention ​

Retention is how long Sensora keeps data before it deletes it. A window is 0 or forever to keep data forever, or a duration such as 30d, 90 days, 6 months, 2y, 1w or 12h. A number without a unit is days. A value that cannot be read counts as forever, so a typing mistake never deletes data.

VariableDefaultWhat it does
RETENTION_METRICS0How long to keep raw readings
RETENTION_ROLLUP0How long to keep the 5-minute averages
RETENTION_EVENTS0How long to keep events
RETENTION_RULE_EXECUTIONS30dHow long to keep the run history of rules
RETENTION_EXECUTION_LOGS30dA second name for the same run history. If the two differ, the shorter window that is not 0 is used
RETENTION_INBOX_DONE7dHow long to keep inbox entries that were processed
RETENTION_SWEEP_INTERVAL3600Seconds between clean-up runs. 0 turns the clean-up off

The first three are only defaults. When someone saves the policy under Settings › Server & storage, the saved policy is used instead. See Operations.

Background checks ​

VariableDefaultWhat it does
LIVENESS_SWEEP_SEC30How often, in seconds, Sensora looks for devices that went offline. 0 turns it off. Rules that react to a device going offline then never fire
SCHEDULER_ENABLEDtrueRuns rules that have a schedule trigger. With false those rules never run
RULE_HEALTH_SWEEP_SEC600How often, in seconds, Sensora looks for running rules that are due for their weekly health check. 0 turns it off. A rule is then only checked when someone asks

Rate limits ​

These protect the endpoints that devices use. See the HTTP API reference.

VariableDefaultWhat it does
INGEST_MAX_BODY_BYTES10485760The largest body of one request to /ingest or a webhook, in bytes (10 MB). The web container of the bundled stack also stops at 10 MB, so a higher value has no effect there
DEVICE_RATE_LIMIT_RPS1Requests a second that one device may send, after its burst is used
DEVICE_RATE_LIMIT_BURST60Requests that one device may send at once
RATE_LIMIT_RPS50Requests a second for each client address. Only requests with a wrong secret, an unknown token or a bad body count against it. Also the rate for each webhook token
RATE_LIMIT_BURST100The burst for each client address, and for each webhook token

Internal ​

VariableDefaultWhat it does
SENSORA_DEBUG_RELAYfalseAn internal debugging aid for the developers of Sensora. Leave it off

Sensora is open source under the Apache 2.0 license.