- Profiler: UserProfile.note (nullable, startup migration), PUT
/profiles/{id}/note (max 1000 chars); add missing `requests`
dependency (client creation failed without Public IP set).
- UI: clickable rows on Certificates open a compact profile details
modal with an editable note; tooltip with the note on the client
name (v-note-tooltip) and a note icon.
- PKI init runs in a background thread: POST /system/init returns 202,
GET /system/init/status, 409 for a second start, Clear PKI and client
creation are blocked while it runs. A marker file identifies an
interrupted run (only such a PKI is wiped on the next Init).
- PKI Configuration page: state from the server, progress spinner and
step text, polling, Init/Clear/Save locked while running, Init locked
once initialized.
- Tests: one pytest each for notes and async init (requirements-dev.txt).
- Docs: plans and summaries in DOCS/Changes, API reference, README, Index.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2.8 KiB
2.8 KiB
Async PKI initialization (2026-10-04)
Goal: Init PKI can take minutes (DH parameters); it no longer holds an HTTP request. Plan: Async_PKI_Init_PLAN.
Changes
| Area | Change |
|---|---|
API (APP_PROFILER/routers/system.py) |
POST /system/init returns 202 {"state":"running"} and runs the init in a background thread; 409 if a job is running or the PKI is initialized. New GET /system/init/status (state, step, initialized, started_at, finished_at, error). DELETE /system/pki and POST /profiles return 409 while a job is running |
Service (APP_PROFILER/services/pki.py) |
In-memory job state under a lock; the thread uses its own DB session; steps init-pki, ca, server-cert, dh, ta-key, crl; EasyRSA error text is stored in error |
| Interrupted runs | A marker file <easy-rsa>/.pki-init-in-progress (outside the PKI directory) exists while a job runs and is removed on success. A leftover marker (restart, crash, failed job) means the PKI is incomplete: it is wiped and rebuilt on the next Init. A PKI without the marker and with ca.crt counts as initialized and is never wiped automatically |
UI (APP_UI/src/views/PKIConfig.vue) |
State comes from the server on page load; spinner and step text while running, polling every 3 s; Init, Clear and Save disabled while running; Init disabled with a hint once initialized; success or error message at the end; a 409 on start attaches to the running job; the button locks on click |
| Docs | DOCS/Profiler_Management/API_Reference.md |
| Test | APP_PROFILER/test_async_pki_init.py (one test with EasyRSA stubs): 202, second start 409, status running, Clear 409, then done and a further start 409 |
Verification (containers)
| Check | Result |
|---|---|
pytest test_async_pki_init.py and test_profile_note.py in python:3.12-alpine |
2 passed |
| Existing complete PKI | status initialized: true, Init is a no-op |
| Clear, then Init | 202, second start 409, steps init-pki → dh → done (3 s and 54 s in two runs) |
| Partial PKI with the marker (simulated interrupted run) | wiped, rebuilt, marker removed, initialized: true |
| Create a client during the run / after it | 409 / 200 |
| UI bundle | app-ui builds and contains the status polling; the page behaviour is checked manually |
Notes
- The Profiler must run as a single process (in-memory job state):
python main.pyin Docker, oneuvicornin the native unit. Do not add workers. - Initialization is not cancelled by a page reload; the page reattaches to the running job.
- Not implemented: cancelling a run, progress percentage, async Clear PKI.
Existing installations
No manual steps. Rebuild and restart the Profiler (native: ovpmon-profiler; Docker: app-profiler, app-ui). An already initialized PKI is detected as before.