Skip to content

odoo: reset copies, snapshots, Mailpit, apps, restarts and memory caps - #42

Merged
andrewthomaslee merged 1 commit into
mainfrom
odoo-stability-v2
Nov 12, 2026
Merged

andrewthomaslee merged 1 commit into
mainfrom
odoo-stability-v2

Conversation

@andrewthomaslee

Copy link
Copy Markdown
Member

Summary

Stability and usability for the Odoo test instances (never production), items 1-8 of the design review.

odoo-<name>.service  ExecStartPre (each idempotent, logs "pre-start: ...")
  1 runtime config + master password
  2 first start: --init=base,<modules> [--with-demo] [--load-language]
      odoo neutralize -> blocking "invalid" mail server replaced by "Mailpit", mail queue on
      markers .package .modules .golden-pending
  3 sync: package/addons changed -> -u all ; modules added -> install (+ neutralize)
  4 +root: .golden-pending -> CREATE DATABASE odoo-<name>@golden TEMPLATE odoo-<name>, tar files
  5 admin password ; web.base.url (public)
  Restart=on-failure (10 s, 4 per 15 min)  MemoryMax=<memoryMax>
# Change
1 Restart=on-failure; scripts reset-failed before deliberate starts (the start limit counts every start)
2 memoryMax (4G), limits.{memorySoft,memoryHard,timeCpu,timeReal}, max_cron_threads=1
3 reset copy: odoo-reset restores in seconds; --clean; stale when package/addons/demo/apps/language change; --list shows ready/stale/none
4 odoo-snapshot save|restore|list|rm NAME TAG (template DB + files)
5 modules (apps at creation; added later -> installed), language
6 Mailpit (https://mail.<baseDomain>, LAN too), neutralize, default sender <name>@<baseDomain>
7 package or addons change -> -u all on next start, data kept
8 breaking: lan.addresses removed; LAN vhosts listen on every address; http://<IP>/hosts.txt (nginx fills in $server_addr) and /ca.crt bootstrap a client; odoo-hosts reads the live address; allow-list for return locations via a geo map
 flake-parts/nixosModules/
   odoo.nix
+  _odoo/{lib,reset,snapshot,purge,golden-save}.sh   # shellchecked as fragments and whole
 vm-tests/
+  odoo-lifecycle.nix                                 # apps, neutralize, Mailpit, package bump
   odoo.nix odoo-reset.nix odoo-lan.nix odoo-public.nix _odoo-probe.py
 flake.lock devenv.*                                  # org-pkgs -> external-systems/pkgs#30, sync-locks

Docs: odoo.md (mail, start sequence, reset copies, snapshots, troubleshooting), odoo-access.md (bootstrap over the IP, DHCP), README.

Evidence

Bugs the tests caught on the way (fixed): nginx return ignoring allow/deny (stranger got hosts.txt), the start limit locking an instance out after quick resets, neutralize's invalid mail server blocking all mail, no sender on system mail.

vm-test --check                              8 tests evaluate and fit the caps
vm-test odoo --remote --quiet                exit 0   17 subtests (+ crash restart, memory caps)
vm-test odoo-reset --remote --quiet          exit 0    9 subtests (reset copy in seconds, --clean, stale, snapshots, purge)
vm-test odoo-lifecycle --remote --quiet      exit 0    5 subtests (apps, neutralize, Mailpit, -u all + install, quiet restart)
vm-test odoo-lan --remote --quiet            exit 0    9 subtests (IP bootstrap, allow-list incl. hosts.txt, DHCP change)
vm-test odoo-public --remote --quiet         exit 0    5 subtests
vm-test odoo-firefox --remote --quiet        exit 0    3 subtests
each result == nix eval .#legacyPackages.x86_64-linux.vmTests.<t>.outPath of this commit (identical before and after rebasing onto #40)
fmt; check                                   exit 0

Merge Danger

Door: two-way

Breaking: hostSpec.services.odoo.lan.addresses is gone (no shim); home's beelink config drops it in its PR. Existing instances get the new markers on their next start without -u all; their reset copy is made on the first odoo-reset (from scratch once).

Blast Radius: beelink

Replaces #41 (its head became an unsigned server-side rebase). Merge order: pkgs#30, skills#17, modules#40 (all merged), this -> home#44 bumps modules and drops lan.addresses.

🤖 Generated with Claude Code

Testing usability and stability for the Odoo test instances:

1. Restart=on-failure (10 s, at most 4 in 15 min); the scripts clear the
   start limit before deliberate starts.
2. MemoryMax per instance (default 4G) and Odoo's per-worker memory and
   time limits, max_cron_threads = 1.
3. Reset copies: a newly created database is saved as a PostgreSQL
   template (odoo-<name>@golden) plus its files; odoo-reset restores it
   in seconds and rebuilds it from scratch (--clean, or when the
   package, addons, demo data, apps or language changed).
4. odoo-snapshot save/restore/list/rm: named states, same mechanism.
5. `modules` (apps at creation, installed when added later) and
   `language`.
6. Mailpit at https://mail.<baseDomain> (and on the LAN): neutralize
   every new database, replace neutralize's blocking mail server with
   one for Mailpit, keep the mail queue on, and give mail without a
   sender <name>@<baseDomain>.
7. A new package or addons runs `-u all` on the next start.
8. LAN vhosts listen on every address: no lan.addresses (breaking), no
   ip_nonlocal_bind; http://<IP>/hosts.txt (nginx fills in the address)
   and /ca.crt bootstrap a client; odoo-hosts reads the current address.
   The allow-list for `return` locations goes through a geo map (return
   runs before allow/deny).

Scripts move to flake-parts/nixosModules/_odoo/*.sh. New VM test
odoo-lifecycle; odoo, odoo-reset and odoo-lan extended. Bumps org-pkgs
to external-systems/pkgs#30 (run summary) with sync-locks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrewthomaslee
andrewthomaslee enabled auto-merge (squash) November 12, 2026 20:06
@andrewthomaslee
andrewthomaslee merged commit 13c8ec6 into main Nov 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant