Skip to content
DashboardWebsite

Dashboard Deployment

This page explains how to deploy the dashboard with Docker Compose, either under a path on the API’s origin or on its own domain. It is for platform administrators who build and configure the dashboard image.

The dashboard supports same-origin, path-prefixed deployment. It runs under a path such as /dashboard on the same host as the API. The browser sends API requests to that host, and the ingress routes them to the API service by path. The browser’s session cookie and fetch calls to /auth/..., /orgs/..., and other API paths resolve against the current origin, so the ingress routes them to the correct backend service.

The dashboard has no landing, pricing, or marketing pages. / sends signed-in users to /overview and everyone else to /login. To use your own marketing site, set the optional NEXT_PUBLIC_MARKETING_URL build argument (for example, https://example.com). The sign-in header’s logo then links to that site, and plan links point to its /pricing page. Leave the argument unset to hide those links. docker-compose.prod.yaml passes the value of WEBSITE_URL from .env.prod at the workspace root when run with make up-prod.


The workspace’s local stacks (OpenTremor-deployments/docker-compose.yaml and docker-compose.dev.yaml) use this same-origin layout behind HAProxy on port 8080:

dashboard:
build:
context: ../OpenTremor-dashboard
args:
DASHBOARD_BASE_PATH: /dashboard
NEXT_PUBLIC_API_BASE: "" # relative: same origin as the page
NEXT_PUBLIC_DOCS_BASE_URL: /docs
ports:
- "3001:3000"
environment:
API_BASE: http://opentremor-core:8000

NEXT_PUBLIC_API_BASE is empty, so the browser calls the API on the origin that served the page, and HAProxy routes the request. API_BASE is for server-side fetches over the Compose network. Port 3001 serves the dashboard directly, but its browser API calls resolve through HAProxy.

Set NETWORK_ACCESS_VERDICT_URL (for example, http://opentremor-core:8000/network-access/verdict) to have the dashboard ask the API before serving each page, using the dashboard network access rules. Answers are cached for 30 seconds per caller and path. If the API cannot answer, the dashboard returns 503. The API accepts verdict requests only from a trusted proxy, so add the dashboard container’s address to TRUSTED_PROXIES. If the variable is unset, the dashboard does not check pages.

The dashboard forwards the browser’s X-Forwarded-For header on its server-side API calls, so API rules and key allowlists can use the user’s address instead of the container’s.

ArgumentDefaultPurpose
DASHBOARD_BASE_PATHunset (served at /)The path prefix, such as /dashboard
NEXT_PUBLIC_API_BASE""The API base URL as the browser sees it; use "" for same-origin
NEXT_PUBLIC_DOCS_BASE_URL—Where the Read more in the docs links in help bubbles point, such as /docs or https://docs.example.com. Set it for every image you build; otherwise the links do not reach the docs.
NEXT_PUBLIC_MARKETING_URLunsetYour marketing site URL; see above

All four arguments are inlined at build time.


Domain-based deployment (docker-compose.prod.yaml)

Section titled “Domain-based deployment (docker-compose.prod.yaml)”

OpenTremor-deployments/docker-compose.prod.yaml and haproxy/prod.cfg use a different topology: each app has its own subdomain (app.opentremor.dev for the dashboard and api.opentremor.dev for the API). NEXT_PUBLIC_API_BASE is built as the API’s absolute URL rather than a relative path. The main domain, opentremor.dev, routes to an operator’s marketing site when a website container is running on the same Compose network, and to the dashboard otherwise.

Because the dashboard and API use different origins, configure three settings:

  • Base URLs: server.public_base_url and server.dashboard_base_url must have different values. In the dashboard: Admin → Settings → General. Then use PATCH /v1/admin/settings to set both values. public_base_url is the API’s origin (https://api.opentremor.dev). Links built from it resolve to API routes, including the GitHub App manifest’s webhook and redirect URLs and public report links (/reports/{token}). dashboard_base_url is the dashboard’s origin (https://app.opentremor.dev). It is used for dashboard links, including invite join links and the GitHub App flow’s post-success redirect. If public_base_url points to the dashboard, the GitHub App callback reaches a Next.js 404 page instead of the API, so the code is not exchanged and the App’s private key and webhook secret are not stored. See GitHub App Integration.
  • CORS: opentremor-core-prod.yaml’s cors.allow_origins must list the dashboard’s origin. Credentialed requests cannot use *. Set this in the deployment configuration.
  • Session cookie domain: server.cookie_domain must be a suffix shared by both hosts, such as .opentremor.dev. Without it, the cookie set by POST /v1/auth/session is host-only on api.opentremor.dev. The browser stores the cookie, but the dashboard’s server-side requests on the other host do not receive it, so each page load appears logged out. Set SERVER_COOKIE_DOMAIN on the opentremor-core service; Compose seeds it into platform settings on first boot. To change it later, use Admin → Settings → General in the dashboard or call PATCH /v1/admin/settings. The settings value takes precedence over the environment variable. See the setup comment at the top of OpenTremor-core/configs/opentremor-core-prod.yaml.