REE Service
The ree_service component integrates the RDMC platform with the external
Reusable Execution Environment (REE) service. It provides the Execution
Environment step of the creation wizard (the REE Workbench) and acts as an
authenticated proxy between the user’s browser and the REE REST API.
Architecture
The component never talks to Docker or build infrastructure itself. All heavy
lifting (building, exporting, validating execution environments) happens in the
external REE service (REE_URL, default
https://ree.create.nfdixcs.org). ree_service is responsible for:
rendering the REE Workbench page (wizard step 2),
forwarding JSON/file requests from the browser to the REE API (adding OAuth credentials on the way),
persisting the link between a container and its REE,
saving REE job results back into the container as regular resources.
flowchart LR
Browser["Browser (ree_workbench.js)"] -->|JSON/file requests| App["ree_service views"]
App -->|"OAuth or plain HTTP"| REE["External REE service /api/v3/"]
App -->|ContainerREE, Upload records| DB[("RDMC database")]
App -->|job artifacts| Media["MEDIA_ROOT / container files"]
Component Layout
ree_service/
├── apps.py # AppConfig (ReeServiceConfig)
├── models.py # ContainerREE, UnboundREE, BoundREE, forms
├── urls.py # Routes (included from rdmc.urls without prefix)
├── migrations/
├── views/
│ ├── ree.py # Proxy endpoints: components, jobs, logs, artifacts
│ └── ree_workbench.py # Workbench page + container-side JSON endpoints
├── templates/
│ ├── ree_workbench.html # The Execution Environment wizard step
│ └── ree_definition.html # Legacy definition page
└── static/ree_service/
├── css/styles_ree_workbench.css
└── js/ree_workbench.js # (+ ree_common.js, ree_components.js, ree_definition.js)
Models
Model |
Purpose |
|---|---|
|
One-to-one link between a container ( |
|
Legacy flow: an REE whose definition was started during container creation but that has not yet been added (bound) to the container. |
|
Legacy flow: an REE created from an upload and added to a container. |
Settings & Feature Flag
Setting / flag |
Meaning |
|---|---|
|
Base URL of the external REE service. A scheme is added automatically
if missing ( |
|
When |
|
Checked via |
The REE Workbench
The Workbench (templates/ree_workbench.html +
static/ree_service/js/ree_workbench.js) is the wizard’s Execution
Environment step. Its server-side state is minimal: the template receives the
container’s ree_id and ree_name (from ContainerREE) and the artifact
list; everything else is loaded by the JavaScript through the JSON endpoints
below.
The user flow it implements:
Create an REE by name (
handle_create_ree_post→POST /api/v3/reeson the external service; the returned identifier is persisted inContainerREE).Fill the three component slots —
repository,runtime, andsbom— either by picking an existing container resource or by uploading a file from the user’s device. Uploaded component files are also stored as container uploads (resource typeREE,artifact_location="upload_from_device").Run jobs —
export,build, andvalidate— and watch their state in the Pipeline panel (job list, log download, artifact download).Save job artifacts back into the container: the result file is written into the selected artifact folder and registered as a regular upload with the internal resource type
ree_export,ree_build, orree_validation, so it appears in the Artifact Initialization step and ends up in the sealed container.
Endpoints
All routes live in ree_service/urls.py and are included from rdmc.urls
without a prefix. Two groups exist:
Proxy endpoints (views/ree.py) — thin authenticated proxies to the
external REE API (/api/v3/…); responses are passed through unchanged, and
each interaction is logged:
Route |
Purpose |
|---|---|
|
Rename an REE / update its metadata. |
|
Read, set, or clear one component slot. |
|
Start a job ( |
|
List the jobs of an REE. |
|
Job details, log file, and result artifact (streamed). |
|
Fetch the job artifact and persist it in the container
( |
|
Allowed file extensions per component slot (enforced by the REE service — its error messages are surfaced to the user as-is). |
Workbench endpoints (views/ree_workbench.py) — container-side JSON
endpoints that never leave the application process (except readiness/jobs,
which aggregate REE API data via the ReeApi wrapper):
Route |
Purpose |
|---|---|
|
Artifact/folder tree of the active container for the resource picker. |
|
File resources of one artifact (with extension filtering); includes loose uploads, folder-upload rows, and on-disk files. |
|
REE job artifacts already saved into the container. |
|
Remove a saved job artifact (file + upload record). |
|
Current state of the three component slots. |
|
Aggregated readiness (which slots are filled, which jobs may start). |
|
Jobs with normalized state for the Pipeline panel. |
|
Fill a slot from an existing container resource (file is streamed to the REE service). |
|
Fill a slot with a file uploaded from the user’s device. |
Conventions & Pitfalls
Guards first: every endpoint checks
is_active('REE_ENABLED')and the HTTP method (seefeature_guard) before doing anything.Session container: Workbench endpoints resolve the active container from
request.session["container_id"]; requests without an active container return400.Error pass-through: REE API errors are not rephrased — the message from the external service is extracted (
extract_api_error) and shown to the user, because validation rules (e.g., allowed file types) are REE business logic.Logging: all proxy interactions are logged via
log_ree_api_interactionso support can trace REE API traffic per user.Saved job artifacts are regular uploads. Anything the user saves from a job goes through
Upload.create_with(...)with the internal typesree_export,ree_build, andree_validation; stale duplicates are removed first (remove_stale_uploads).Timeouts: standard calls use 10–30 s; artifact downloads stream with a 120 s timeout; streaming a component file into a slot uses 300 s.