Skip to Content

Storage

The server keeps two kinds of data:

  • Metadata: which dashboards exist, who created them, their revisions and permissions. It lives in the store.
  • Documents: the content of each dashboard. They live in the document store, which can be the same database or somewhere else.

Choose a store

MIOT_DASHBOARD_STOREKeeps dataNeedsUse it for
memory (default)Until the process stopsNothingDemos and tests
sqliteIn one fileNode.js 22.13 or laterOne server
postgresIn a database serverThe pg packageSeveral servers, managed backups

The schema creates itself: migrations run at startup and only apply what the database lacks. With PostgreSQL, migrations take a lock, so several servers can start together.

SQLite

MIOT_DASHBOARD_STORE=sqlite MIOT_DASHBOARD_SQLITE_PATH=/data/dashboards.db

One process per file. Put the file on a persistent volume.

PostgreSQL

MIOT_DASHBOARD_STORE=postgres MIOT_DASHBOARD_POSTGRES_URL=postgres://dashboards:secret@db.internal:5432/dashboards MIOT_DASHBOARD_POSTGRES_POOL_SIZE=10 MIOT_DASHBOARD_POSTGRES_CONNECTION_TIMEOUT=5000

Give the server its own database or schema. If an idle connection drops, the pool reconnects on demand and logs a warning.

Choose a document store

MIOT_DASHBOARD_DOCUMENTSDocuments liveNeeds
inline (default)In the same database as the metadataNothing
fsOne file per dashboard, under MIOT_DASHBOARD_DOCUMENTS_PATHA persistent directory
s3Objects in an S3 bucket@aws-sdk/client-s3 and the AWS credential chain
gcsObjects in a Google Cloud Storage bucket@google-cloud/storage and Application Default Credentials

inline suits most installations. For s3 and gcs, set MIOT_DASHBOARD_DOCUMENTS_BUCKET and, optionally, MIOT_DASHBOARD_DOCUMENTS_PREFIX (default dashboards/). The account needs read, create, delete and list permissions under that prefix. Cloud credentials come from the environment, never from the API.

The document store is recorded the first time the database opens. Starting later with a different one is refused, because the documents do not move by themselves. Move them first.

Leftover documents

A save or delete that fails halfway can leave a document with no metadata. The server removes these at startup and then every hour.

SettingDefaultMeaning
MIOT_DASHBOARD_ORPHAN_SWEEP_INTERVAL3600Seconds between sweeps. 0 turns them off.
MIOT_DASHBOARD_ORPHAN_MIN_AGE86400Only documents older than this are removed. Cannot be 0, so a save in progress is never swept.

Credentials

If the server stores datasource credentials (MIOT_DASHBOARD_CREDENTIALS_KEY), they are encrypted in the same store. They need sqlite or postgres. See Store datasource credentials.

Seed data

MIOT_DASHBOARD_SEED can also list starting dashboards. They are written only where the address is empty, so the setting can stay on across restarts without undoing edits.

Last updated on