Skip to content

Commit 4424d55

Browse files
updates
1 parent ce44639 commit 4424d55

File tree

2 files changed

+32
-51
lines changed

2 files changed

+32
-51
lines changed

developer-guide/09-Storage and the filesystem/01-data-stores/01-data-stores-intro.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ The Pioreactor software will automatically backup the SQLite database via a sche
1818

1919
## Local key-value datastore
2020

21-
SQLite3 is also used by the library *diskcache*. This is essentially a fast key-value store on the Raspberry Pi. For Pioreactor, we use it to store "machine-specific" data, like calibration curves, locks on GPIOs, state of LEDs, jobs running, etc. Instead of one large file containing all these keys, we have split them into multiple locations based on category and level of persistence. The persistent databases are stored in `/home/pioreactor/.pioreactor/storage` and the temporary databases are in `/tmp`. You can access them from Python using `pioreactor.utils.local_persistent_storage` and `pioreactor.utils.local_intermittent_storage`, respectively.
21+
SQLite3 is also used for simpler database (caches) on each Pioreactor (worker and leader). The persistent databases are stored in `/home/pioreactor/.pioreactor/storage` and the temporary databases are in `/run/pioreactor/cache`. You can access them from Python using `pioreactor.utils.local_persistent_storage` and `pioreactor.utils.local_intermittent_storage`, respectively.
2222

2323
:::info
2424
What are temporary and persistent? Something like GPIO locks or LED state are physically reset between cycles of the Raspberry Pi. So when the Pi power-cycles, the state is wiped, and by have the database in `/tmp`, the databases are wiped as well.
2525
:::
2626

27-
You can use `pio view-cache <name>` to view the contents of `<name>`, and `pio clear-cache <name> <key>` to clear contents.
27+
You can use `pio cache view <name>` to view the contents of `<name>`, and `pio cache clear <name> <key>` to clear contents.
2828

2929

3030
## MQTT
@@ -33,9 +33,9 @@ The inter- and intra-Pioreactor communications are handled by MQTT, a pub/sub se
3333

3434
A principle we have stood by is to not let MQTT turn into our database. That is,
3535

36-
1. we shouldn't store important information in MQTT _only_ (also use `mqtt_to_db_streaming` job to store important data in the SQLite3 database, or handle it locally using `local_intermitant_storage` or `local_persistance_storage`),
37-
2. we shouldn't store information in MQTT that is "machine-specific", like calibrations (better to use `local_intermitant_storage` or `local_persistance_storage`)
38-
3. we shouldn't use MQTT as a source of truth (trust the database, `local_intermitant_storage` or `local_persistance_storage` more).
36+
1. we shouldn't store important information in MQTT _only_ (also use `mqtt_to_db_streaming` job to store important data in the SQLite3 database, or handle it locally using `local_intermittent_storage` or `local_persistent_storage`),
37+
2. we shouldn't store information in MQTT that is "machine-specific", like calibrations (better to use `local_intermittent_storage` or `local_persistent_storage`)
38+
3. we shouldn't use MQTT as a source of truth (trust the database, `local_intermittent_storage` or `local_persistent_storage` more).
3939

4040

4141
#### Serialization of MQTT messages

developer-guide/09-Storage and the filesystem/02-filesystem.md

Lines changed: 27 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,30 @@ slug: /filesystem-locations
44
hide_table_of_contents: true
55
---
66

7-
8-
Below is a list of important locations and files on the filesystem for the Pioreactor:
9-
10-
11-
### UI
12-
13-
- `/var/www/pioreactorui/` is the source of the web-app.
14-
- `/var/www/pioreactorui/.env` holds some configuration for the UI.
15-
- `/var/www/pioreactorui/contrib/` holds yaml files that display automation data, job data, and chart data.
16-
- Note: `/home/pioreactor/.pioreactor/plugins/ui/contrib/` also holds yaml files, like the above.
17-
18-
19-
### Logs
20-
21-
- `/var/log/pioreactor.log` is the log file for the Pioreactor app
22-
- `/var/log/pioreactorui.log` is the (deprecated) log file for the Pioreactor UI. It's now the same as above.
23-
24-
25-
### Storage
26-
27-
- `/home/pioreactor/.pioreactor/storage/` holds the main database, backup of the database, and persistent caches.
28-
- `/tmp/pioreactor_cache/` holds temporary caches. Files in here are not kept between reboots.
29-
30-
31-
### Bash scripts
32-
- `/usr/local/bin/` store bash scripts that are used when working with the filesystem: installing plugins, updating code, etc.
33-
34-
35-
### Config
36-
37-
- `/home/pioreactor/.pioreactor/` holds all configuration files for the Pioreactor UI and app, the main one being `config.ini`
38-
39-
40-
### Plugins
41-
42-
- `/home/pioreactor/.pioreactor/plugins/` is where Python files can be added.
43-
- `/home/pioreactor/.pioreactor/plugins/ui/contrib/` also holds UI yaml files for custom Python code.
44-
45-
### Experiment profiles
46-
47-
- `/home/pioreactor/.pioreactor/experiment_profiles/` is where experiment profiles (yaml) are stored.
48-
49-
### Calibrations
50-
51-
- `/home/pioreactor/.pioreactor/storage/calibrations/` is where calibrations are stored.
52-
7+
# Important Raspberry Pi Locations for Pioreactor Images
8+
9+
Reference list of on-device paths that matter once a custom Pioreactor Raspberry Pi OS image is flashed and running.
10+
11+
| Path | What lives here | Notes |
12+
| --- | --- | --- |
13+
| `/etc/pioreactor.env` | Shared environment file exported to services | Provides canonical `DOT_PIOREACTOR`, `RUN_PIOREACTOR`, `LG_WD`, and virtualenv paths so systemd units pick up the same locations. |
14+
| `/home/pioreactor/.pioreactor/` | Pioreactor home (`$DOT_PIOREACTOR`) | Contains configs, plugins, storage, hardware definitions, logs, and other per-device state. Ensure ownership stays `pioreactor:pioreactor`. |
15+
| `/home/pioreactor/.pioreactor/config.ini` | Cluster-wide configuration | Holds network, MQTT, UI, logging, and automation settings replicated to workers. |
16+
| `/home/pioreactor/.pioreactor/unit_config.ini` | Unit overrides | Optional per-device overrides synced from the leader when a worker is added. |
17+
| `/home/pioreactor/.pioreactor/plugins/` | Plugin root | Mirrors the `.pioreactor` layout for plugin-provided files; typically subdivided into `python/`, `ui/`, `exportable_datasets/`, etc. |
18+
| `/home/pioreactor/.pioreactor/plugins/ui/` | UI plugin assets | Static contrib YAML, templates, and other UI resources merged into the Pioreactor UI. |
19+
| `/home/pioreactor/.pioreactor/plugins/exportable_datasets/` | Exportable dataset plugins | Each plugin ships SQL queries or serializers that surface new datasets to the UI. |
20+
| `/home/pioreactor/.pioreactor/storage/` | Persistent databases | Holds SQLite data such as `pioreactor.sqlite` (experiments) and `local_persistent_pioreactor_metadata.sqlite`. |
21+
| `/home/pioreactor/.pioreactor/storage/pioreactor.sqlite` | Primary experiment database | Used by the leader, replicated to workers for durability. Back up before major upgrades. |
22+
| `/home/pioreactor/.pioreactor/storage/local_persistent_pioreactor_metadata.sqlite` | Persistent cache | Stores long-lived metadata that survives reboots. |
23+
| `/home/pioreactor/.pioreactor/hardware/` | Hardware definition packs | YAML that describes hats, models, sensors, and calibration values consumed by the Pioreactor hardware subsystem. |
24+
| `/home/pioreactor/.pioreactor/experiment_profiles/` | User experiment profiles | Drop `.py` / `.json` profile definitions here so they show up in the UI for scheduling. |
25+
| `/home/pioreactor/.pioreactor/logs/` | Optional per-user logs | Custom scripts can log here when `/var/log/pioreactor.log` is unsuitable. |
26+
| `/home/pioreactor/.ssh/` | Device SSH keys | Created during image build so leaders can add workers securely. |
27+
| `/run/pioreactor/` | Runtime scratch space (`$RUN_PIOREACTOR`) | tmpfs directory for caches, sockets, Huey queues, and general runtime coordination. Cleared on reboot. |
28+
| `/run/pioreactor/cache/` | Volatile caches | Includes `local_intermittent_pioreactor_metadata.sqlite` and UI/Huey cache files that can be safely discarded. |
29+
| `/run/pioreactor/exports/` | Web export staging | Lighttpd serves `/exports/` from here so downloads never touch persistent storage. |
30+
| `/var/log/pioreactor.log` | System log for Pioreactor services | Configured via `config.ini` and read by both CLI and UI. Rotate with journald/logrotate as needed. |
31+
| `/opt/pioreactor/venv/` | System Python virtual environment | Hosts the Pioreactor Python installation (`pio`, `pios`, services). Activate manually for debugging. |
32+
| `/home/pioreactor/.local/bin/` | User-level executables | Supplementary scripts installed via `pip --user`. |
33+
| `/tmp/` | Temporary workspace | Referenced by `TMPDIR` in `pioreactor.env` for short-lived files outside tmpfs. |

0 commit comments

Comments
 (0)