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
| Service | Image | Role | Data |
|---|---|---|---|
app | ghcr.io/mlab-sh/tprm.mlab.sh | Rust / 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. |
mysql | mysql:8 | Business data: organisations, users and sessions, providers, contracts, register, SSO settings, API keys, the kept signed license and the instance id. Database mlabtprm. | mysql_data |
clickhouse | clickhouse/clickhouse-server:26.9 | Activity log (platform_activity, kept 365 days). Keep it pinned: see ClickHouse version. Database mlabtprm. | clickhouse_data |
silo (optional, commented out) | docker.io/pgsty/silo | Local 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
| From | To | Port | Protocol | Notes |
|---|---|---|---|---|
| Reverse proxy | app | 8080 | HTTP/1.1 | Fixed inside the container. The downloadable compose publishes it as ${APP_PORT:-8080}:8080. |
app | mysql | DB_PORT (3306) | MySQL | Not published by the downloadable compose. |
app | clickhouse | 9000 | ClickHouse native | Fixed: there is no variable for the ClickHouse port. 8123 (HTTP) is not used by the app. |
app | S3 endpoint | from S3_ENDPOINT | HTTP(S), AWS Signature V4 | http://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
| Volume | Mounted at | Holds | Back up |
|---|---|---|---|
mysql_data | /var/lib/mysql | All business data. | Yes |
clickhouse_data | /var/lib/clickhouse | Activity log. | Yes |
uploads | /app_mlab_sh/uploads | Profile pictures (avatars/). | Yes |
logs | /app_mlab_sh/log | Daily 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
appwaits for MySQL, then ClickHouse, retrying every 2 seconds (Waiting for MySQL to be up...). Compose also holds it until both healthchecks pass.- Pending MySQL and ClickHouse migrations are applied (
Migrations completed). - On the first start, the administrator
admin@localhostand a default organisation are created (see First login). - The license is checked with mlab.sh (
License guard: ...), then every hour. - The HTTP server binds port 8080 (
Server ready to accept connections).
Port 8080 answers only once these steps are done.
Data flows
| Flow | Path |
|---|---|
| Sign-in with a password | Browser -> proxy -> app -> MySQL. The session is the mlab_session cookie (HttpOnly, SameSite=Lax, Secure unless COOKIE_SECURE=false or DEV=true). |
| API | Client -> proxy -> app with Authorization: token mlab_.... See API reference. |
| Document upload | Browser -> proxy -> app -> S3, streamed in 8 MiB multipart parts. Up to S3_MAX_UPLOAD_MB (2048 by default). |
| Document download | S3 -> app -> browser, streamed. The bucket never needs to be reachable from browsers. |
| Activity | app -> ClickHouse, as records are created, changed and deleted. |
| Request log | app -> stdout, and /app_mlab_sh/log/<date>.log unless LOG_TO_FILE=false. |
Outbound calls
| Destination | When | Sends | Setting |
|---|---|---|---|
https://mlab.sh/api/v1/tprm/license/validate | At boot, then every hour. 15 s timeout. | License key, instance id, application version, container hostname. | MLAB_LICENSE_URL |
| Your OpenID Connect issuer | At 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/v1 | When someone clicks Scan domain or Test key. | The provider's domain name. | MLAB_API_URL, MLAB_API_KEY |
https://api.gleif.org | During register validation, when identifier checks are on (off by default). | The LEIs of the register. | Organization > General |
| Your S3 endpoint | On 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.