Skip to content
Closed
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ and algorithm execution through the platform backend. A welcome notebook,
example analyses, and client documentation help researchers get started while
patient-level records remain at the contributing sites.

The new [mip-jupyter repository](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.2.1)
The new [mip-jupyter repository](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.3.0)
provides the notebook workspace, Python client, and Jupyter images. Example notebooks
live in the [mip-examples repository](https://github.com/Medical-Informatics-Platform/mip-examples).

Expand Down Expand Up @@ -100,7 +100,7 @@ The algorithm documentation describes the available federated analyses and links
to the underlying Exaflow analytic engine documentation.

- [Available federated analysis algorithms](documentation/algorithms.md)
- [Exaflow Analytic Engine](https://github.com/madgik/exaflow/tree/1.2.1)
- [Exaflow Analytic Engine](https://github.com/madgik/exaflow/tree/1.3.0)

# Jupyter Notebooks and Support Agent

Expand All @@ -109,7 +109,7 @@ pipelines, run federated algorithms, and document results alongside Python code.
Cohort Scout can assist with notebook creation and explanation.

- [Notebook getting-started guide](documentation/notebooks.md)
- [MIP Jupyter workspace and Python client](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.2.1)
- [MIP Jupyter workspace and Python client](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.3.0)
- [MIP example notebooks](https://github.com/Medical-Informatics-Platform/mip-examples)

# Data Management
Expand Down
10 changes: 5 additions & 5 deletions deployment/dev/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Versions
EXAFLOW=1.2.1
PLATFORM_BACKEND=10.2.0
PLATFORM_UI=2.1.1
MIP_JUPYTER=0.2.1
MIP=9.2.1
EXAFLOW=1.3.0
PLATFORM_BACKEND=11.0.0
PLATFORM_UI=3.0.0
MIP_JUPYTER=0.3.0
MIP=9.3.0

# Toggle authentication
AUTHENTICATION=0
Expand Down
1 change: 0 additions & 1 deletion deployment/dev/config/localworkers_config.json

This file was deleted.

1 change: 1 addition & 0 deletions deployment/dev/config/workers_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["172.28.0.12:5671"]
59 changes: 8 additions & 51 deletions deployment/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,14 @@ services:
DEPLOYMENT_TYPE: LOCAL
WORKER_LANDSCAPE_AGGREGATOR_UPDATE_INTERVAL: 30
WORKER_TASKS_TIMEOUT: 30
FLOWER_ENABLED: false
FLOWER_EXECUTION_TIMEOUT: 30
FLOWER_SERVER_PORT: 8080
LOCALWORKERS_CONFIG_FILE: /opt/config/localworkers_config.json
LOCALWORKERS_DNS: ""
LOCALWORKERS_PORT: ""
MAX_CONCURRENT_EXPERIMENTS: 32
WORKERS_CONFIG_FILE: /opt/config/workers_config.json
WORKERS_DNS: ""
WORKERS_PORT: ""
AGGREGATION_SERVER_ENABLED: true
AGGREGATION_SERVER_DNS: 172.28.0.13:50051
RABBITMQ_ENABLED: "true"
RABBITMQ_URL: amqp://mip:mip@rabbitmq:5672/%2F
SMPC_ENABLED: false
SMPC_OPTIONAL: false
SMPC_COORDINATOR_ADDRESS: ""
SMPC_GET_RESULT_INTERVAL: 10
SMPC_GET_RESULT_MAX_RETRIES: 100
DP_ENABLED: false
DP_SENSITIVITY: ""
DP_PRIVACY_BUDGET: ""
depends_on:
exaflow_aggregation_server:
condition: service_started
Expand All @@ -70,42 +60,10 @@ services:
default:
ipv4_address: 172.28.0.10

exaflow_global_worker:
image: madgik/exaflow_worker:${EXAFLOW}
environment:
WORKER_IDENTIFIER: globalworker
WORKER_ROLE: GLOBALWORKER
FEDERATION: dementia
LOG_LEVEL: INFO
FRAMEWORK_LOG_LEVEL: INFO
DUCKDB_PATH: /tmp/globalworker.duckdb
DATA_PATH: /opt/data
CONTROLLER_IP: 172.28.0.10
CONTROLLER_PORT: 5000
WORKER_TASKS_TIMEOUT: 30
PROTECT_LOCAL_DATA: false
GRPC_IP: 172.28.0.11
GRPC_PORT: 5670
AGGREGATION_SERVER_ENABLED: true
AGGREGATION_SERVER_DNS: 172.28.0.13:50051
SMPC_ENABLED: false
SMPC_OPTIONAL: false
SMPC_CLIENT_ID: ""
SMPC_CLIENT_ADDRESS: ""
SMPC_COORDINATOR_ADDRESS: ""
depends_on:
- exaflow_controller
- exaflow_aggregation_server
restart: unless-stopped
networks:
default:
ipv4_address: 172.28.0.11

exaflow_local_worker1:
image: madgik/exaflow_worker:${EXAFLOW}
environment:
WORKER_IDENTIFIER: localworker1
WORKER_ROLE: LOCALWORKER
FEDERATION: dementia
LOG_LEVEL: INFO
FRAMEWORK_LOG_LEVEL: INFO
Expand All @@ -117,13 +75,9 @@ services:
PROTECT_LOCAL_DATA: false
GRPC_IP: 172.28.0.12
GRPC_PORT: 5671
GRPC_MAX_WORKERS: 36
AGGREGATION_SERVER_ENABLED: true
AGGREGATION_SERVER_DNS: 172.28.0.13:50051
SMPC_ENABLED: false
SMPC_OPTIONAL: false
SMPC_CLIENT_ID: ""
SMPC_CLIENT_ADDRESS: ""
SMPC_COORDINATOR_ADDRESS: ""
depends_on:
- exaflow_controller
- exaflow_aggregation_server
Expand Down Expand Up @@ -206,6 +160,9 @@ services:
PLATFORM_BACKEND_SERVER: platform-backend:8080
PLATFORM_BACKEND_CONTEXT: services
NOTEBOOK_ENABLED: 0
# nginx resolves this at start; the dev stack has no JupyterHub.
JUPYTER_SERVER: 127.0.0.1:80
JUPYTER_CONTEXT: notebook
MIP_VERSION: "${MIP}"
KEYCLOAK_ORIGIN: "${KEYCLOAK_ORIGIN:-}"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion deployment/docs/BackupAndRecovery.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backup and Recovery

This guide covers the MIP 9.2.1 Kubernetes web and notebook stack and the
This guide covers the MIP 9.3.0 Kubernetes web and notebook stack and the
Exaflow data held by participating sites. Persistent data can reside on several
nodes or in managed storage. Back up the actual PVCs and site data, together
with the configuration needed to recover them.
Expand Down
47 changes: 25 additions & 22 deletions deployment/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,20 @@ Now, with the Kubernetes (K8s) deployment, we have 2 main component packs, that

### The analysis engine: Exaflow

Deploy the [Exaflow 1.2.1 chart](https://github.com/madgik/exaflow/tree/1.2.1/kubernetes)
Deploy the [Exaflow 1.3.0 chart](https://github.com/madgik/exaflow/tree/1.3.0/kubernetes)
for the native federated pipeline:

- Controller: accepts analyses and coordinates execution.
- Local workers: load each site's datasets and execute local computations.
- Global worker: provides the chart's global-worker service.
- Aggregation server: combines partial vectors for algorithms and preprocessing
steps that require aggregation. Keep `aggregation_server.enabled: true` for
the full native algorithm portfolio.

Flower and SMPC are optional features with separate setup requirements. The
example below disables them and focuses on the native pipeline.

### The web and notebook stack

- **platform-ui**: Experiment Studio, result visualizations, and notebook entry.
- **platform-backend**: authenticated analysis API and experiment management.
- **PostgreSQL**: stores platform experiments, folders, and other application state.
- **platform-ui**: analysis studio, result visualizations, and notebook entry.
- **platform-backend**: authenticated analysis API and study management.
- **PostgreSQL**: stores platform analyses, studies, and other application state.
- **JupyterHub and single-user JupyterLab**: notebook sessions and workspaces,
using images from **mip-jupyter**. Hub state and user homes use separate PVCs.
- **External Keycloak**: provides authentication; this chart wires an existing
Expand Down Expand Up @@ -124,7 +120,7 @@ Register a Keycloak redirect URI for the Hub OAuth client:

For Kubernetes, make sure the images set in `jupyterhub.image` and `jupyterhub.singleuser.image` are pushed to the configured registry or loaded onto every node that may run the pods.

`jupyterhub.spawner: operator-api` removes the hub's Kubernetes access entirely. The hub creates and deletes notebooks through the notebook operator's HTTPS spawn API (`jupyterhub.operatorApi.url`, which must start with `https://`) instead of the Kubernetes API, and the chart renders no Role or RoleBinding, whatever `jupyterhub.rbac.create` says — with `jupyterhub.rbac.create: false`, remove the hand-applied Role and RoleBinding after switching. Both the `jupyterhub` ServiceAccount and the hub pod set `automountServiceAccountToken: false`, so the hub pod gets no ServiceAccount token at the standard path; it authenticates with a projected token bound to the audience `mip-notebook-operator`, which the kubelet rotates and the API server rejects, and trusts the spawn API's CA from the `mip-notebooks-ca` ConfigMap (`jupyterhub.operatorApi.caConfigMap`), which mip-infra copies into each federation. The hub picks up a rotated token or CA without a restart. This mode needs `hbpmip/mip-jupyterhub` > `0.2.1` (`0.3.0+` once released; `0.2.1` does not know `operator-api` and falls back to KubeSpawner without credentials) and the spawn API deployed by mip-infra.
`jupyterhub.spawner: operator-api` removes the hub's Kubernetes access entirely. The hub creates and deletes notebooks through the notebook operator's HTTPS spawn API (`jupyterhub.operatorApi.url`, which must start with `https://`) instead of the Kubernetes API, and the chart renders no Role or RoleBinding, whatever `jupyterhub.rbac.create` says — with `jupyterhub.rbac.create: false`, remove the hand-applied Role and RoleBinding after switching. Both the `jupyterhub` ServiceAccount and the hub pod set `automountServiceAccountToken: false`, so the hub pod gets no ServiceAccount token at the standard path; it authenticates with a projected token bound to the audience `mip-notebook-operator`, which the kubelet rotates and the API server rejects, and trusts the spawn API's CA from the `mip-notebooks-ca` ConfigMap (`jupyterhub.operatorApi.caConfigMap`), which mip-infra copies into each federation. The hub picks up a rotated token or CA without a restart. This mode needs `hbpmip/mip-jupyterhub` `0.3.0` or later (older images do not know `operator-api` and fall back to KubeSpawner without credentials) and the spawn API deployed by mip-infra.

The reachability diagram from the legacy profiles is still valid as a reference for deciding the correct public URL:
![MIP Reachability Scheme](../docs/MIP_Configuration.png)
Expand Down Expand Up @@ -187,6 +183,16 @@ Upgrade notes:
- Users without a role on the platform client can no longer open notebooks, and users without a shared experiment's datasets can no longer read it.
- The chart does not change image tags. `KEYCLOAK_REQUIRED_AUDIENCE` and `KEYCLOAK_ORIGIN` do nothing until you deploy images that read them.

### Upgrading from 9.2.x

1. Back up the platform database. platform-backend 11.0.0 runs Flyway V5 and V6 on startup, and V6 renames tables and columns.
2. Create the `exaflow-rabbitmq` Secret (see *Analyses through RabbitMQ*).
3. Update the Exaflow values: rename `localnodes` to `worker_count`, and remove global-worker, Flower and SMPC settings.
4. Upgrade Exaflow 1.3.0, platform-backend 11.0.0, platform-ui 3.0.0 and mip-jupyter 0.3.0 together.
5. Rename `EXPERIMENT_RUN_DRAFT_TTL` to `ANALYSIS_RUN_DRAFT_TTL` if you set it.
6. Give every notebook user a role on the platform's Keycloak client. Users without one get a 403.
7. External API clients must move from `/experiments` to `/analyses`.

### Microk8s installation
On a running Ubuntu (we recommend 22.04) distribution, install microk8s (we **HIGHLY** recommend to **NOT** install Docker on your Kubernetes cluster!):
```
Expand Down Expand Up @@ -224,7 +230,7 @@ For a "federated" deployment, you may want to add nodes to your cluster. "microk
Clone the matching engine release and create an environment-specific values file:

```bash
sudo git clone --branch 1.2.1 https://github.com/madgik/exaflow /opt/exaflow
sudo git clone --branch 1.3.0 https://github.com/madgik/exaflow /opt/exaflow
sudo chown -R mipadmin:mipadmin /opt/exaflow
cp /opt/exaflow/kubernetes/values.yaml /opt/exaflow/kubernetes/my-values.yaml
```
Expand All @@ -235,25 +241,22 @@ namespace, federation name, paths, and worker count for your installation:
```yaml
namespace: <target-namespace>
managed_cluster: false
localnodes: 1
worker_count: 1
exaflow_images:
repository: madgik
version: 1.2.1
version: 1.3.0
federation: <MIP_INSTANCE_OR_FEDERATION_NAME>
aggregation_server:
enabled: true
flower:
enabled: false
smpc:
enabled: false
rabbitmq:
existing_secret: exaflow-rabbitmq
storage:
hostPath:
db:
localworker: /data/<MIP_INSTANCE_OR_FEDERATION_NAME>/localworker
globalworker: /data/<MIP_INSTANCE_OR_FEDERATION_NAME>/globalworker
```

`localnodes` counts local workers. The chart requires one local worker per
`worker_count` counts workers. The chart requires one worker per
eligible host through pod anti-affinity; a single-host installation uses `1`
and labels the same node as both master and worker. The current templates use
`managed_cluster` to select hostPath versus CSV PVC storage; `storage.type`
Expand Down Expand Up @@ -281,7 +284,7 @@ backend's `engines.exaflow.url` must reach `exaflow-controller-service`; the
existing short service name works when both charts share a namespace. For
separate namespaces use the controller's fully qualified service DNS name.

See the [Exaflow chart](https://github.com/madgik/exaflow/tree/1.2.1/kubernetes)
See the [Exaflow chart](https://github.com/madgik/exaflow/tree/1.3.0/kubernetes)
for the full values and templates. The old `credentials_location`,
`db.storage_location`, `db.csvs_location`, and `controller.cleanup_file_folder`
settings are not used by this chart.
Expand All @@ -290,7 +293,7 @@ settings are not used by this chart.

MIP submits analyses to Exaflow over RabbitMQ (specifications and metadata still use `engines.exaflow.url`). The chart always deploys the in-namespace RabbitMQ 4.4.1 broker.

1. Use an Exaflow build that includes [madgik/exaflow#673](https://github.com/madgik/exaflow/pull/673) and [madgik/exaflow#681](https://github.com/madgik/exaflow/pull/681). Upgrade the controller, workers, and aggregation server together. Use a platform-backend build that includes the RabbitMQ transport. Run one Exaflow controller replica and one backend replica.
1. Use Exaflow 1.3.0 or later and platform-backend 11.0.0 or later. Upgrade the controller, workers, and aggregation server together. Run one Exaflow controller replica and one backend replica.
2. Create the `exaflow-rabbitmq` Secret before deploying. Use a URL-safe password (`openssl rand -hex 24`): the same password is embedded in `url`, which Exaflow and the backend read, while the broker reads `username` and `password`. Keep `%2F` as the trailing vhost path so both the Java and Python AMQP clients select the default `/` vhost. The host is the in-namespace Service:

```bash
Expand All @@ -302,7 +305,7 @@ kubectl create secret generic exaflow-rabbitmq -n <namespace> \
```

3. Deploy this chart so the RabbitMQ broker starts.
4. In the Exaflow values set `rabbitmq.enabled: true`. The chart defaults `existing_secret: exaflow-rabbitmq` and `url_secret_key: url` already match this Secret. Deploy Exaflow. `GET /healthcheck/rabbitmq` on the controller must return 200 with `consuming: true`.
4. The Exaflow chart requires the broker Secret. Its defaults `existing_secret: exaflow-rabbitmq` and `url_secret_key: url` already match this Secret. Deploy Exaflow. `GET /healthcheck/rabbitmq` on the controller must return 200 with `consuming: true`.
5. Delivery is at least once, so an analysis can run twice after a controller crash. Broker persistence and backups are your responsibility. The StatefulSet retains its PVC when the broker is deleted or scaled down; keep that PVC until dead-letter messages are inspected.
6. `RABBITMQ_DEFAULT_USER` and `RABBITMQ_DEFAULT_PASS` apply only on first boot with an empty volume. Rotate by running `kubectl exec -n <namespace> exaflow-rabbitmq-0 -- rabbitmqctl change_password <user> <new-password>` first, then update the Secret (`password` and `url`), then restart the Exaflow controller and platform-backend.
7. This chart's broker is RabbitMQ 4.4.1 and writes `consumer_timeout = 7200000`, `max_message_size = 33554432`, `vm_memory_high_watermark.relative = 0.6`, and `raft.wal_max_size_bytes = 134217728` into `rabbitmq.conf` with a 2Gi memory limit. Keep those settings if tuning overrides: RabbitMQ's 30 minute consumer timeout and 16 MiB message limit make long analyses redeliver and oversized requests fail at the broker instead of returning Exaflow's `request_too_large`, and less memory risks tripping the memory alarm or OOMKills under the quorum Raft WAL, 32 MiB messages, and 256 MiB queues.
Expand All @@ -318,7 +321,7 @@ sudo chown -R mipadmin:mipadmin /opt/mip
cp /opt/mip/deployment/kubernetes/values.yaml /opt/mip/deployment/kubernetes/my-values.yaml
```

Use the MIP 9.2.1 release checkout when available. Edit `my-values.yaml` for your
Use the MIP 9.3.0 release checkout when available. Edit `my-values.yaml` for your
installation, including image versions, ingress settings, storage classes, and
external authentication. On microk8s set `cluster.managed: false`; on managed
clusters set it to `true` and choose the appropriate managed storage class.
Expand Down
5 changes: 5 additions & 0 deletions deployment/kubernetes/templates/platform-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ spec:
labels:
app: platform-ui
spec:
# nginx runs as UID 101 and listens on port 80.
securityContext:
sysctls:
- name: net.ipv4.ip_unprivileged_port_start
value: "0"
{{- if eq (toString .Values.cluster.managed) "false" }}
nodeSelector:
master: "true"
Expand Down
16 changes: 8 additions & 8 deletions deployment/kubernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ engines:
replyTimeout: ""
publishTimeout: ""
mip:
version: 9.2.1
version: 9.3.0
platform-ui:
image:
repository: hbpmip/platform-ui
tag: 2.1.1
tag: 3.0.0
ingress:
enabled: true
className: haproxy-public
Expand All @@ -41,7 +41,7 @@ platform-ui:
platform-backend:
image:
repository: hbpmip/platform-backend
tag: 10.2.0
tag: 11.0.0
config:
logLevel: INFO
logLevelFramework: INFO
Expand Down Expand Up @@ -81,7 +81,7 @@ jupyterhub:
cryptKey: ""
image:
repository: hbpmip/mip-jupyterhub
tag: 0.2.1
tag: 0.3.0
resources:
requests:
cpu: 100m
Expand All @@ -104,9 +104,9 @@ jupyterhub:
# operator-api: no Role or RoleBinding is rendered (remove any
# hand-applied Role/RoleBinding after switching).
create: true
# operator-api only. Needs hbpmip/mip-jupyterhub > 0.2.1 (0.3.0+ once
# released; 0.2.1 falls back to KubeSpawner without credentials) and the
# spawn API deployed (mip-infra). The hub authenticates with a ServiceAccount
# operator-api only. Needs hbpmip/mip-jupyterhub 0.3.0 or later (older
# images fall back to KubeSpawner without credentials) and the spawn API
# deployed (mip-infra). The hub authenticates with a ServiceAccount
# token bound to the spawn API's audience: the kubelet rotates it, and the
# API server rejects it. caConfigMap holds the spawn API's CA under ca.crt
# (mip-infra copies it into each federation).
Expand All @@ -129,7 +129,7 @@ jupyterhub:
singleuser:
image:
repository: hbpmip/mip-jupyter
tag: 0.2.1
tag: 0.3.0
storageCapacity: 2Gi
resources:
requests:
Expand Down
Loading