You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- PWD_USER now derives as SUDO_UID:SUDO_GID (invoking user's uid and
primary gid) — the exact same uid:gid convention setup.sh writes — so a
restore never silently changes how an install is owned. Drops the
docker-GID pairing, which was self-consistent but diverged from the
rest of the project. Root-shell (UID 0) guard retained.
- CQ replay now detects failures: the influx 1.x CLI prints statement
errors to stdout and exits 0 regardless, so the previous exit-code
check reported success even if every CREATE failed. New replay_cqs
helper captures output, filters harmless 'already exists' responses,
greps for ERR, and surfaces the first errors to the user.
- Staging disk-space checks: restore.sh warns (with sizes and a TMPDIR
override hint) if the staging filesystem can't hold ~6x the compressed
archive; backup.sh aborts before copying a snapshot that won't fit
(protects RAM-backed /tmp from multi-GB datasets, cron-safe: no prompt).
- Docs: README large-dataset/TMPDIR note, updated restore step list,
RELEASE.md v5.3.0 entry updated to match final behavior (also folds in
the previously-unreleased jasonacox#840 datasource UID note post-rebase).
Copy file name to clipboardExpand all lines: RELEASE.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,14 @@
9
9
### New Features
10
10
11
11
***Restore script** — new `backups/restore.sh.sample`, an automated companion to `backup.sh.sample`, based on `restore_v16a.sh` by **@JonMurphy** ([#836](https://github.com/jasonacox/Powerwall-Dashboard/issues/836)). One command restores a backup archive on the same machine or migrates to a new one:
12
-
- Auto-detects the Powerwall-Dashboard directory by locating `compose-dash.sh`
12
+
- Auto-detects the Powerwall-Dashboard directory from the script's own location
13
+
- Checks staging disk space before extracting (warns and offers `TMPDIR` override — protects RAM-backed `/tmp` from multi-GB archives)
13
14
- Non-destructive — moves existing InfluxDB `data`/`meta`/`wal` and `grafana.db` aside as `.pre-restore.<timestamp>` copies (rollback path) instead of deleting
14
-
- Restores InfluxDB from the `influxd backup -portable` snapshot into a clean instance, then re-creates continuous queries from `influxdb.sql`(`influxd restore -portable` does not reliably restore CQs — a known InfluxDB 1.x limitation)
15
-
- Restores Grafana database and provisioning files with correct ownership, deriving `PWD_USER`from live filesystem state (`compose-dash.sh`owner + docker group GID)
15
+
- Restores InfluxDB from the `influxd backup -portable` snapshot into a clean instance, then re-creates continuous queries from the archive's `continuous_queries.txt` (live CQ state, including customizations) with `influxdb.sql`as fallback — `influxd restore -portable` does not reliably restore CQs (known InfluxDB 1.x limitation). CQ replay output is checked for errors (the influx CLI exits 0 even on failed statements).
16
+
- Restores Grafana database and provisioning files with correct ownership, deriving `PWD_USER`as the invoking user's `uid:gid` (`SUDO_UID:SUDO_GID`) — the same convention `setup.sh`uses — with a guard against running from a root shell
16
17
- Restores user configuration files (`*.env`, `telegraf.local`, etc.) while **skipping git-managed project files** (`powerwall.yml`, `telegraf.conf`, `influxdb.conf`, `VERSION`) so an older backup can never downgrade the stack or break future `git pull`/upgrades
17
18
- Finishes with `compose-dash.sh up -d` so containers are **recreated** and restored settings (including the rewritten `PWD_USER`) actually take effect
18
-
***Backup script** — `backup.sh.sample` now auto-detects the dashboard directory (no more editing `DASHBOARD=` by hand) and exports `SHOW CONTINUOUS QUERIES` output into the archive as a safety net.
19
+
***Backup script** — `backup.sh.sample` now auto-detects the dashboard directory (no more editing `DASHBOARD=` by hand), exports live continuous queries into the archive as a safety net, and aborts with a clear message if the staging area can't hold the snapshot (with `TMPDIR` override).
Copy file name to clipboardExpand all lines: backups/README.md
+10-7Lines changed: 10 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,8 @@ The following shows an example of how to set up automated backups (see backup.sh
45
45
2. Make the script executable with `chmod +x backup.sh` (the script auto-detects the dashboard location by finding `compose-dash.sh`)
46
46
3. Add to crontab for daily backups: `0 2 * * * /home/user/Powerwall-Dashboard/backups/backup.sh`
47
47
48
+
> **Large datasets:** both `backup.sh` and `restore.sh` stage data in a temporary directory (`mktemp -d`, usually under `/tmp`). If your InfluxDB history is large (multi-GB) and `/tmp` is a RAM-backed tmpfs, staging there can exhaust memory. Both scripts check available space first — backup aborts and restore warns — and you can point staging at a disk with more room: `sudo TMPDIR=/path/with/space ./backup.sh`
49
+
48
50
## Backup Script Example
49
51
50
52
```bash
@@ -55,8 +57,8 @@ if [ "$EUID" -ne 0 ]
55
57
exit
56
58
fi
57
59
58
-
# Dashboard location is auto-detected (script-relative, with a fallback
59
-
#search for compose-dash.sh) - see backup.sh.sample
60
+
# Dashboard location is auto-detected from the script's own location
61
+
#(must live in Powerwall-Dashboard/backups/) - see backup.sh.sample
60
62
BACKUP_FOLDER="${DASHBOARD}/backups"# Destination folder for backups
61
63
KEEP="5"# Days to keep backup
62
64
@@ -89,11 +91,12 @@ A companion `restore.sh.sample` is provided to automate the restore process. It
89
91
90
92
The restore script will:
91
93
1. **Auto-detect** the Powerwall-Dashboard directory by locating `compose-dash.sh`
92
-
2. **Stop all containers** before touching data
93
-
3. **Restore InfluxDB** from the `influxd backup -portable` snapshot, moving existing data aside first (not deleted — you get a rollback path)
94
-
4. **Restore Grafana** database and provisioning files with correct ownership
95
-
5. **Restore configuration files**, rewriting `PWD_USER`in`compose.env` to match this host's actual user and docker group. Project files managed by git (`powerwall.yml`, `telegraf.conf`, `influxdb.conf`, `VERSION`) are kept in the archive for reference but are NOT restored over the current checkout — this prevents an older backup from downgrading the stack or breaking future upgrades.
96
-
6. **Recreate the stack** (`compose-dash.sh up -d`, so restored settings take effect) and print a list of pre-restore backup paths to clean up once confirmed
94
+
2. **Check staging disk space** and warn before extracting a large archive into a location that can't hold it (use `sudo TMPDIR=/path/with/space ./restore.sh` to relocate staging)
95
+
3. **Stop all containers** before touching data
96
+
4. **Restore InfluxDB** from the `influxd backup -portable` snapshot, moving existing data aside first (not deleted — you get a rollback path), then re-create continuous queries from the archive (with `influxdb.sql` as fallback)
97
+
5. **Restore Grafana** database and provisioning files with correct ownership
98
+
6. **Restore configuration files**, rewriting `PWD_USER` in `compose.env` to match this host's actual user and primary group (same `uid:gid` convention as `setup.sh`). Project files managed by git (`powerwall.yml`, `telegraf.conf`, `influxdb.conf`, `VERSION`) are kept in the archive for reference but are NOT restored over the current checkout — this prevents an older backup from downgrading the stack or breaking future upgrades.
99
+
7. **Recreate the stack** (`compose-dash.sh up -d`, so restored settings take effect) and print a list of pre-restore backup paths to clean up once confirmed
0 commit comments