This repository contains mic3-api, the HTTP API for the modeling platform. The PostgreSQL connectivity is deployed on EOSC/OKD, and the initial user, external-identity, and member-role schema is managed through Alembic. The API provides database readiness alongside dependency-independent health checks. The local development path validates OIDC access tokens and provisions MIC3 member profiles from the separate Keycloak identity provider.
See the installation and deployment guide for local setup, tests, and EOSC deployment.
GET /healthreturns{"status": "healthy"}.GET /readychecks PostgreSQL and returns{"status": "ready"}or a503response with{"status": "not_ready"}.GET /users/mevalidates an OIDC bearer token and returns the active MIC3 profile and local roles.GET /docsserves FastAPI's generated Swagger UI.GET /openapi.jsonserves FastAPI's generated OpenAPI schema.
Use Python 3.13 and a running Docker engine with Linux containers. These commands
assume the existing Conda environment transience and a terminal in the
repository root; an activated Python 3.13 venv also works.
conda activate transience
python -m pip install -r requirements-dev.txt
if (-not (Test-Path .env)) { Copy-Item .env.example .env }Review .env and use a local-only database password, never EOSC credentials.
The file is excluded from Git and Docker builds. If .env already existed,
copy the OIDC_* and KEYCLOAK_* entries from .env.example and replace the
example passwords with local-only values.
docker compose up -d --wait postgres
python -m alembic upgrade head
python -m uvicorn mic3_api.main:create_app --factory --reloadThen open http://localhost:8000/health, http://localhost:8000/ready, or
http://localhost:8000/docs. The command above starts only the MIC3 PostgreSQL
service; the API runs on the host for development. PostgreSQL uses
127.0.0.1:5433 and a persistent named volume, independently of any native
PostgreSQL installation.
Start the separate local Keycloak database and identity provider with:
docker compose up -d --wait keycloak
docker compose run --rm keycloak-config
$env:OIDC_ISSUER_URL = "http://localhost:8080/realms/mic3"
python -m pytest tests/smoke/test_oidc.pyThe one-shot configuration command declaratively creates or reconciles the
mic3 realm after Keycloak is ready. The realm contains the mic3-api
audience, a PKCE-enabled mic3-local browser client, and local
self-registration. Users are operational data and are never managed by the
reconciler. The Admin Console is at http://localhost:8080/admin/; the detailed
guide explains configuration ownership and the exact Postman login settings.
Unit and dependency-independent health/readiness tests run without Docker or network access:
python -m pytest tests/unit tests/integration/api/test_health.py tests/integration/api/test_readiness.pyWith Docker running, execute the complete unit/integration suite. Testcontainers starts and removes a disposable PostgreSQL instance for schema and migration tests; it does not use the persistent Compose or EOSC databases.
python -m pytest tests/unit tests/integrationPublic smoke tests target a local or deployed running API:
$env:API_BASE_URL = "http://localhost:8000"
python -m pytest tests/smoke/test_health.pyWith local Keycloak running, discovery and an access token copied from Postman exercise the real authenticated path:
$env:OIDC_ISSUER_URL = "http://localhost:8080/realms/mic3"
$env:OIDC_ACCESS_TOKEN = "<temporary access token from Postman>"
python -m pytest tests/smoke/test_oidc.py tests/smoke/test_authenticated_user.pyThe EOSC setup
covers the Secret, PVC, and PostgreSQL StatefulSet/ClusterIP Service. PostgreSQL
has no public Route. The API has a Deployment, ClusterIP Service, and edge-TLS
Route, and its private GHCR image requires the ghcr-pull Secret.
The repository also contains a single-replica EOSC integration deployment for
Keycloak 26.7.3 and its separate PostgreSQL 18 database. Both public services
use OpenShift edge-TLS Routes; PostgreSQL and Keycloak's management port remain
internal. The checked-in EOSC realm enables registration with email verification,
password recovery, password policy, and temporary brute-force lockout. SMTP is
supplied to the configuration Job by an EOSC Secret; local Compose needs no SMTP.
The EOSC Job requires a pre-provisioned realm administration service account and
its client-secret Secret. Realm
settings and OIDC clients are applied through a repeatable, one-shot
keycloak-config-cli Job after Keycloak starts; users, roles, and groups remain
outside declarative management.
Release 0.1.4 uses a two-commit promotion: the source/tag commit publishes the
image, then a promotion commit pins its resulting digest in the API Deployment
and one-shot migration Job. The migration must complete before the API is
updated. No manifest hard-codes a namespace, Route hostname, or credential.
The application version is defined in pyproject.toml; release Git tags use a
v prefix, for example v0.1.4. The distribution, API title, container image,
and Kubernetes resources use mic3-api; the Python import package is
mic3_api. Reinstall the project after changing package metadata.