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.
Create the file from the example:
bashcp deploy/.env.example deploy/.envEdit
deploy/.env. Each line isNAME=value. A line that starts with#is a comment.Apply the change:
bashdocker compose -f deploy/docker-compose.yml up -dDocker 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.
Check that the server is up:
bashcurl 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,yesandonmean 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 or0, not the default.
Web
| Variable | Default | What it does |
|---|---|---|
WEB_PORT | 8090 | The 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_URL | not set | The 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_ORIGINS | not set | A 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_ENV | production in the bundled stack | production 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 |
PORT | 3001 | The 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_VERSION | not set | The version name shown in the dashboard. Release images set it. Without it the dashboard shows dev |
MCP_COMMAND | not set | Replaces the stdio command that Settings › MCP server shows. Use it when you run the server without Docker, for example bun run mcp |
STORAGE_CAP_GB | 100 | The 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
| Variable | Default | What it does |
|---|---|---|
DB_USER | postgres | The PostgreSQL user |
DB_PASSWORD | password | The PostgreSQL password. Set your own before the first start |
DB_NAME | sensora | The database name |
DB_HOST | db in the bundled stack | The database host. The bundled stack sets it. A value in deploy/.env has no effect there. Outside the stack the default is localhost |
DB_PORT | 5432 in the bundled stack | The database port. The bundled stack sets it. Outside the stack the default is 5433 |
DB_SSLMODE | disable | disable, 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_DSN | not set | A 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
| Variable | Default | What it does |
|---|---|---|
ENCRYPTION_KEY | dev-insecure-0123456789abcdefghi | The 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_PASSWORD | not set | One 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_KEYS | not set | A 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.
| Variable | Default | What it does |
|---|---|---|
MQTT_ENABLED | true in the bundled stack | Turns the MQTT client on. Outside the stack the default is off |
MQTT_BROKER_URL | mqtt://broker:1883 in the bundled stack | The broker that Sensora connects to |
MQTT_USERNAME | not set | User name for the broker |
MQTT_PASSWORD | not set | Password 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.
| Variable | Default | What it does |
|---|---|---|
ASSISTANT_PROVIDER | anthropic | anthropic or openai-compatible |
ANTHROPIC_API_KEY | not set | The key for the Anthropic provider |
ASSISTANT_MODEL | claude-opus-4-8 for Anthropic | The model name. Required for openai-compatible |
ASSISTANT_BASE_URL | not set | The address of an OpenAI-compatible server such as Ollama, for example http://host.docker.internal:11434/v1. Required for openai-compatible |
ASSISTANT_API_KEY | not set | Optional 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.
| Variable | Default | What it does |
|---|---|---|
SMTP_HOST | not set | The SMTP server |
SMTP_PORT | 587 | The SMTP port |
SMTP_SECURE | not set | Yes 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_USER | not set | User name, when the server needs one |
SMTP_PASSWORD | not set | Password, when the server needs one |
SMTP_FROM | not set | The sender address |
Telegram
| Variable | Default | What it does |
|---|---|---|
TELEGRAM_BOT_TOKEN | not set | The token of your Telegram bot, from @BotFather. Telegram is ready when it is set |
Firmware and updates
| Variable | Default | What it does |
|---|---|---|
FIRMWARE_PUBLIC_KEY | not set | The 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_DIR | firmware | The folder where the installed Sensora Agent release lives. In the container this is /app/firmware. It is not on a volume |
SENSORA_AGENT_RELEASE | not set | Do 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 stack | The 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_KEYS | not set | A 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_BYTES | 4194304 | The largest firmware image you can upload, in bytes (4 MB). The web container of the bundled stack accepts at most 10 MB |
OTA_SWEEP_SEC | 60 | How 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.
| Variable | Default | What it does |
|---|---|---|
RETENTION_METRICS | 0 | How long to keep raw readings |
RETENTION_ROLLUP | 0 | How long to keep the 5-minute averages |
RETENTION_EVENTS | 0 | How long to keep events |
RETENTION_RULE_EXECUTIONS | 30d | How long to keep the run history of rules |
RETENTION_EXECUTION_LOGS | 30d | A second name for the same run history. If the two differ, the shorter window that is not 0 is used |
RETENTION_INBOX_DONE | 7d | How long to keep inbox entries that were processed |
RETENTION_SWEEP_INTERVAL | 3600 | Seconds 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
| Variable | Default | What it does |
|---|---|---|
LIVENESS_SWEEP_SEC | 30 | How 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_ENABLED | true | Runs rules that have a schedule trigger. With false those rules never run |
RULE_HEALTH_SWEEP_SEC | 600 | How 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.
| Variable | Default | What it does |
|---|---|---|
INGEST_MAX_BODY_BYTES | 10485760 | The 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_RPS | 1 | Requests a second that one device may send, after its burst is used |
DEVICE_RATE_LIMIT_BURST | 60 | Requests that one device may send at once |
RATE_LIMIT_RPS | 50 | Requests 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_BURST | 100 | The burst for each client address, and for each webhook token |
Internal
| Variable | Default | What it does |
|---|---|---|
SENSORA_DEBUG_RELAY | false | An internal debugging aid for the developers of Sensora. Leave it off |
