Guide · 5 min

Archestack on Kubernetes, the short way

The shortest way onto a cluster you already run: Archestack under a path of a hostname its ingress already serves, such as https://apps.example.com/archestack/. Five manifest files and one pipeline, no Helm, and PostgreSQL runs in the cluster too.

Want hostnames of its own, a managed database and several API replicas? Hosting on AKS is the full version.

What runs

https://apps.example.com
  /archestack/api, /archestack/hubs  ->  archestack-api       1 pod, with disks for files and backups
  /archestack/...                    ->  archestack-web       2 pods: the builder and the published app
  /archestack-grafana/               ->  archestack-grafana   optional, with Prometheus, Tempo and Loki

archestack-api  ->  archestack-postgres   PostgreSQL 16 on a disk of its own

The builder is at /archestack/, the published app at /archestack/app/, and the API on the same address, so there is no second hostname to set up.

What you need

  • A cluster with ingress-nginx and a hostname it already serves over HTTPS.
  • A namespace archestack and a storage class that hands out disks, as AKS's default one does.
  • Azure DevOps, GitHub or GitLab. A private cluster needs a runner inside its network, since hosted runners reach it from the internet.

Set it up

  1. Unzip the kit into your repository as archestack/.
  2. Make an environment archestack-dev in your CI system holding these five, the last three as secrets:
    HOST                apps.example.com
    ADMIN_EMAIL         you@example.com
    POSTGRES_PASSWORD   secret, set once and never changed
    ADMIN_PASSWORD      secret, the first admin's password
    GRAFANA_PASSWORD    secret, Grafana's user admin
  3. Connect the pipeline, as your CI system's part below says.
  4. Run it. The first start takes a few minutes while the API creates its databases. Then sign in at https://<HOST>/archestack/ with the admin email and password.
Your CI system

Azure DevOps

  • Add archestack/azure-pipelines.yml as a pipeline.
  • Under Pipelines, Environments, make archestack-dev with the cluster's archestack namespace as a Kubernetes resource.
  • Under Pipelines, Library, make a variable group of the same name holding the five.

GitHub Actions

  • Move archestack/github-actions.yml to .github/workflows/archestack.yml.
  • Under Settings, Environments, make archestack-dev: HOST and ADMIN_EMAIL as variables, the passwords as secrets, plus the secret KUBECONFIG (see below).

GitLab CI

  • Include the kit's file from your .gitlab-ci.yml:
    include:
      - local: archestack/gitlab-ci.yml
  • Under Settings, CI/CD, Variables, add the five scoped to archestack-dev, the passwords masked and all of them protected, plus KUBECONFIG of type File (see below).

Signing in to the cluster

Run bash archestack/kubeconfig.sh once, as someone who may create roles in the namespace, and store what it prints as KUBECONFIG. It is a service account that can reach the archestack namespace and nothing else. Never use your own kubeconfig: it carries your rights on the whole cluster.

The files

archestack/
  azure-pipelines.yml     Azure DevOps: fills in the manifests, makes the secret, deploys
  github-actions.yml      GitHub Actions: move it to .github/workflows/archestack.yml
  gitlab-ci.yml           GitLab CI: include it from the repository's .gitlab-ci.yml
  deploy.sh               what GitHub Actions and GitLab CI run: the same three steps
  images.sh               pins both images to the digest of the tag you deploy
  kubeconfig.sh           their sign-in, allowed into the archestack namespace only
  manifests/
    postgres.yml          PostgreSQL 16 with a 32 GB disk
    api.yml               the API, with disks for files (20 GB) and backups (50 GB)
    web.yml               the builder and the published app
    ingress.yml           /archestack on the hostname the cluster already serves
    observability.yml     optional: Grafana with Prometheus, Tempo and Loki

ingress.yml is the one file that may need changing for your cluster. Keep it without a rewrite (Archestack expects the /archestack prefix) and without a sign-in proxy in front: Archestack signs people in itself.

Updating

Run the pipeline again. latest takes the newest release, a version such as 1.4.37 says exactly what runs, which is how you take one version from test to production. Either way the pipeline pins both images to their digest, so every pod runs exactly the image that was released. The API is down for the minute it takes to restart; your data stays on its disks. Every version and its digests are on Releases.

Good to know

  • The database password is set once. PostgreSQL keeps the one it first started with, so changing it in the CI system afterwards locks the API out.
  • The admin password only creates the first admin. Change it in Archestack afterwards.
  • Backups stay in the cluster. Copy them somewhere else as well.
  • Going back to an older version can fail once a newer one has migrated the database. Try an update on a test environment first.

Where this goes next

Deploying from the repository takes your applications from git to these environments.