Skip to content

Commit 5ba1ec4

Browse files
docs(demo): scope reset procedure to SP only
The next demo run wipes only the SP; the DR keeps its database, its 8 approved disability assessments, and its DCI-server bypass flags from prior runs. Rewrite the reset section to stop/wipe only the SP container + filestore, leave docker-compose.dr.yml alone, drop the DR-side reseed step from the post-install wiring, and note explicitly that the DR config carries over.
1 parent 02ea993 commit 5ba1ec4

1 file changed

Lines changed: 52 additions & 68 deletions

File tree

scripts/demo/SPDCI_DEMO_MODULES.md

Lines changed: 52 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
# SPDCI Demo — Modules & Reset Procedure
1+
# SPDCI Demo — Modules & SP Reset Procedure
22

3-
Reference sheet for resetting both OpenSPP instances (SP + DR) from scratch and
4-
reinstalling the modules required for the federated CEL ↔ DCI eligibility demo
5-
(ADR-024).
3+
Reference sheet for resetting the **SP** instance only (DR stays up) and reinstalling
4+
the modules required for the federated CEL ↔ DCI eligibility demo (ADR-024).
65

76
The SP container plays the Social Protection platform that runs CEL eligibility rules;
87
the DR container plays the standalone Disability Registry that answers `has_disability`
98
lookups over DCI. They share the same `db` Postgres container but use different
109
databases (`openspp` vs. `openspp_dr`).
1110

11+
This doc covers the **SP-only reset** flow: the DR's `openspp_dr` database, its 8 seeded
12+
disability assessments, and its DCI-server config are preserved across the reset, so
13+
only the SP needs to be re-installed and re-pointed at the still-running DR. For
14+
first-time setup of both sides (or a full both-instances rebuild), follow the expanded
15+
recipe in `docker-compose.dr.yml`'s header comment and run the seed script on both
16+
sides.
17+
1218
---
1319

1420
## Top-level modules to install
@@ -61,31 +67,34 @@ DR container:
6167

6268
---
6369

64-
## Full reset procedure
70+
## SP-only reset procedure
6571

66-
### 1. Stop and wipe both instances
72+
Resets the SP database (`openspp`) from scratch. **The DR stays up untouched** — its
73+
`openspp_dr` database and the 8 seeded disability assessments are preserved, so the SP's
74+
`has_disability` lookups will keep working against the still-live DR once the SP
75+
re-installs and re-points at it.
6776

68-
```bash
69-
# Stop the DR first (depends on SP's shared network)
70-
docker compose -f docker-compose.dr.yml down -v
77+
### 1. Stop the SP (keep DR running)
7178

72-
# Stop SP + jobworker + db (the -v wipes the SP filestore volume)
79+
```bash
7380
./spp stop
74-
docker compose down -v
81+
docker compose down -v # removes SP filestore volume
7582
```
7683

77-
### 2. Drop the DR database
84+
Verify the DR is still up — it shares the network but has its own container and DB:
7885

79-
`docker compose down -v` removes the SP filestore volume but the `db` Postgres container
80-
is shared and only the `openspp` database is re-created by the SP boot. The DR's
81-
`openspp_dr` database lives in the same Postgres and needs an explicit drop:
86+
```bash
87+
docker compose -f docker-compose.dr.yml ps # openspp-dr should be Up (healthy)
88+
```
89+
90+
If you wiped the SP network (rare), the DR will have lost its external-network link and
91+
you'll need to restart it:
8292

8393
```bash
84-
./spp start # brings up db + SP
85-
docker compose exec db dropdb -U odoo --if-exists openspp_dr
94+
docker compose -f docker-compose.dr.yml up -d
8695
```
8796

88-
### 3. Re-init the SP
97+
### 2. Re-init the SP
8998

9099
```bash
91100
# Set the SP's init modules and start. The two presets pull every
@@ -100,28 +109,14 @@ Watch the boot log; it will exit cleanly when install finishes:
100109
docker compose logs -f openspp-dev | grep -E "Modules loaded|ERROR|init "
101110
```
102111

103-
### 4. Re-init the DR
104-
105-
```bash
106-
# DR uses a separate compose. Its default init module is exactly what
107-
# we need; override only if you want to add demo registrants alongside
108-
# the server endpoint.
109-
docker compose -f docker-compose.dr.yml up -d
110-
```
111-
112-
Default init is `spp_dci_server_disability` (see `docker-compose.dr.yml` line 80).
113-
Override with `ODOO_DR_INIT_MODULES=...` only if you need additional modules — for the
114-
federated demo, the default is enough because the demo-setup script seeds the partners +
115-
disability assessments after boot.
116-
117112
---
118113

119-
## Post-install wiring
114+
## Post-install wiring (SP side only)
120115

121-
After both containers are up, the SP needs a couple of records the data XML does not
122-
seed automatically (because the SP doesn't know your DR's URL or your demo CEL rule):
116+
After the SP is back up, it needs a couple of records the data XML does not seed
117+
automatically (because the SP doesn't know your DR's URL):
123118

124-
### 4a. Point the SP's DR data source at the running DR
119+
### 2a. Point the SP's DR data source at the running DR
125120

126121
The `spp_dci_openspp_dr` preset creates an `spp.dci.data.source` record with a
127122
placeholder URL. Set it to the in-network DR hostname:
@@ -138,44 +133,23 @@ print(f"DR source -> {src.base_url}")
138133
PY
139134
```
140135

141-
### 4b. Seed demo registrants on both sides
136+
### 2b. Seed SP-side registrants
137+
138+
Two options — pick one.
142139

143-
Edit the persona list in `scripts/demo/setup_spdci_demo.py` if needed, then run it
144-
inside each container. The script is idempotent (re-runs update existing partners by
145-
UIN).
140+
**Option A: seed script (matches prior demo runs)**
146141

147142
```bash
148-
# SP side: enrolls 15 IND-NSR-XXXX partners into program id=1 as draft.
143+
# Enrolls 15 IND-NSR-XXXX partners into program id=1 as draft.
149144
docker compose exec openspp-dev odoo shell -d openspp --no-http \
150145
< scripts/demo/setup_spdci_demo.py
151-
152-
# DR side: creates approved disability assessments for 8 of those UINs.
153-
docker compose -f docker-compose.dr.yml exec openspp-dr \
154-
odoo shell -d openspp_dr --no-http \
155-
< scripts/demo/setup_spdci_demo.py
156-
```
157-
158-
The same file detects which side it's running on by inspecting installed modules — no
159-
flag needed.
160-
161-
### 4c. (Optional) Allow unsigned DCI requests for the demo
162-
163-
The DR enforces DCI envelope signature + bearer auth by default. For the demo, relax
164-
both via the system parameters:
165-
166-
```bash
167-
docker compose -f docker-compose.dr.yml exec openspp-dr \
168-
odoo shell -d openspp_dr --no-http <<'PY'
169-
P = env["ir.config_parameter"].sudo()
170-
P.set_param("dci.allow_unsigned_requests", "true")
171-
P.set_param("dci.bypass_bearer_auth", "true")
172-
env.cr.commit()
173-
PY
174146
```
175147

176-
Production: register the SP's public key in the DR's DCI Sender Registry instead.
148+
The script is idempotent (re-runs update existing partners by UIN). It also detects when
149+
run on the DR and seeds the disability assessments instead — but **don't run it on the
150+
DR this time**; the DR already has its 8 assessments from the previous run.
177151

178-
### 4d. Operator-driven SR import (alternative to the seed script)
152+
**Option B: SR-import wizard (operator-driven, recommended for the demo presentation)**
179153

180154
After the SP is up, an operator can populate registrants via the wizard under **Registry
181155
→ Import from External Registry**:
@@ -186,8 +160,18 @@ After the SP is up, an operator can populate registrants via the wizard under **
186160
step.
187161
- Preview → Import Selected.
188162

189-
This produces the same SP-side state as `setup_spdci_demo.py`, minus the DR-side
190-
assessments (DR seeding still needs the script).
163+
This produces the same SP-side state as the seed script.
164+
165+
### 2c. DR config — NO ACTION NEEDED
166+
167+
The DR's previous setup is preserved:
168+
169+
- `dci.allow_unsigned_requests=true` system parameter (set in a prior run)
170+
- `dci.bypass_bearer_auth=true` system parameter (set in a prior run)
171+
- 8 approved disability assessments seeded against `IND-NSR-0001`/`0003`/`0005`/…
172+
173+
Skip the optional bypass and DR seeding steps from earlier docs — they remain in effect
174+
across SP wipes because the DR database is untouched.
191175

192176
---
193177

0 commit comments

Comments
 (0)