Installation and Self-Hosting
Hosted Use
Section titled “Hosted Use”If you just want to use RELab, start here:
No local setup is required.
Self-Hosting
Section titled “Self-Hosting”Self-hosting makes sense for evaluation, institutional deployment, offline use, or local development. If your main goal is contributing code, CONTRIBUTING.md is the better starting point.
This page is about running the stack. For manifest conventions, tooling policy, and contributor workflow, use the engineering and contributing docs instead.
Prerequisites
Section titled “Prerequisites”- Docker Desktop
justis optional but recommended
Local Docker Setup
Section titled “Local Docker Setup”-
Clone the repository.
Terminal window git clone https://github.com/CMLPlatform/relabcd relab -
Install local tooling if you plan to modify code.
Terminal window just setup -
Configure the backend environment.
Terminal window cp backend/.env.dev.example backend/.env.dev -
Run the first migration pass.
Terminal window just dev-migrateIf you also need CPV or HS taxonomy seeding in the migration container:
Terminal window BACKEND_MIGRATIONS_INCLUDE_TAXONOMY_SEED_DEPS=true docker compose --profile migrations up --build migrator -
Start the stack.
Terminal window just devIf you do not want file watching, use
just dev-upinstead. -
Open the local services.
- Platform: http://127.0.0.1:8010
- API: http://127.0.0.1:8011
- Docs: http://127.0.0.1:8012
- App frontend: http://127.0.0.1:8013
-
Verify the backend is healthy.
Terminal window curl http://127.0.0.1:8011/health -
Run checks if needed.
Terminal window just cijust test
Production / Staging Deployment
Section titled “Production / Staging Deployment”Deploys use a single compose overlay, compose.deploy.yaml. The host’s root .env decides whether the stack comes up as prod or staging — one file, one command, no extra flags. Cloudflare Tunnel remains the supported ingress path. The current operational path is manual on the server: pull the repo, run the deploy stack, run migrations, verify health.
-
Configure a Cloudflare tunnel.
- Set up a domain and a remotely managed tunnel in Cloudflare.
- Forward traffic to
app-site:8081,web-site:8081,api:8000, anddocs-site:8000.
-
Copy
.env.exampleto.envand fill in values.Terminal window cp .env.example .env- Prod host: set
TUNNEL_TOKEN=<prod token>; leave the commented “staging overrides” block commented. Defaults resolve toENVIRONMENT=prod,WEB_CONCURRENCY=4, projectrelab_prod. - Staging host: uncomment the staging block (
APP_ENV=staging,COMPOSE_PROJECT_NAME=relab_staging,WEB_CONCURRENCY=2,BUILD_MODE=staging,PUBLIC_SITE_URL=…,CSP_API_ORIGIN=…) and setTUNNEL_TOKEN=<staging token>.
- Prod host: set
-
Configure the backend runtime environment for this host.
Terminal window cp backend/.env.prod.example backend/.env.prod # on a prod host# ORcp backend/.env.staging.example backend/.env.staging # on a staging host -
Start the stack.
Terminal window just prod-up YESIn the current setup, deployment is done directly on the server.
-
Run migrations.
Terminal window just prod-migrate YESIf you also need taxonomy seeding in the migration container:
Terminal window BACKEND_MIGRATIONS_INCLUDE_TAXONOMY_SEED_DEPS=true docker compose -p relab_prod -f compose.yaml -f compose.deploy.yaml --profile migrations up --build migrator -
Manage the running stack.
Terminal window just prod-logsjust prod-down YES
Optional: central telemetry
Section titled “Optional: central telemetry”If you run a central monitoring stack (Grafana + Loki + Tempo + Prometheus), prod and staging can ship to it without any code changes:
-
Install the Loki Docker driver plugin on the host (once):
Terminal window docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions -
Set
LOKI_URL(and optionallyOTEL_EXPORTER_OTLP_ENDPOINT) in the host’s root.env. Theprod-up/staging-uprecipes auto-includecompose.logging.loki.yamlwhenLOKI_URLis non-empty. Hosts without the variable keep Docker’s defaultjson-filedriver.
See the engineering ops telemetry section for the full flow.
Staging Deployment
Section titled “Staging Deployment”Staging is a first-class operational environment and follows the same manual server-side flow as production.
-
Configure the backend staging environment.
Terminal window cp backend/.env.staging.example backend/.env.staging -
Start the staging stack.
Terminal window just staging-up YES -
Run migrations.
Terminal window just staging-migrate YES -
Manage the running stack.
Terminal window just staging-logsjust staging-down YES
Raspberry Pi Camera Plugin
Section titled “Raspberry Pi Camera Plugin”If you want camera-assisted capture, see the external plugin repository:
The plugin uses WebSocket relay — the RPi connects outbound to the backend, so no public IP or port forwarding is needed. The quickest setup is automatic pairing: set PAIRING_BACKEND_URL on the RPi, boot it, and enter the displayed pairing code in the app. See the plugin install guide and the platform camera guide for details.
If the Pi is headless, you can read the pairing code either from its local /setup page or from the PAIRING READY log line over SSH, docker compose logs, or journalctl.
Need Help?
Section titled “Need Help?”- Docs: docs.cml-relab.org
- Contact: [email protected]