Produces an Odoo-compatible <db>.zip restorable via /web/database/manager on the live VPS (or curl -F backup_file=@... /web/database/restore). Why this script instead of POST /web/database/backup: the Odoo HTTP backup endpoint shells out to pg_dump from $PATH and on this host that returns "Command pg_dump not found" because pg_dump lives in the conda env that Odoo wasn't launched from. This script calls pg_dump directly with PGBIN, copies the filestore, builds a correct manifest.json (odoo_dump, db_name, version, pg_version, modules), and zips the three artefacts in the exact layout Odoo's restore code expects. Layout matches Odoo's own backup output: <db>.zip |- dump.sql (pg_dump --no-owner --format=p) |- manifest.json (odoo_dump=1, version, pg_version, installed modules) |- filestore/ (data_dir/filestore/<db>/ contents) Defaults are encoach_v2 / yamenahmad / /tmp/odoo-data, all overridable via env vars (DB, DB_USER, DATA_DIR, PGBIN, OUT_DIR). Output filename is encoach_v2_YYYYMMDD_HHMMSS.zip in ./backups/. Verified: latest run produced encoach_v2_20260425_031949.zip — 30 MB compressed, 815 entries, 633 tables x 633 COPY data blocks, 575 filestore files, 94 modules in manifest. Made-with: Cursor
4.1 KiB
Executable File
4.1 KiB
Executable File