Skip to Content
mlab docs

Architecture

The containers of a tprm.mlab.sh deployment, what each one stores, the ports and volumes, and every call that leaves your network.

A deployment is one application container and two databases, started by the installation docker-compose.yml. Contract documents go to an S3 bucket you provide. Everything else stays on the host.

Overview

Containers

ServiceImageRoleData
appghcr.io/mlab-sh/tprm.mlab.shRust / Actix-web 4 server: web UI, REST API (/api/v1), migrations, license guard. Runs as the unprivileged mlab user, TZ=Europe/Paris.uploads and logs volumes only.
mysqlmysql:8Business data: organisations, users and sessions, providers, contracts, register, SSO settings, API keys, the kept signed license and the instance id. Database mlabtprm.mysql_data
clickhouseclickhouse/clickhouse-server:26.9Activity log (platform_activity, kept 365 days). Keep it pinned: see ClickHouse version. Database mlabtprm.clickhouse_data
silo (optional, commented out)docker.io/pgsty/siloLocal S3-compatible bucket for contract documents. Any other S3 service can replace it.silo_data

The UI loads no third-party script, font or stylesheet: all assets are served by the app container.

Ports

FromToPortProtocolNotes
Reverse proxyapp8080HTTP/1.1Fixed inside the container. The downloadable compose publishes it as ${APP_PORT:-8080}:8080.
appmysqlDB_PORT (3306)MySQLNot published by the downloadable compose.
appclickhouse9000ClickHouse nativeFixed: there is no variable for the ClickHouse port. 8123 (HTTP) is not used by the app.
appS3 endpointfrom S3_ENDPOINTHTTP(S), AWS Signature V4http://silo:9000 for the local bucket.

The docker-compose.yml at the root of the source repository builds the image locally and publishes 3306 and 8123 on the host. It is for development. In production use the downloadable compose file, which publishes only the app.

Volumes

VolumeMounted atHoldsBack up
mysql_data/var/lib/mysqlAll business data.Yes
clickhouse_data/var/lib/clickhouseActivity log.Yes
uploads/app_mlab_sh/uploadsProfile pictures (avatars/).Yes
logs/app_mlab_sh/logDaily request logs, <YYYY-MM-DD>.log. Mount it at log, not logs, with the 1.6.3 image or later (see Upgrading to 1.6.3).Optional
silo_data/data (in silo)Contract documents, when you run Silo.Yes

Compose prefixes volume names with the project name, by default the directory name: tprm-mlab_mysql_data for the quick start directory. docker volume ls shows the real names.

Start-up sequence

  1. app waits for MySQL, then ClickHouse, retrying every 2 seconds (Waiting for MySQL to be up...). Compose also holds it until both healthchecks pass.
  2. Pending MySQL and ClickHouse migrations are applied (Migrations completed).
  3. On the first start, the administrator admin@localhost and a default organisation are created (see First login).
  4. The license is checked with mlab.sh (License guard: ...), then every hour.
  5. The HTTP server binds port 8080 (Server ready to accept connections).

Port 8080 answers only once these steps are done.

Data flows

FlowPath
Sign-in with a passwordBrowser -> proxy -> app -> MySQL. The session is the mlab_session cookie (HttpOnly, SameSite=Lax, Secure unless COOKIE_SECURE=false or DEV=true).
APIClient -> proxy -> app with Authorization: token mlab_.... See API reference.
Document uploadBrowser -> proxy -> app -> S3, streamed in 8 MiB multipart parts. Up to S3_MAX_UPLOAD_MB (2048 by default).
Document downloadS3 -> app -> browser, streamed. The bucket never needs to be reachable from browsers.
Activityapp -> ClickHouse, as records are created, changed and deleted.
Request logapp -> stdout, and /app_mlab_sh/log/<date>.log unless LOG_TO_FILE=false.

Outbound calls

DestinationWhenSendsSetting
https://mlab.sh/api/v1/tprm/license/validateAt boot, then every hour. 15 s timeout.License key, instance id, application version, container hostname.MLAB_LICENSE_URL
Your OpenID Connect issuerAt sign-in, and when an administrator saves the SSO settings.Discovery, code exchange, user profile.Issuer URL in Organization > Single sign-on
mlab.sh (Sign in with mlab.sh)At sign-in, when enabled.Code exchange, user profile.MLAB_SSO_URL, else MLAB_LICENSE_URL, else https://mlab.sh
https://mlab.sh/api/v1When someone clicks Scan domain or Test key.The provider's domain name.MLAB_API_URL, MLAB_API_KEY
https://api.gleif.orgDuring register validation, when identifier checks are on (off by default).The LEIs of the register.Organization > General
Your S3 endpointOn upload, download, delete and storage check.Documents.S3_*

Only the license check is required. Without it the instance runs for 7 days on its kept license, then pauses. See Licensing, Public footprint and the FAQ.

On this page