Data Hub

Deploy Data Hub

What deploying Data Hub involves, what you need before you start, and where the step-by-step runbooks live.

ForEngineers

Data Hub is self-hosted, so nobody can sign in or install a watcher until your team has deployed it. This page explains what gets deployed, what access you need, and in what order. The commands are in the repository.

For the step-by-step deploy, open First-time deployment in the data-hub repository. That guide has every command, environment variable, and checklist. Read this page first for the overall order.

What you’ll deploy

You deploy three pieces:

PieceWhat it doesWhere it runs
PostgreSQL databaseStores instruments, runs, files, watchers, and tokensAny PostgreSQL host, managed or self-run
Web appServes the web pages, the REST API, and the MCP endpointVercel
Storage and processingS3 buckets for raw, processed, and archived files, plus the Lambda that processes uploadsAWS, deployed with AWS SAM

You’ll also create a Google OAuth client, which decides who can sign in to your deployment. Data Hub has no invitations and no email allowlist of its own, so that client’s setting is the whole access policy. Read Who can sign in before you create it.

Give staging and production separate databases and separate AWS stacks. They’re independent deployments holding independent data.

Access you need before you start

The deploy stops partway without any one of these, so confirm all four first:

  • Admin-level AWS credentials: the first deploy creates the stack, which the automated deploy role can’t do. That role can only update a stack that already exists
  • Vercel project access, including permission to set environment variables for the environment
  • Google Cloud Console access, to create the OAuth client
  • GitHub repository settings access, to store the secrets that let continuous integration run every later deploy

You’ll also need the AWS CLI and the AWS SAM CLI installed locally.

How the deploy is sequenced

The web app and the AWS stack each need something the other creates, so the order matters. First-time deployment has the commands for each step:

Create the database and keep its connection string. Make sure the host accepts connections from Vercel and from your continuous integration runners.

Deploy the web app, set its environment variables, apply the database migrations, then sign in and create the access token the Lambda will use.

Deploy the AWS bootstrap stack, once per AWS account, not once per environment. It creates the shared resources both environments use.

Deploy the AWS stack for this environment, using the web app’s URL and that token.

Copy the AWS stack’s outputs into the web app’s environment variables, then redeploy so it picks them up.

The web app deploys at step 2 but doesn’t fully work yet. Files, uploads, reprocessing, and run archives stay broken until step 5 connects it to AWS.

Common first-deploy mistakes

Each of these can break a first deploy:

  • Set ADMIN_EMAILS before you sign in for the first time. It makes the first admin. If you sign in before setting it, your account can’t create tokens or confirm instruments
  • Point BETTER_AUTH_URL at this deployment’s own public origin. Data Hub builds the Google callback URL from it, so a value copied from another environment sends people to that other host and sign-in fails. AI clients read the same value when they sign in over MCP, so a wrong one breaks them too
  • Google sign-in on Vercel preview deployments needs OAUTH_PROXY_URL and OAUTH_PROXY_SECRET. Google accepts only redirect URLs registered in advance, and every preview gets a new URL. Previews therefore send the sign-in through one fixed deployment whose URL is registered. Production registers its own URL and leaves both variables unset
  • Create the Lambda’s token from the Lambda preset. The Lambda reads an instrument’s type before choosing a processor, so without instruments:read every upload fails with a permission error. DishCam processing also reads the run’s file list, so it fails without runs:read. The Lambda preset includes both
  • Set ENABLE_S3_FILES to true or false for the AWS stack. An empty value fails the deploy. Use false unless you want the Lambda to read files of 1 GiB or more from a mounted copy of the raw bucket instead of downloading them, which needs a VPC and costs extra; the runbook covers turning it on later
  • The bootstrap stack fails if the AWS account already has a GitHub identity provider from another project. Reuse the existing one instead of creating a second
  • Set INTEGRATION_SECRETS_KEY before an admin saves Slack or Linear secrets. Data Hub encrypts those secrets with it, and saving fails without it. Generate one with openssl rand -hex 32
  • An admin sets up the Slack channel and Linear in the web app. They aren’t environment variables: an admin connects them under Settings → Integrations after the deploy, and feedback stays off until Linear is connected. The Slack app credentials for direct messages can be environment variables or saved there. See Set up integrations

What finished looks like

Operators can install watchers and instruments start uploading. Hand them Set up an instrument, and create their first tokens through Issue and revoke tokens. To turn on feedback reports and Slack messages, an admin then follows Set up integrations.

From then on, deploys are automatic. Merging to staging or production deploys the web app, applies database migrations, and deploys the Lambda for that environment, so you run the steps above once per environment.

The runbooks

The deploy commands live next to the code in the data-hub repository. Start with First-time deployment:

For how the components fit together and how data moves between them, see Architecture.

On this page