Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(scripts): resolve host-mount paths under OPENWA_DATA_DIR (#1824)
Yudhi Armyndharis0f6f76f90858
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f9cacaf65..45322077d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed- Drop whatsapp-web.js inbound media over `MEDIA_DOWNLOAD_MAX_BYTES` in the page when the sender understates its size.+- Read the `./data` database defaults and `./data/...` paths in `./.env` under `OPENWA_DATA_DIR` in host-side `backup.sh` and `restore.sh` runs, instead of the working directory's `./data`.- Probe the configured `PORT` in the Docker image healthcheck instead of a fixed 2785.- Cap the total bytes one storage import writes at `STORAGE_IMPORT_MAX_TOTAL_BYTES`.- Close the Baileys session proxy's fetch dispatcher when the session disconnects, logs out or is destroyed.@@ -100,6 +101,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Aged undispatched ingress events are dead-lettered instead of deleted; some may already have been delivered, so check before redriving them.- Java SDK (next SDK release after 0.5.1): the request timeout (default 30 s) also bounds the response body; raise it for large media downloads.+- With `OPENWA_DATA_DIR` set, `backup.sh` and `restore.sh` read the default SQLite databases and `./data/...` paths in `./.env` under it; pass a path in the environment to keep it in the working directory.- A storage import stops at `STORAGE_IMPORT_MAX_TOTAL_BYTES` (default 10 GiB); raise it before importing a larger export.- Baileys answers `400` for an animated sticker with more than 500 frames.- `backup.sh` and `restore.sh` exit with status 2 when `./.env` or `.env.generated` sets a key in a form they cannot parse; fix the line or pass the key in the environment.diff --git a/docs/11-operational-runbooks.md b/docs/11-operational-runbooks.mdindex 5960a4b2a..59872302d 100644--- a/docs/11-operational-runbooks.md+++ b/docs/11-operational-runbooks.md@@ -720,16 +720,16 @@ User-managed files outside that list (for example the project-level `.env`) must# (.api-key from BOOTSTRAP_KEY_FILE when that is set)## The database paths resolve exactly like the app: MAIN_DATABASE_NAME / DATABASE_NAME from the-# environment, then ./.env, then <data dir>/.env.generated, otherwise the fixed ./data defaults, which-# are NOT derived from OPENWA_DATA_DIR. A missing source database fails the run (no silent empty-# backup), the finished archive is checked to contain every configured database, and with the sqlite3-# CLI present the databases are snapshotted online via .backup (otherwise plain-copied with a-# CONSISTENCY-WARNING marker inside the archive). sessions/ and baileys/ are plain copies: when a-# whatsapp-web.js profile is open or Baileys state is present, the archive carries an-# ENGINE-STATE-NOTE naming them, which restore.sh prints and never refuses.--# Run from the repo root (database defaults are ./data/... there; other state defaults to-# OPENWA_DATA_DIR; a ./data/... path from .env.generated, database paths included, is read under it):+# environment, then ./.env, then <data dir>/.env.generated, otherwise the app's ./data defaults,+# read under OPENWA_DATA_DIR like every other ./data path. A missing source database fails the run+# (no silent empty backup), the finished archive is checked to contain every configured database,+# and with the sqlite3 CLI present the databases are snapshotted online via .backup (otherwise+# plain-copied with a CONSISTENCY-WARNING marker inside the archive). sessions/ and baileys/ are+# plain copies: when a whatsapp-web.js profile is open or Baileys state is present, the archive+# carries an ENGINE-STATE-NOTE naming them, which restore.sh prints and never refuses.++# Run from the repo root (OPENWA_DATA_DIR defaults to ./data; the ./data defaults and a ./data/...+# path from ./.env or .env.generated are read under it):./scripts/backup.sh# Customize via environment. Keep the password out of DATABASE_URL: the URL is passed to pg_dump as@@ -776,15 +776,12 @@ OPENWA_DATA_DIR=/srv/openwa/data \> Infrastructure therefore apply without being restated on the command line. A restore reads that> third layer from the archive's `.env.generated` when the archive carries one, because that copy> replaces the target's and is the one the restored app reads. A relative `./data/...` path in-> `.env.generated`, such as the `STORAGE_LOCAL_PATH=./data/media` the app writes on first run, names a-> path in the data directory and is read under `OPENWA_DATA_DIR`; one from the environment or `./.env`-> is read against the current directory. When operating directly on the host mount, a path recorded-> inside the container (`/app/data/...`) is not host-visible, so override it in the environment. The-> database defaults are relative to the current directory too, so pass `MAIN_DATABASE_NAME` and, for-> SQLite, `DATABASE_NAME` with their paths on the mount. A `./data/...` path in `./.env` needs the same-> override, such as the `PLUGINS_DIR=./data/plugins` that `.env.example` sets: compose passes it to-> the container, where it names a path in the volume, while the scripts read it against the current-> directory.+> `./.env` or `.env.generated`, such as the `PLUGINS_DIR=./data/plugins` that `.env.example` sets or+> the `STORAGE_LOCAL_PATH=./data/media` the app writes on first run, names a path in the app's data+> directory and is read under `OPENWA_DATA_DIR`, as are the `./data` database and state defaults; a+> path from the environment is read against the current directory. When operating directly on the+> host mount, a path recorded inside the container (`/app/data/...`) is not host-visible, so override+> it in the environment.>> On every install, inside a container or not, the scripts stop with an error naming the key, before> anything is archived or restored, when the last line setting it in `./.env` or `.env.generated`,@@ -873,9 +870,9 @@ docker compose down# 2. Restore from an archive produced by scripts/backup.sh# (databases land on MAIN_DATABASE_NAME / DATABASE_NAME, default ./data/... — the same paths-# the app reads, as the environment, ./.env or the archive's .env.generated set them; non-DB-# state defaults to OPENWA_DATA_DIR; a ./data/... path from .env.generated, database paths-# included, is read under it. Pass --strict to refuse an archive whose CONSISTENCY-WARNING+# the app reads, as the environment, ./.env or the archive's .env.generated set them; the ./data+# defaults and a ./data/... path from ./.env or .env.generated are read under OPENWA_DATA_DIR,+# as for the backup. Pass --strict to refuse an archive whose CONSISTENCY-WARNING# marker reports plain-copied, possibly-torn database snapshots;# an ENGINE-STATE-NOTE (engine auth state that may have been copied while the app ran) is only printed.# Restoring over an existing install's live databases requires --force; without it the scriptdiff --git a/scripts/backup.sh b/scripts/backup.shindex 6ea401df5..87f0c5003 100755--- a/scripts/backup.sh+++ b/scripts/backup.sh@@ -22,14 +22,14 @@# Usage:# ./scripts/backup.sh# Environment:-# MAIN_DATABASE_NAME auth/audit SQLite file (default: ./data/main.sqlite)-# DATABASE_NAME data-store SQLite file (default: ./data/openwa.sqlite; sqlite only)+# MAIN_DATABASE_NAME auth/audit SQLite file (default: <data dir>/main.sqlite)+# DATABASE_NAME data-store SQLite file (default: <data dir>/openwa.sqlite; sqlite only)# Both resolve EXACTLY like the app: the environment first, then ./.env, then-# <data dir>/.env.generated, otherwise the fixed ./data default (see-# lib-env.sh). The defaults are NOT derived from OPENWA_DATA_DIR, as the app-# never does that either.-# OPENWA_DATA_DIR data directory for the non-DB state below (default: ./data); a ./data/...-# path read from .env.generated, database paths included, is taken under it+# <data dir>/.env.generated, otherwise the app's ./data default (see+# lib-env.sh).+# OPENWA_DATA_DIR the app's ./data directory, such as a volume's mountpoint on the host+# (default: ./data); the ./data defaults, and a ./data/... path read from ./.env+# or .env.generated, are taken under it# BACKUP_DIR where archives are written (default: ./backups)# DATABASE_TYPE sqlite (default) | postgres# SESSION_DATA_PATH, BAILEYS_AUTH_DIR, STORAGE_LOCAL_PATH, PLUGINS_DIR@@ -79,14 +79,14 @@ DATABASE_TYPE="$(openwa_resolve DATABASE_TYPE sqlite)"TIMESTAMP="$(date +%Y%m%d-%H%M%S)"# Database paths resolve exactly like the app: an explicit environment value wins, then ./.env, then-# the dashboard's <data dir>/.env.generated, otherwise the fixed ./data default. OPENWA_DATA_DIR-# bases the defaults of the non-DB state directories below and a ./data/... path from .env.generated,-# never the database defaults: deriving those from it would back up files the app never reads.-MAIN_DB="$(openwa_resolve MAIN_DATABASE_NAME ./data/main.sqlite path)"+# the dashboard's <data dir>/.env.generated, otherwise the app's ./data default. That default, like+# the state directories below, is relative to the app's working directory, so it is taken under+# OPENWA_DATA_DIR: on the host, the cwd's ./data is not the one the app writes.+MAIN_DB="$(openwa_resolve MAIN_DATABASE_NAME "${DATA_DIR%/}/main.sqlite" path)"# With DATABASE_TYPE=postgres, DATABASE_NAME names the database instead, read below only when pg_dump# needs it, so a line for it the scripts cannot parse stops only a backup that uses it.if [ "$DATABASE_TYPE" != "postgres" ]; then- DATA_DB="$(openwa_resolve DATABASE_NAME ./data/openwa.sqlite path)"+ DATA_DB="$(openwa_resolve DATABASE_NAME "${DATA_DIR%/}/openwa.sqlite" path)"fiSESSIONS_DIR="$(openwa_resolve SESSION_DATA_PATH "$DATA_DIR/sessions" path)"BAILEYS_DIR="$(openwa_resolve BAILEYS_AUTH_DIR "$DATA_DIR/baileys" path)"diff --git a/scripts/lib-env.sh b/scripts/lib-env.shindex 4b23d3fd0..ca76ca197 100644--- a/scripts/lib-env.sh+++ b/scripts/lib-env.sh@@ -399,10 +399,12 @@ OPENWA_GENERATED_ENV="${DATA_DIR:-./data}/.env.generated"# openwa_resolve <key> <default> [path] - the application's precedence: environment, then ./.env,# then $OPENWA_GENERATED_ENV, then the built-in default. Requires DATA_DIR to be set before sourcing.-# With a third argument of `path`, the value names a filesystem path: the app reads .env.generated as-# ./data/.env.generated, so a ./data or ./data/... value there names a path in the data dir and is-# taken under DATA_DIR, which on the host is the volume's mountpoint rather than the working-# directory's ./data. Other keys (a PostgreSQL name, user or password) are returned as written.+# With a third argument of `path`, the value names a filesystem path: a ./data or ./data/... value+# from either file is relative to the app's working directory, so it names a path in the data dir and+# is taken under DATA_DIR, which on the host is the volume's mountpoint rather than the working+# directory's ./data (compose hands ./.env's paths to the container, where ./data is the volume). A+# value from the environment is the caller's own and is read as written, as are other keys (a+# PostgreSQL name, user or password).# Fails, printing nothing, when a layer sets the key in a form openwa_env_file_value rejects. Callers# must act on that status: set -e does for a top-level assignment, but not inside a function called# from a command substitution or for a substitution in a command's arguments.@@ -421,7 +423,7 @@ openwa_resolve() {value="$(openwa_env_file_value "$layer" "$key")" || rc=$?case "$rc" in0)- if [ "$kind" = path ] && [ "$layer" = "$OPENWA_GENERATED_ENV" ]; then+ if [ "$kind" = path ]; thencase "$value" in./data | data) value="$DATA_DIR" ;;./data/* | data/*) value="${DATA_DIR%/}/${value#*data/}" ;;diff --git a/scripts/restore.sh b/scripts/restore.shindex addf9ef9d..c391acec8 100755--- a/scripts/restore.sh+++ b/scripts/restore.sh@@ -16,15 +16,14 @@# --force overwrite databases that already hold a working install's data; without it# the restore refuses to touch a live target before changing anything# Environment:-# MAIN_DATABASE_NAME restore target for the auth/audit DB (default: ./data/main.sqlite)-# DATABASE_NAME restore target for the SQLite data store (default: ./data/openwa.sqlite)+# MAIN_DATABASE_NAME restore target for the auth/audit DB (default: <data dir>/main.sqlite)+# DATABASE_NAME restore target for the SQLite data store (default: <data dir>/openwa.sqlite)# Both resolve EXACTLY like the app: the environment first, then ./.env, then# .env.generated (the archive's copy when it carries one, else the data dir's),-# otherwise the fixed ./data default (see lib-env.sh). The defaults are NOT-# derived from OPENWA_DATA_DIR; restoring there would write databases the app-# never reads (fresh-empty boot + new master key).-# OPENWA_DATA_DIR data directory to restore non-DB state into (default: ./data); a ./data/...-# path read from .env.generated, database paths included, is taken under it+# otherwise the app's ./data default (see lib-env.sh).+# OPENWA_DATA_DIR the app's ./data directory to restore into, such as a volume's mountpoint on+# the host (default: ./data); the ./data defaults, and a ./data/... path read+# from ./.env or .env.generated, are taken under it# SESSION_DATA_PATH, BAILEYS_AUTH_DIR, STORAGE_LOCAL_PATH, PLUGINS_DIR# override the corresponding state directories# PLUGIN_STATE_DIR root whose plugins/ holds the plugin registry and ctx.storage (default: the@@ -296,19 +295,20 @@ done < <(tar -tzf "$ARCHIVE")tar -xzf "$ARCHIVE" -C "$STAGE"# Targets resolve exactly like the app: an explicit environment value, then ./.env, then the-# dashboard's .env.generated, else the fixed ./data defaults. They may legitimately live outside-# OPENWA_DATA_DIR. The archive's .env.generated replaces the target's further down, so when it carries-# one, that copy is the third layer: the restored app reads its paths, and state placed where the-# replaced file pointed would never be opened. Resolved before anything is validated or written.+# dashboard's .env.generated, else the app's ./data defaults under OPENWA_DATA_DIR. They may+# legitimately live outside it. The archive's .env.generated replaces the target's further down, so+# when it carries one, that copy is the third layer: the restored app reads its paths, and state+# placed where the replaced file pointed would never be opened. Resolved before anything is+# validated or written.if [ -f "$STAGE/.env.generated" ]; thenOPENWA_GENERATED_ENV="$STAGE/.env.generated"log "Paths not set in the environment or ./.env come from the archive's .env.generated."fi-MAIN_DB="$(openwa_resolve MAIN_DATABASE_NAME ./data/main.sqlite path)"+MAIN_DB="$(openwa_resolve MAIN_DATABASE_NAME "${DATA_DIR%/}/main.sqlite" path)"# DATABASE_NAME is only a target for an archive carrying the SQLite data store; a PostgreSQL dump is# loaded by hand, so a line for it the scripts cannot parse does not stop that restore.if [ -f "$STAGE/openwa.sqlite" ]; then- DATA_DB="$(openwa_resolve DATABASE_NAME ./data/openwa.sqlite path)"+ DATA_DB="$(openwa_resolve DATABASE_NAME "${DATA_DIR%/}/openwa.sqlite" path)"fiSESSIONS_DIR="$(openwa_resolve SESSION_DATA_PATH "$DATA_DIR/sessions" path)"BAILEYS_DIR="$(openwa_resolve BAILEYS_AUTH_DIR "$DATA_DIR/baileys" path)"diff --git a/scripts/smoke-test-backup-restore.sh b/scripts/smoke-test-backup-restore.shindex a5e245f39..2b9bb05c0 100755--- a/scripts/smoke-test-backup-restore.sh+++ b/scripts/smoke-test-backup-restore.sh@@ -54,8 +54,9 @@# (ah) pg_dump makes the app's TLS check when DATABASE_SSL=true (falling back to the system CA store# without node), connects as before when it is not, and never starts past a DATABASE_SSL or# DATABASE_SSL_REJECT_UNAUTHORIZED line the scripts cannot parse-# (ai) ./data paths in .env.generated follow OPENWA_DATA_DIR in a run on the host, in both scripts,-# while non-path settings there are read as written+# (ai) the ./data defaults and ./data paths in ./.env and .env.generated follow OPENWA_DATA_DIR in a+# run on the host, in both scripts, while non-path settings and a ./data path from the environment+# are read as written## Usage: ./scripts/smoke-test-backup-restore.sh# Requires: bash, tar, node (restore.sh path resolution). sqlite3 is optional (see (c) and (k)).@@ -1927,22 +1928,29 @@ if [ "$(PATH="$AH/nonode" backup_ah "${PG_AH}DATABASE_SSL=true\n")" != "mode=verfail "(ah) without node the system CA store was not used, or the log gave no hint: $(cat "$AH/out.log")"fipass "(ah) pg_dump verifies the server under DATABASE_SSL=true and is unchanged without it"-echo "==> (ai) ./data paths in .env.generated follow OPENWA_DATA_DIR in a run on the host"+echo "==> (ai) ./data defaults and paths follow OPENWA_DATA_DIR in a run on the host"# The app writes STORAGE_LOCAL_PATH=./data/media on first run, and a dashboard save adds-# SESSION_DATA_PATH=./data/sessions, both relative to /app in the image. Run on the host with-# OPENWA_DATA_DIR at the volume's mountpoint, the scripts read them against the host's working-# directory: the backup left the volume's media and sessions out, or took a stale ./data there, and-# exited 0, and the restore put them where the app never reads them.+# SESSION_DATA_PATH=./data/sessions, both relative to /app in the image, where the databases default to+# ./data too and compose hands ./.env's PLUGINS_DIR=./data/plugins (as .env.example sets it) to the+# app. Run on the host with OPENWA_DATA_DIR at the volume's mountpoint, the scripts read these+# against the host's working directory: the backup took a stale ./data there, or left the volume's+# state out, and exited 0, and the restore put it where the app never reads it.AI="$WORK/ai"-mkdir -p "$AI/vol/media" "$AI/vol/sessions/session-1" "$AI/host/data/media" "$AI/vol2" "$AI/x"+mkdir -p "$AI/vol/media" "$AI/vol/sessions/session-1" "$AI/vol/plugins/p1" "$AI/host/data/media" \+ "$AI/host/data/plugins/stale" "$AI/vol2" "$AI/x"make_fixture "$AI/vol/main.sqlite" "ai-main"make_fixture "$AI/vol/openwa.sqlite" "ai-data"+make_fixture "$AI/host/data/main.sqlite" "ai-stale-main"+make_fixture "$AI/host/data/openwa.sqlite" "ai-stale-data"printf 'ai-media\n' >"$AI/vol/media/a.jpg"printf 'ai-session\n' >"$AI/vol/sessions/session-1/marker"+printf '{}\n' >"$AI/vol/plugins/p1/manifest.json"printf 'host-stale\n' >"$AI/host/data/media/stale.jpg"-# The database paths come from the same file here, so they follow the volume too.-printf '%s\n' STORAGE_LOCAL_PATH=./data/media SESSION_DATA_PATH=./data/sessions \- MAIN_DATABASE_NAME=./data/main.sqlite DATABASE_NAME=./data/openwa.sqlite >"$AI/vol/.env.generated"+printf '{}\n' >"$AI/host/data/plugins/stale/manifest.json"+printf 'PLUGINS_DIR=./data/plugins\n' >"$AI/host/.env"+# What the app writes: no database path, so the databases take their ./data defaults.+printf '%s\n' DATABASE_TYPE=sqlite STORAGE_LOCAL_PATH=./data/media SESSION_DATA_PATH=./data/sessions \+ >"$AI/vol/.env.generated"(cd "$AI/host" && OPENWA_DATA_DIR="$AI/vol" BACKUP_DIR="$AI/out" "$BACKUP" >/dev/null 2>&1) ||fail "(ai) backup from the host failed"ARCHIVE_AI="$(ls "$AI"/out/openwa-backup-*.tar.gz)"@@ -1957,24 +1965,37 @@ fiif [ "$(cat "$AI/x/sessions/session-1/marker" 2>/dev/null || true)" != "ai-session" ]; thenfail "(ai) backup did not archive the volume's sessions"fi+if [ ! -f "$AI/x/plugin-packages/p1/manifest.json" ] || [ -e "$AI/x/plugin-packages/stale" ]; then+ fail "(ai) backup did not archive the volume's plugins: $(find "$AI/x/plugin-packages" 2>&1 | tr '\n' ' ')"+fi(cd "$AI/host" && OPENWA_DATA_DIR="$AI/vol2" "$RESTORE" "$ARCHIVE_AI" >/dev/null 2>&1) ||fail "(ai) restore from the host failed"if [ "$(cat "$AI/vol2/media/a.jpg" 2>/dev/null || true)" != "ai-media" ] ||[ "$(cat "$AI/vol2/sessions/session-1/marker" 2>/dev/null || true)" != "ai-session" ] ||[ "$(db_fingerprint "$AI/vol2/main.sqlite" 2>/dev/null || true)" != "ai-main" ] ||- [ "$(db_fingerprint "$AI/vol2/openwa.sqlite" 2>/dev/null || true)" != "ai-data" ]; then- fail "(ai) restore did not put media, sessions and databases in the volume"-fi-if [ "$(ls -A "$AI/host/data")" != media ] || [ "$(ls -A "$AI/host/data/media")" != stale.jpg ]; then+ [ "$(db_fingerprint "$AI/vol2/openwa.sqlite" 2>/dev/null || true)" != "ai-data" ] ||+ [ ! -f "$AI/vol2/plugins/p1/manifest.json" ]; then+ fail "(ai) restore did not put media, sessions, plugins and databases in the volume"+fi+if [ "$(db_fingerprint "$AI/host/data/main.sqlite")" != "ai-stale-main" ] ||+ [ "$(db_fingerprint "$AI/host/data/openwa.sqlite")" != "ai-stale-data" ] ||+ [ "$(cd "$AI/host/data" && find . -mindepth 1 -maxdepth 1 | LC_ALL=C sort | tr '\n' ' ')" != \+ "./main.sqlite ./media ./openwa.sqlite ./plugins " ] ||+ [ "$(ls -A "$AI/host/data/media")" != stale.jpg ] || [ "$(ls -A "$AI/host/data/plugins")" != stale ]; thenfail "(ai) restore wrote into the host's working directory: $(find "$AI/host/data" | tr '\n' ' ')"fi+# A ./data path passed in the environment is the caller's own and is read against the working directory.+mkdir -p "$AI/host/data/sessions/session-1"+printf 'ai-host-session\n' >"$AI/host/data/sessions/session-1/marker"+(cd "$AI/host" && OPENWA_DATA_DIR="$AI/vol" SESSION_DATA_PATH=./data/sessions BACKUP_DIR="$AI/out-env" \+ "$BACKUP" >/dev/null 2>&1) || fail "(ai) backup with SESSION_DATA_PATH in the environment failed"+if [ "$(tar -xzOf "$(ls "$AI"/out-env/openwa-backup-*.tar.gz)" ./sessions/session-1/marker)" != "ai-host-session" ]; then+ fail "(ai) a ./data path from the environment was taken under OPENWA_DATA_DIR"+fi# A leftover ./uploads falls back to the volume's media as well, not to the host's ./data/media.printf 'STORAGE_LOCAL_PATH=./uploads\n' >"$AI/vol/.env.generated"-(- cd "$AI/host"- MAIN_DATABASE_NAME="$AI/vol/main.sqlite" DATABASE_NAME="$AI/vol/openwa.sqlite" \- OPENWA_DATA_DIR="$AI/vol" BACKUP_DIR="$AI/out-uploads" "$BACKUP" >/dev/null 2>&1-) || fail "(ai) backup with a leftover ./uploads failed"+(cd "$AI/host" && OPENWA_DATA_DIR="$AI/vol" BACKUP_DIR="$AI/out-uploads" "$BACKUP" >/dev/null 2>&1) ||+ fail "(ai) backup with a leftover ./uploads failed"if ! tar -tzf "$(ls "$AI"/out-uploads/openwa-backup-*.tar.gz)" | grep -qx './media/a.jpg'; thenfail "(ai) a leftover ./uploads did not fall back to the volume's media"fi@@ -1994,7 +2015,7 @@ printf 'DATABASE_TYPE=postgres\nDATABASE_HOST=data\nDATABASE_USERNAME=data\nDATAif [ "$(cat "$AI/pg/pg_dump-args" 2>/dev/null || true)" != "data/s3cret|-h|data|-p|5432|-U|data|data|" ]; thenfail "(ai) Postgres settings from .env.generated were rewritten: $(cat "$AI/pg/pg_dump-args" 2>&1)"fi-pass "(ai) a host run backs up and restores the volume's databases, media and sessions, not the working directory's"+pass "(ai) a host run backs up and restores the volume's databases, media, sessions and plugins, not the working directory's"echo ""echo "All smoke tests passed!"diff --git a/src/common/docs-governance.spec.ts b/src/common/docs-governance.spec.tsindex 147f3fd42..3f61be402 100644--- a/src/common/docs-governance.spec.ts+++ b/src/common/docs-governance.spec.ts@@ -145,14 +145,17 @@ describe('governance docs match the repository', () => {expect(note).toContain('`docker compose up -d --no-build`');});- // Compose hands `./.env`'s PLUGINS_DIR to the container, where `./data/plugins` is in the volume;- // the backup scripts read the same line against the host's working directory.- it('tells a host-mount backup to override the ./data paths ./.env sets', () => {+ // Compose hands `./.env`'s PLUGINS_DIR to the container, where `./data/plugins` is in the volume,+ // so the backup scripts read it, like the ./data defaults, under OPENWA_DATA_DIR.+ it('tells a host-mount backup that ./data paths in ./.env follow OPENWA_DATA_DIR', () => {expect(read('.env.example')).toMatch(/^PLUGINS_DIR=\.\/data\/plugins\b/m);expect(read('docker-compose.yml')).toContain('- PLUGINS_DIR=${PLUGINS_DIR:-');- const note = between(read('docs/11-operational-runbooks.md'), '> The scripts resolve every other path', '\n>\n');- expect(note).toMatch(/A `\.\/data\/\.\.\.` path in `\.\/\.env` needs the same\s+>\s+override/);+ const note = between(read('docs/11-operational-runbooks.md'), '> The scripts resolve every other path', '\n>\n')+ .replace(/^> ?/gm, '')+ .replace(/\s+/g, ' ');+ expect(note).toContain('A relative `./data/...` path in `./.env` or `.env.generated`');expect(note).toContain('`PLUGINS_DIR=./data/plugins`');+ expect(note).toContain('is read under `OPENWA_DATA_DIR`, as are the `./data` database and state defaults');});// docs/20 section 20.4: the project runs no real-time chat server, and the `openwa` name is shared.