Promote and deploy

Keep the settings file in a git repository, validate it on pull requests, and promote it from development to staging to production.

The installation settings feature only needs a branch and a JSON file. This page describes the setup Lunnoa recommends: one repository, one long-lived branch per environment, and automation that validates changes and tells each install to reload.

Merging into a branch is the deployment. Each install reads its own branch, so a change reaches production only after it has been merged through the earlier environments.

Repository layout

The recommended layout keeps one file per section and generates the file the install reads.

sections/
  workspaces.json       the value of the "workspaces" key
  roles.json            the value of the "roles" key
  ai.json               the value of the "ai" key (providers, connections)
  privacy.json          the value of the "privacy" key
  preview/              shapes for sections the server does not accept yet
settings/
  lunnoa.settings.json  generated file the install pulls
scripts/
  assemble.mjs          sections/*.json into settings/lunnoa.settings.json
  validate.mjs          JSON and environment-variable-name checks
.github/workflows/
  validate.yml          runs on pull requests
  deploy.yml            runs after a merge

Edit the files in sections/. Never edit settings/lunnoa.settings.json by hand.

Make a change

  1. Branch from development

    Create a short-lived branch from dev, or push to dev directly if your team allows it.

  2. Edit a section file

    Change the file in sections/. Check names and permissions against the file reference and permissions.

  3. Generate and check

    Run the two scripts, then commit the section file and the generated file together.

    bash
    node scripts/assemble.mjs
    node scripts/validate.mjs
  4. Open a pull request

    Merge into dev. Delete the short-lived branch after the merge.

  5. Promote

    Open a pull request from dev into staging, then from staging into prod.

Branches

Three long-lived branches, one per environment. dev is the default branch.

dev  to  staging  to  prod
BranchInstallHow it changes
devDevelopmentPull request from a short-lived branch, or a direct push
stagingStagingPull request from dev only
prodProductionPull request from staging only

A pull request into staging from anywhere except dev fails. A pull request into prod from anywhere except staging fails. Do not skip staging.

Point each install at its own branch:

bash
LUNNOA_SETTINGS_REPOSITORY=https://github.com/your-org/lunnoa-settings
LUNNOA_SETTINGS_BRANCH=staging
LUNNOA_SETTINGS_PATH=settings/lunnoa.settings.json

What the automation does

WorkflowWhenWhat it does
Validate settingsOn a pull request into dev, staging, or prodChecks the promotion order, regenerates the file and fails if it differs from the committed one, then runs the schema check
Deploy settingsAfter a push to dev, staging, or prodRepeats the checks, then asks that one install to reload

The deploy step calls POST /api/admin/installation-settings/reload on the install. It never sends the settings content. The install pulls the file from its branch itself.

Secrets on each GitHub environment

Create a GitHub environment for each branch (dev, staging, prod) and set:

SecretExample
LUNNOA_URLhttps://dev.your-deployment.example
LUNNOA_RELOAD_TOKENBearer token for a SuperAdmin

A workspace API key (lna_...) cannot reload. If either secret is missing, the deploy step skips the reload with a warning. The settings still apply the next time that install restarts.

Provider keys with env

If a provider uses { "source": "env", "name": "OPENAI_API_KEY" }, add a GitHub secret with that exact name to the same environment. The deploy step posts every such secret to the install's secrets endpoint first and then asks it to reload. It uses a machine user token for the push. To rotate a key, change the GitHub secret and run the deploy again. Providers that use serverEnv, vault, or manual need nothing here. See Secrets and API keys.

Before you promote

CheckWhy it matters
Every serverEnv variable is set on the target installA missing variable fails the whole reload
Every env secret exists in the GitHub environmentWithout a pushed value the reload fails
Every vault path exists on the target Vault, and the Lunnoa role can read itA wrong path only shows up when a model call needs the key
Every model id exists on the target installCatalogue seeding can differ between installs
No same-name rows were created in Admin Space on the targetA clash fails the reload
Privacy changes are called out in the pull requestfailMode and entity lists change what reaches the model

Related