Skip to content

Feature: ephemeral / read-only mode (e.g. Raspberry Pi with overlayfs) #72

@pskillen

Description

@pskillen

Motivation

When running the bot on a Raspberry Pi with a read-only root filesystem (e.g. raspi-config overlay or similar), the default setup is awkward: main.py expects a writable DATA_DIR for SQLite (user_prefs, user_cmds, node_db), node_info.json load/save, and optional failed-packet dumps.

In that deployment, the bot is effectively a gateway: forward packets (and related telemetry) into the Meshflow API. Anything stored locally can be ephemeral—it does not need to survive reboot.

Current behavior (summary)

  • DATA_DIR is created and used for three SQLite databases and JSON round-trips for InMemoryNodeInfoStore.
  • StorageAPIWrapper can already skip disk on API errors if failed_packets_dir is None.
  • Optional packet JSON dumps only occur when DUMP_PACKETS_PORTNUMS is set.
  • Runtime behavior already includes InMemoryNodeDB in tests; production main always wires SqliteNodeDB.

Proposed feature

Add a first-class ephemeral / read-only mode (name TBD), e.g. env var EPHEMERAL=1 or READONLY_FS=1, that:

  1. Uses InMemoryNodeDB instead of SQLite for node cache (acceptable tradeoff: empty after restart until traffic is seen).
  2. Uses no-op or in-memory AbstractCommandLogger and AbstractUserPrefsPersistence so admin history and prefs are not persisted (or document that admins should use tmpfs if they want SQLite until reboot).
  3. Skips node_info.json load/save (or no-ops) so shutdown does not require a writable path.
  4. Passes failed_packets_dir=None to StorageAPIWrapper so failed uploads are not written to disk.
  5. Does not call os.makedirs for a persistent data directory when nothing needs it—or documents DATA_DIR on tmpfs as the supported path for users who still want SQLite until reboot without code changes.

Acceptance criteria (suggested)

  • Bot starts and uploads packets to the API with no writes to the read-only root when ephemeral mode is enabled (aside from OS/Python temp if any).
  • Document the mode in README / .env.example with a short Raspberry Pi + overlay note.
  • Existing default behavior unchanged when the flag is off.

Workaround today

Point DATA_DIR at tmpfs (e.g. under /run or /tmp) so SQLite and JSON work on a volatile filesystem; optionally patch main to pass failed_packets_dir=None. This issue asks for built-in support so operators do not need a fork or manual wiring.


Related context: packet ingestion does not inherently require SQLite; local DBs mainly support commands, !nodes, prefs, and admin history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions