Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ jobs:
/tmp/wheel-check/bin/pip install dist/*.whl
cd /tmp && /tmp/wheel-check/bin/python -c "import odoo_instance_manager, instance_manager.workflows.manage, instance_manager.support, instance_manager.neutralise"

- name: Verify the generated data commands (stubs + a throwaway PostgreSQL)
run: python tools/verify_data_safety.py

- name: Verify secrets stay out of process arguments, previews and errors
run: python tools/verify_secrets.py

- name: Verify nginx and fail2ban accept the generated configuration
run: |
sudo apt-get update -qq
python tools/verify_ops_configs.py

- name: Set up Node
uses: actions/setup-node@v6
with:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ All notable changes to this project are documented here. The format is based on

### Changed

- **Interface text is English throughout**, with Spanish only through the catalog: about twenty Spanish labels
left in the code (report headers, certificate states, prompts) are now English keys. The catalog is written
English → Spanish, the direction it is read; written the other way and inverted, it silently merged English
strings whose Spanish matched. A test fails when a UI string has no Spanish entry.
- CI also runs `tools/verify_data_safety.py`, `tools/verify_secrets.py` and `tools/verify_ops_configs.py`, and
`pytest` works without installing the package (`pythonpath`).
- *Install Odoo instance + PostgreSQL* no longer opens PostgreSQL to the network (`listen_addresses`, `pg_hba`).
- The systemd unit follows Odoo's own (`KillMode=mixed`) and starts after a local PostgreSQL.
- apt installs run unattended and wait for the dpkg lock.
Expand Down
11 changes: 7 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ are held to a careful, spec-first standard.
confirmations, and identifier validation are load-bearing (see
[`docs/decisions/0001-plan-preview-apply-safety.md`](docs/decisions/0001-plan-preview-apply-safety.md)).
- **Keep planners pure.** Functions in `planners.py` build `list[Command]` and must not execute anything or
perform I/O. Execution lives in `system.py`; orchestration in `workflows.py`.
perform I/O. Execution lives in `system.py`; orchestration in the `workflows/` package.
- **Validate and quote every operator-supplied value** that reaches a shell command or SQL string. Use the
existing `_quote`/`shlex.quote` and the identifier validators — do not interpolate raw input.

Expand All @@ -22,11 +22,13 @@ are held to a careful, spec-first standard.
|------|------|
| `odoo_instance_manager.py` | Entry point, root check, main menu |
| `instance_manager/models.py` | `InstanceConfig`, identifier validation, path derivation |
| `instance_manager/support.py` | Per-version facts: Python, setuptools, PostgreSQL floor, cores, pinned uv |
| `instance_manager/neutralise.py` | Neutralisation rules for copied databases (pure SQL builders) |
| `instance_manager/planners.py` | Pure command-plan builders (config/systemd/nginx/fail2ban) |
| `instance_manager/system.py` | Execution primitives, existence checks, preview/apply |
| `instance_manager/prompts.py` | Interactive input, file picker, phrase confirmation |
| `instance_manager/ui.py` | Terminal rendering |
| `instance_manager/workflows.py` | Menus, plan assembly, discovery/audit |
| `instance_manager/workflows/` | Menus, plan assembly, discovery/audit — one module per capability over `common.py` |
| `openspec/specs/` | Capability specifications (the source of truth for behavior) |
| `docs/` | User- and operator-facing documentation |

Expand All @@ -53,12 +55,13 @@ python3 tools/verify_ops_configs.py # nginx -t and fail2ban on the generated
python3 tools/verify_secrets.py # secrets in no process argument, preview or error
```

`tools/verify_data_safety.py` is not part of CI: it executes the generated scheduled-backup script, the
`tools/verify_data_safety.py`, `tools/verify_secrets.py` and `tools/verify_ops_configs.py` also run in CI.
`tools/verify_data_safety.py` executes the generated scheduled-backup script, the
retention prune and the delete step against stub binaries, and the template copy, forced drop and purge
discovery against a PostgreSQL cluster of its own (it needs `initdb` and refuses to run as root). Run it after
changing any of those.

`tools/verify_install_runtime.py` is not part of CI either: it downloads the pinned uv (and refuses a wrong
`tools/verify_install_runtime.py` is not part of CI: it downloads the pinned uv (and refuses a wrong
checksum), installs the interpreter the matrix picks, builds a real venv for each Odoo checkout you pass and
starts `odoo-bin --version`; for Odoo <= 16 it also shows the unpinned setuptools breaks it. It needs network
access and the build dependencies, and writes only to a temp directory. Run it after changing
Expand Down
6 changes: 4 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ passes an operator gate.
```mermaid
flowchart TD
entry["odoo_instance_manager.py<br/>entry point · root check · main menu"]
workflows["workflows.py<br/>menus · plan assembly · discovery · audit"]
workflows["workflows/<br/>menus · plan assembly · discovery · audit"]
subgraph inputs["Input & presentation"]
prompts["prompts.py<br/>ask/choose · file picker · phrase confirm"]
ui["ui.py<br/>tables · styling"]
Expand All @@ -43,8 +43,10 @@ flowchart TD
| Layer | Module | Responsibility | Side effects |
|-------|--------|----------------|--------------|
| Entry | `odoo_instance_manager.py` | Enforce root, configure UTF-8, main menu loop | Reads UID, prints |
| Orchestration | `instance_manager/workflows.py` | Collect input, assemble plans, run discovery and the read-only audit | Mostly via `system.py`; also reads files and writes the optional audit report |
| Orchestration | `instance_manager/workflows/` (one module per capability) | Collect input, assemble plans, run discovery and the read-only audit | Mostly via `system.py`; also reads files and writes the optional audit report |
| Model | `instance_manager/models.py` | `InstanceConfig`, identifier validation, path derivation | None (pure) |
| Version facts | `instance_manager/support.py` | Per Odoo version: Python range and fallback, setuptools pin, PostgreSQL floor, core repositories, the pinned uv | None (pure data) |
| Neutralisation | `instance_manager/neutralise.py` | The rules that make a copied database unable to act as production, as SQL | None (pure) |
| Planning | `instance_manager/planners.py` | Build `list[Command]` for every action | **None (pure)** |
| Execution | `instance_manager/system.py` | `run()`, existence checks, `preview_commands`, `apply_commands` | Runs shell |
| Input | `instance_manager/prompts.py` | Interactive prompts, file picker, phrase confirmation | Reads stdin |
Expand Down
2 changes: 1 addition & 1 deletion docs/decisions/0001-plan-preview-apply-safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ could destroy the wrong instance or open an injection path.

Every host-mutating action follows one pipeline:

1. **Plan** — pure builders in `planners.py` (and inline assembly in `workflows.py`) produce an ordered
1. **Plan** — pure builders in `planners.py` (and inline assembly in the `workflows/` package) produce an ordered
`list[Command]`, where each `Command` is a `(description, command)` pair. Building a command never runs it.
2. **Preview** — `preview_commands` renders the full, numbered plan to the operator before anything executes.
3. **Confirm** — the operator explicitly confirms; **destructive or data-altering** actions additionally
Expand Down
2 changes: 1 addition & 1 deletion docs/server-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updated: 2026-07-04

# Auditing a server (external report)

**Informe para servidor externo** produces a **strictly read-only** report of an Ubuntu host running Odoo. It
**External server report** produces a **strictly read-only** report of an Ubuntu host running Odoo. It
discovers instances and inspects their state without building or applying any mutating plan — safe to run on a
server you are auditing or preparing to hand off.

Expand Down
Loading
Loading