Skip to content

Install for real use ​

The Quickstart starts Sensora with built-in development secrets and demo data. This page installs an empty instance that you can keep, with your own secrets, a dashboard password and an address your devices can reach.

Requirements ​

  • A computer that stays on, with a 64-bit operating system. The stack runs on x86-64 and on arm64, which includes a Raspberry Pi 4 or 5.
  • Docker with the Compose plugin. Check it with docker compose version.
  • git and an internet connection for the first build.

You do not need Bun or Node.js on the host. There are no published Docker images yet, so the images are built from source on the host. This takes a few minutes on a laptop and longer on a Raspberry Pi.

Install ​

  1. Get the source.

    bash
    git clone https://github.com/sensoraiot/sensora.git
    cd sensora
  2. Create the settings file.

    bash
    cp deploy/.env.example deploy/.env
  3. Generate two secrets. Each command prints one line.

    bash
    echo "ENCRYPTION_KEY=$(openssl rand -base64 24 | head -c 32)"
    echo "DB_PASSWORD=$(openssl rand -hex 16)"
  4. Open deploy/.env in an editor. Replace the ENCRYPTION_KEY and DB_PASSWORD lines with the two lines you generated. Remove the # in front of SENSORA_DASHBOARD_PASSWORD and PUBLIC_URL and set both. The four lines then look like this, with your own values:

    ini
    DB_PASSWORD=THE_DB_PASSWORD_YOU_GENERATED
    ENCRYPTION_KEY=THE_ENCRYPTION_KEY_YOU_GENERATED
    SENSORA_DASHBOARD_PASSWORD=A_LONG_PASSPHRASE_YOU_CHOOSE
    PUBLIC_URL=http://192.168.1.20:8090

    Leave the other lines of the file as they are.

  5. Build and start the stack.

    bash
    docker compose -f deploy/docker-compose.yml up -d --build
  6. Check that it answers.

    bash
    curl http://localhost:8090/health

    A healthy instance answers {"status":"ok","time":"..."}, where time is the clock of the server.

  7. Open http://<address of the host>:8090 in a browser and sign in with the dashboard password.

    The password screen of a new instance, titled Sign in to this server, with one field for the dashboard password

The instance is empty. Continue with First device.

WARNING

This install serves plain HTTP and is meant for your own network. Read Security before you make it reachable from the internet.

The four values you must set ​

VariableWhat it isWhat to know
ENCRYPTION_KEYThe secret behind device secrets, API keys, dashboard and customer sign-ins, and stored integration passwords.The default in the repository is public. Set your own before the first start and keep a copy in a safe place. Do not change it later: device secrets, API keys and sign-ins stop working, and stored integration secrets can no longer be read.
DB_PASSWORDThe password of the PostgreSQL user.Set it before the first start. PostgreSQL stores it when it creates the database, so a later change in deploy/.env alone makes the server fail to connect.
SENSORA_DASHBOARD_PASSWORDOne shared password for the dashboard.Without it, and without an API key, everyone who can reach the port can read and change everything.
PUBLIC_URLThe address devices, agents and customers use to reach this instance.Use an address that works from your devices, such as http://192.168.1.20:8090 or https://sensora.example.com. Do not use localhost. The browser flasher writes this address onto boards, so give the host a fixed IP address or a host name.

All other variables are optional. Configuration lists every variable with its default.

To apply a change in deploy/.env, run the start command again:

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

What runs ​

ServiceRoleReachable from outside
webnginx. Serves the dashboard and passes API and device requests to app.Yes, on port 8090
appThe Sensora server.No
migrateRuns at every start, applies new database migrations, then exits. app waits for it.No
dbPostgreSQL 16.No
brokerNanoMQ, an MQTT broker for the server.No

A sixth service, seed, writes the demo data. It runs only when you add --profile demo to the start command, and it does nothing on an instance that already has devices.

The one published port ​

Only web publishes a port: 8090 on every network interface of the host, over plain HTTP. Change the number with WEB_PORT. To accept connections only from the host itself, for example behind a reverse proxy on the same machine, put an address in front of the port:

ini
WEB_PORT=127.0.0.1:8090

The MQTT broker is not published, so devices on your network cannot connect to it. Read MQTT before you change that, because the broker accepts every client without a password.

Where your data is ​

WhatWhere
Devices, readings, rules, dashboards, customers, settingsDocker volume sensora-oss_sensora-oss-db
Firmware images uploaded for remote updatesDocker volume sensora-oss_sensora-oss-ota
Secrets and settingsThe file deploy/.env

DANGER

docker compose -f deploy/docker-compose.yml down stops the stack and keeps the volumes. Adding -v to that command deletes both volumes and all your data.

Operations explains backups and updates.

Start at boot ​

Docker starts the services again after a crash and after a reboot, as long as Docker itself starts at boot. On a Linux host with systemd:

bash
sudo systemctl enable docker

A service that you stopped yourself with docker compose stop stays stopped after a reboot.

Flash boards from another computer ​

Browsers allow USB access only on pages opened over HTTPS or at http://localhost. When Sensora runs on a server or a Raspberry Pi, the page at http://192.168.1.20:8090 is neither, so the browser flasher does not work there. USB flashing shows the ways around this.

Next steps ​

Sensora is open source under the Apache 2.0 license.