Skip to content

Install a Self-Hosted Server

ConfigHub Enterprise is the ConfigHub server run in your own environment instead of on hub.confighub.com. It is installed with the cub server plugin, which deploys the server, its web UI and a database into Kubernetes from the same manifests whether the cluster is one the plugin creates on your machine or one you already run, much as a Helm chart installs an application, but with the generated keys and passwords kept for you between runs. This guide follows an instance from a first evaluation to people signing in and later upgrades. The Self-hosting page in the Enterprise section covers what is not about the plugin: the prerequisites you provide, the image, deploying from manifests you keep yourself, and exposing the OCI registry behind a load balancer.

You don't need a server of your own to try ConfigHub: sign up and follow the tutorial. Use of the server you install is conditioned on the Evaluation License unless you have a commercial agreement with ConfigHub.

Install the plugin once:

cub plugin install confighub/cub-server

Choosing where it runs

  • On a Mac, as plain processes, with cub server local up. For a first look on a Mac with Apple silicon, with no Docker, no cluster and no identity provider. See A first look on a Mac.
  • In a local Kubernetes cluster, with cub server install. The plugin creates the cluster with kind, which needs Docker running and kubectl on your PATH.
  • In a cluster you already have, with cub server install --kube-context <context>. This is how ConfigHub runs in earnest. An evaluation and a real deployment render the same manifests and differ only in where they run.

A first look on a Mac

cub server local up        # download what is missing, start the instance, sign in
cub server local open      # open the web UI, signed in
cub server local status    # what is running, on which ports, at which version
cub server local down      # stop it; the data stays

The first up downloads the newest release of the server and the web UI, and PostgreSQL, about 125 MB in all. It ends with cub signed in as the instance's administrator, in a new cub context that becomes the current one. Nothing restarts the instance after a reboot; run up again. cub server local up --upgrade moves it to the newest release, and cub server local down --purge deletes the instance, its data, its administrator key and its cub context.

Installing into Kubernetes

cub server install -i

-i asks for what the flags leave open. Without --kube-context, the install creates a kind cluster. It deploys the server, the web UI and a bundled PostgreSQL into the namespace confighub, waits for the instance to answer, and signs cub in as the administrator, with a key it generates and keeps in ~/.confighub/keys. Then use the CLI, or open the UI in a browser signed in as the same administrator:

cub space list
cub auth browser-session

The API, the UI and the OCI registry that GitOps operators pull Releases from are published on host ports the install chooses, by default localhost:32180 for the API and localhost:32183 for the UI. The install signs in with the first cub on your PATH and checks its version first; if it is too old, the install still completes and ends with the cub upgrade and sign-in commands to run.

To install into a cluster you already have, name its kubeconfig context. The flags below are the ones such a cluster most often needs:

cub server install --kube-context my-cluster \
  --database=external --database-url "postgres://..." \
  --storage-class gp3 \
  --oci-url https://confighub-oci.example.com
  • --database=external --database-url uses a PostgreSQL you run, such as Amazon RDS, instead of the bundled one. For anything beyond an evaluation you want to own the data, the backups and encryption at rest.
  • --storage-class and --storage-size choose the volume of the bundled database, for a cluster with no default StorageClass. The install checks for one before it creates anything, and lists the classes the cluster has when there is none.
  • --oci-url is the address clients reach the OCI registry at, behind a load balancer or on a name of its own. See Exposing the OCI registry.
  • --namespace-label and --namespace-annotation put the labels an admission policy requires on the namespace the install creates. Where namespaces are made by another process, create it first and pass --create-namespace=false.
  • --enable-metrics annotates the server's pod for a Prometheus that discovers pods by annotation. See Monitoring with Metrics.
  • --registry pulls the server and UI images from a mirror, given as its prefix, or from gcr.io with --registry gcr.

--dry-run renders the manifests and creates nothing, which is how to review them first, or how to start from them if you deploy with your own tooling; see Deploying from your own manifests.

Re-running is safe. The install writes its manifests to ~/.confighub/servers/<name> (or --out-dir), with the manifests in config/ and the generated Secrets in secrets/, and a re-run reads back every generated value, such as the token signing key and the database password, and reuses it. A re-run resumes an interrupted install and applies flags you change, and keeps the version the instance is on. The install takes the newest released server unless --image names one.

Secrets from your secret store

By default the install applies the server's Secret itself. Where credentials have to stay in a secret store, such as AWS Secrets Manager or Vault, and reach the cluster through External Secrets or the Secrets Store CSI driver, name the Secret those keep in sync instead:

cub server install --kube-context my-cluster --existing-secret confighub-from-vault

The server and the bundled database then read that Secret, and the install never applies one. It still generates the values, and writes them to secrets/confighub-secret-values.json for you to put in your store. Before it deploys anything, it checks that the Secret exists and names any keys it is missing.

Adding people

An install has one administrator, who signs in with a key. For other people to sign in as themselves, ConfigHub uses Keycloak as a broker in front of your identity provider. On an instance the plugin installed, one command deploys Keycloak next to it and reconfigures the server and UI to use it:

cub server keycloak install

That Keycloak runs in development mode with an embedded database, which is right for an evaluation. Connect your identity provider, over OpenID Connect or SAML, with cub server keycloak idp -i, and map your provider's groups to org roles. Single sign-on describes both, and how to use a Keycloak you run instead, for an instance serving real users.

Keycloak is added alongside the administrator, who keeps signing in with the key, in the organization Local the install created. People who sign in through Keycloak start in another organization and don't see the Spaces the administrator made. cub server keycloak import-local, run signed in through Keycloak as an admin of that organization, copies them, with their Units and Links, and --dry-run shows what it would copy.

The administrator key doesn't reach the Keycloak organization, so keep a way in that works when Keycloak or your provider doesn't. Signed in through Keycloak as an admin, create a service account with the admin org role and keep its key in your secret manager. A service account signs in with its key, without Keycloak:

cub serviceaccount create breakglass --org-role admin
cub serviceaccount key add breakglass --generate ./breakglass.jwk

cub auth login --private-key ./breakglass.jwk --server https://confighub-api.example.com

Upgrading

cub server upgrade                            # plan the newest release; changes nothing
cub server upgrade --version v0.11.27 --apply # upgrade the running instance

upgrade reads the instance from the cluster (--kube-context, --namespace), so it works however the instance was deployed. It moves the server, the init container that migrates its database, and the UI to the new version, and keeps each image's registry, so copy the new version into a mirror first. The plan checks that the images are in the registry, lists settings the new version no longer reads, and prints a pg_dump command for the bundled database: the new version migrates the database when it starts, and the old one can't run on it afterwards, so a backup is the way back. When the upgrade crosses a minor version, the plan lists what has to move with the server: cub, the bot on each attached cluster, and your own API clients.

It writes one patch per Deployment. --apply patches the running Deployments itself, waits for each rollout, and then checks the instance. Either way, merge the patches into the manifests you apply, or their next apply undoes the upgrade.

Checking an instance

cub server check                                         # the server of cub's current context
cub server check --url https://confighub-api.example.com

check asks the server where its UI, OCI registry and identity provider are, and tries to reach each from your machine. It also catches a load balancer that passes plain HTTP to the server where clients use HTTPS, which makes the server refuse every key login, including the bots'. It reads nothing from the cluster and changes nothing. Run it after changing how the instance is exposed, since cub cluster attach gives Argo CD and Flux the registry address the server advertises.

Uninstalling

cub server uninstall                 # delete the instance and its generated files
cub server uninstall --keep-config   # keep the files, so a reinstall is the same instance

For an instance in a kind cluster this deletes the cluster, database included. In a cluster you already have, it deletes the namespace, or with --create-namespace=false what it applied there, and leaves the cluster. The administrator's key stays in ~/.confighub/keys.