lunar-mcpx-webapp

by Lunar

Helm chartv0.10.12App 0.10.12

A Helm chart to deploy Lunar MCPX to Kubernetes

About this chart

Lunar MCPX Webapps Helm Chart

Intro

This Helm chart will install Lunar MCPX Webapps on your Kubernetes cluster.

Prerequisites

Image pull secrets

To be able to pull images from Lunar Private Registry please make sure that pull secrets has been configured. Contact Lunar sales representative in order to receive credentials. Credentials can be installed with following command:

kubectl create ns {{ mcpx_namespace }}
kubectl apply -f lunar-private-mcpx-registry.yaml -n {{ mcpx_namespace }}

Required external services

Lunar MCPX Webapps requires external Postresql and Redis servers in order to work. It is possible to deploy this chart with embedded services by setting up following variables:

postgres.enabled=true
redis.enabled=true 

[!WARNING]
Embedded services included in this is chart are for demo/POC purposes only. Please do NOT use them in production.

Required service versions:

ServiceVersion
Postgresql>= 17.0
Redis>= 8.0

Required global environment variables with sensitive data

VariableValue
SESSION_SECRETrandom string, can be generated on Unix system by running 'openssl rand -base64 32'
SESSION_COOKIE_DOMAINexample.com
DATABASE_URLpostgres://{{ USER }}:{{ PASS }}@{{ HOST }}:{{ PORT }}/{{ DATABASE }}?schema={{ SCHEMA }}
REDIS_URLredis://{{ HOST }}:{{ PORT }}
REDIS_IS_CLUSTERboolean (true|false)

Required encryption configuration

VariableValue
ENCRYPTION_KEYbase64-encoded 32-byte AES-256-GCM key, generate with openssl rand -base64 32

Used by hub, webserver, and any service that reads or clones setups. Set via global.encryptionKey — the value is injected into all services through the shared embedded secret.

Required OIDC environment variables with sensitive data

VariableValue
OIDC_CLIENT_ID
OIDC_CLIENT_SECRET
OIDC_ISSUER
OIDC_REDIRECT_URI
OIDC_JWKS_URI
OIDC_AUDIENCE
OIDC_ISSUER_URL

Note: Router OIDC_JWKS_URI defaults to in-cluster auth service (http://<release>-auth/.well-known/jwks.json) and can be overridden with router.oidcJwksUri.

Optional environmental variables

VariableValue
LOG_LEVELinfo
CROSS_TENANT_DATABASE_URLpostgres://{{ USER }}:{{ PASS }}@{{ HOST }}:{{ PORT }}/{{ DATABASE }}?schema={{ SCHEMA }}

CROSS_TENANT_DATABASE_URL is for cross-tenant work (tenant lookup, sweeps), as a role row-level security doesn't filter, such as the tables' owner. Unset, it uses DATABASE_URL. Set it only when DATABASE_URL is a role that doesn't own the tables, and only for webserver, hub and auth: migrations and jobs keep a DATABASE_URL that owns the tables.

It is possible to supply this variables using several different techniques:

  • Using pre-created secret and extraEnvFromSecrets (recommended):

    • Create secret with global variables:

      kubectl create secret generic mcpx-webapp-global -n {{ mcpx_namespace }} \
        --from-literal=SESSION_SECRET="$(openssl rand -base64 32)" \
        --from-literal=DATABASE_URL="postgres://{{ USER }}:{{ PASS }}@{{ HOST }}:{{ PORT }}/{{ DATABASE }}?schema={{ SCHEMA }}" \
        --from-literal=REDIS_URL="redis://{{ HOST }}:{{ PORT }}" \
        --from-literal=REDIS_IS_CLUSTER="{{ boolean (true or false) }}"
      
    • Create secret with OIDC variables:

      kubectl create secret generic mcpx-webapp-oidc -n {{ mcpx_namespace }} \
          --from-literal=OIDC_CLIENT_ID="" \
          --from-literal=OIDC_CLIENT_SECRET="" \
          --from-literal=OIDC_ISSUER="" \
          --from-literal=OIDC_REDIRECT_URI="" \
          --from-literal=OIDC_JWKS_URI="" \
          --from-literal=OIDC_AUDIENCE="" \
          --from-file=credentials.json="/path/to/service-account.json"
      
    • Specify pre-created secrets using extraEnvFromSecrets parameter:

      ---
      global:
        extraEnvFromSecrets:
          - mcpx-webapp-global
      
      hub:
        extraEnvFromSecrets:
          - mcpx-webapp-oidc
      
      auth:
        extraEnvFromSecrets:
          - mcpx-webapp-oidc
        googleApplicationCredentials:
          secretName: my-google-adc   # any secret name that holds the SA key JSON
      
      identityBroker:
        googleApplicationCredentials:
          secretName: my-google-adc   # same or a different secret — name is yours
      
    • auth.googleApplicationCredentials and identityBroker.googleApplicationCredentials are optional.

      • Set secretName to any existing Kubernetes secret that holds a service account key JSON (the name is yours — examples use placeholders only).
      • The chart mounts that secret and sets GOOGLE_APPLICATION_CREDENTIALS=/var/secrets/google/credentials.json.
      • Override secretKey if your secret stores the JSON under a different key name.
      • Leave it unset to rely on ambient ADC / Workload Identity instead.
  • Using values-override.yaml file with plain-text value:

---
global:
  extraEnvVars:
    - name: DATABASE_URL
      value: "postgres://{{ USER }}:{{ PASS }}@{{ HOST }}:{{ PORT }}/{{ DATABASE }}?schema={{ SCHEMA }}"
    - name: REDIS_URL
      value: "redis://{{ HOST }}:{{ PORT }}"
    - name: REDIS_IS_CLUSTER
      value: "true|false"
  • Using values-override.yaml file with extraEnvVars and extraEnvVars:
---
global:
  extraEnvVars:
    - name: DATABASE_URL
      valueFrom:
      `secretKeyRef`:
        name: SECRET_NAME
        key: KEY1
    - name: REDIS_URL
      valueFrom:
      secretKeyRef:
        name: SECRET_NAME
        key: KEY2
    - name: REDIS_IS_CLUSTER
      valueFrom:
      secretKeyRef:
        name: SECRET_NAME
        key: KEY3

Ingress configuration

Ingress configuration is heavily depends on the Kubernetes cluster configuration, cloud platform, network configuration, etc. Please reffer to examples/values-override directory to find example applicable for your environment

Custom response headers

ingress.responseHeaders accepts a list of "Name: Value" strings that are added as HTTP response headers for traffic served through the ingress, e.g.:

ingress:
  responseHeaders:
    - "X-Frame-Options: DENY"
    - "Strict-Transport-Security: max-age=63072000"

Support depends on ingress.type:

  • gce - rendered into each service's BackendConfig.spec.customResponseHeaders.headers
  • nginx - rendered into a nginx.ingress.kubernetes.io/configuration-snippet annotation using more_set_headers. This requires the ingress-nginx controller to have snippet annotations enabled (allow-snippet-annotations/annotations-risk-level on the controller ConfigMap) - otherwise the annotation is silently ignored by the controller.
  • agic, undef - not currently supported; set the equivalent annotation manually via ingress.annotations

Private Certificate Authorities

For the cases when there is a requirement of using certificates issued by private CA, it is required to make this CA 'trusted' to application by adding it as a Kubernetes secrets and configuring in global.caCerts section.

To add CA cert as a secret one can use following command:

kubectl create secret generic {{ name_of_cert }} -n {{ mcpx_namespace }} --from-file=ca.crt={{ path/to/file }}

Note: In case when multiple CA certificates should be added, concat all of them in the same file and import as a single kubernetes secret

GCP

  • Minimal non-production configuration with GCE ingress controller
  • Production-like configuration with external secrets and external databases

Service Account

The chart always creates a single ServiceAccount without any permissions, named after the chart fullname, and all app deployments and cronjobs run on it. This is deliberate: pods never fall back to the namespace default ServiceAccount. There is nothing to enable or configure.

The hive-controller is the one exception; it keeps its own RBAC-bound ServiceAccount (<fullname>-controller) since it manages Kubernetes resources.

If you ever need to attach cloud IAM to the shared ServiceAccount (e.g. an EKS IRSA role), its annotations are settable from values:

global:
  serviceAccount:
    annotations:
      eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/my-role

Pod Disruption Budgets

Each app deployment (webserver, hub, admin, auth, router, ui, controller) can get a PodDisruptionBudget to keep it available during node drains and cluster upgrades. Set the default under global.pdb, and override per service with the same fields (enabled, maxUnavailable, minAvailable); service-level settings win:

global:
  pdb:
    enabled: true
    maxUnavailable: 1   # or set minAvailable (number or percentage) instead

webserver:
  replicaCount: 3
hub:
  replicaCount: 3
# ...

admin:
  pdb:
    enabled: false      # opt a single-replica service out

Off by default. Rendering fails if a PDB is enabled for a service with replicaCount < 2: a PDB over a single replica blocks node drains entirely. If you already manage your own PDBs for these pods outside the chart, remove them before enabling this, since pods covered by two PDBs cannot be evicted at all.

Horizontal Pod Autoscalers

Each app deployment (webserver, hub, admin, auth, router, ui, controller) can get a HorizontalPodAutoscaler scaling on CPU/memory utilization. Set the default under global.hpa, override per service with the same fields; service-level wins:

global:
  hpa:
    enabled: false
    minReplicas: 2
    maxReplicas: 8
    targetCPUUtilizationPercentage: 70
    targetMemoryUtilizationPercentage: "" # set a number to also scale on memory
    scaleDownStabilizationSeconds: 300

router:
  hpa:
    enabled: true
    minReplicas: 3

Off by default. Once enabled for a service, its Deployment's replicas field is omitted so the HPA owns the live count (replicaCount still sets the initial count on first install). No memory metric by default; if you set a global memory target and want one service to opt back out, override it with "" on that service — deleting the per-service key instead falls back to the global value. Rendering fails if maxReplicas < minReplicas or if no metric is set. With a PDB also enabled, the HPA's minReplicas covers the "2+ replicas" floor check instead of replicaCount.

Rollout Strategy

Each app deployment (webserver, hub, admin, auth, router, ui, controller, identityBroker) takes a Kubernetes Deployment strategy, rendered as is. Set the default under global.strategy, and override per service; a service-level strategy replaces the global one as a whole:

global:
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0         # no extra pod during a rollout
      maxUnavailable: 1   # replace pods one at a time

router:                   # no DB pool, so it can keep full capacity during a rollout
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0

Unset by default, which keeps the Kubernetes default (maxSurge: 25%, maxUnavailable: 25%). At 2 replicas that starts a third pod during every rollout, and the HPA's maxReplicas does not cap it. hub, webserver and auth each hold their own DB pool (db.connectionLimit), so the extra pod adds a full pool's worth of Postgres connections; maxSurge: 0 keeps a rollout within the steady-state count. With a single replica, maxSurge: 0 means downtime while the pod is replaced.

Admin DB Migration Jobs

This chart includes four suspended CronJobs for DB migration management. They never run automatically — admins create one-off jobs from them using kubectl create job.

Warning: These jobs interact directly with the database. Use with caution and only when instructed!

CronJobPurpose
<release>-migrate-statusShows the current state of all migrations
<release>-migrate-rollback-dryDry-run rollback (no changes are made)
<release>-migrate-rollback-executeExecutes a rollback — this will modify the database
<release>-migrate-resolve-failedMarks a failed migration as resolved so Prisma can move past it

In the examples below, <release> is the full CronJob name prefix — composed of your Helm release name and the chart name (e.g. mcpx-webapp). Run kubectl get cronjobs -n <namespace> | grep migrate to find the exact names.

Check migration status:

kubectl create job migrate-status-$(date +%s) \
  --from=cronjob/<release>-migrate-status -n <namespace>

**Dry-run a rollback (safe, no DB ch

Deploy lunar-mcpx-webapp with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has lunar-mcpx-webapp on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlunar-mcpx-webapp is pinned at v0.10.12 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply