Skip to content

Getting started with Fundament development

  • Mise: installs the pinned just, k3d, kubectl, helm, skaffold, mkcert, go and bun from mise.toml
  • Docker or Podman with at least 16 GiB of memory; 24 GiB recommended when you also run the plugin sandbox
  • certutil (NSS tools), which mkcert needs to install the local CA:
OS Install
macOS brew install nss
Debian/Ubuntu apt install libnss3-tools
Fedora/RHEL dnf install nss-tools
Arch pacman -S nss

The default shared memory limits are too low for PostgreSQL. For embedded-postgres, create/edit /etc/sysctl.conf:

kern.sysv.shmall=65536
kern.sysv.shmmax=16777216

Put deploy/podman/bin/docker on your PATH as docker, e.g. ln -s "$PWD/deploy/podman/bin/docker" ~/bin/docker. The recipes, Skaffold and functl then run Podman through it, and the recipes detect Podman from docker --version. A plain symlink to podman is not enough: the stand-in drops Docker’s --provenance and --sbom build flags, which Podman rejects, and prints the digest after a push, which the recipes read. Set PODMAN to use another Podman binary.

Podman also needs:

  • A rootful machine: k3s needs the cpuset cgroup controller, which rootless containers do not get. podman machine stop && podman machine set --rootful && podman machine start
  • The machine’s memory raised from its 2–8 GiB default to the amount above: podman machine set --memory 24576 while it is stopped
  • The Docker API socket at /var/run/docker.sock, which k3d and Skaffold use; on macOS, sudo podman-mac-helper install points it at the machine
  • just podman-machine-setup once per machine, which cluster-create also runs: it lists the local registries, which serve plain HTTP, as insecure, and lifts Podman’s 2048-process cap per container, which a k3s node running every Fundament pod exceeds. When it changes anything it stops with an error: restart the machine and run the recipe again. It configures the machine behind the default connection; Podman directly on a Linux host is not supported.

Use PowerShell 7 (winget install Microsoft.PowerShell); mise activate depends on a hook it does not have on Windows PowerShell 5.1, where it silently fails to populate PATH. Check your powershell version with $PSVersionTable.PSVersion. If the profile refuses to load, run Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned.

Add to $PROFILE:

Terminal window
$env:PATH = "C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;$env:PATH"
mise activate pwsh | Out-String | Invoke-Expression

Those PATH entries supply the bash and cygpath that just recipes need; the postinstall hook just e2e::install fails until they are present, so rerun it afterwards.

Use Edge or Chrome for the console: mkcert cannot install its CA into Firefox on Windows (no NSS certutil), so calls to authn.fundament.localhost fail.

Terminal window
mise trust
mise install

Run mise install without arguments; naming a tool, as in mise install go, rewrites that tool’s pinned version in mise.toml to latest.

Terminal window
just cluster-start
just dev-hotreload
  • cluster-start creates the k3d-fundament cluster on first run, installs the local CA and the Envoy Gateway that serves every *.fundament.localhost host on port 8443, and adds its context k3d-fundament to .dev/kubeconfig in the checkout. The just recipes use that file; ~/.kube/config is left alone.
  • In the checkout, mise puts .dev/kubeconfig ahead of your own kubeconfig, so kubectl, helm and k9s use the local clusters; your other contexts stay reachable with --context, and a context switch is written to .dev/kubeconfig only. Outside the checkout, put it ahead of your own: export KUBECONFIG=<checkout>/.dev/kubeconfig:$HOME/.kube/config, or in PowerShell $env:KUBECONFIG = "<checkout>\.dev\kubeconfig;$HOME\.kube\config".
  • dev-hotreload builds and deploys every service, then stays attached.
    • Edits to existing files are synced into the running containers.
    • Adding, moving or deleting a file rebuilds the image and redeploys.
  • Every deploy resets the databases to the test data.
  • Ctrl-C stops watching; the deployment keeps running.
  • Short on memory? List deployments that should run their production image instead of hot-reloading: on macOS/Linux, FUNDAMENT_DEV_DISABLED_HOTRELOAD=marketplace-registry-frontend,marketplace-admin-frontend just dev-hotreload; in PowerShell, $env:FUNDAMENT_DEV_DISABLED_HOTRELOAD = "marketplace-registry-frontend,marketplace-admin-frontend"; just dev-hotreload. This saves about 2GB. Their code is then not hot-reloaded, and every edit to it rebuilds the image.
  • It runs in mock mode: clusters exist only in the database. For real clusters, see Test environment.

The cluster runs on the docker network k3d-fundament, subnet 172.19.0.0/16. If another network on your machine uses that range, creating it fails; set FUNDAMENT_K3D_SUBNET to a free subnet, e.g. export FUNDAMENT_K3D_SUBNET=172.29.0.0/16 in your shell profile or $env:FUNDAMENT_K3D_SUBNET = "172.29.0.0/16" in $PROFILE, and run just cluster-start again. It is read whenever the network is created, also after just cluster-delete; an existing network keeps the subnet it has.

A cluster created while its ports were published on every network address keeps them there: cluster-start detects it and stops; recreate it with just cluster-delete && just cluster-create, and the sandbox with just plugins cluster-delete && just plugins cluster-create && just plugins deploy. After recreating either, run just plugin-sandbox-kubeconfig and just plugins sandbox-catalog to connect them again.

A cluster created before the local edge moved to Envoy Gateway cannot run the chart. cluster-start detects it and stops; recreate it with just cluster-delete && just cluster-create.

To check the production images (the Dockerfiles CI builds), run just dev once and stop it with Ctrl-C: it rebuilds and redeploys on every file change.

https://console.fundament.localhost:8443

User Password Organization
alice@acme-corp.com password acme-corp, with cluster acme-cluster
platform-admin@fundament.io password system, which owns the first-party plugins

The test data also has an API key for Alice in acme-corp, so you don’t have to create one in the console. functl can store it:

Terminal window
functl auth login fun_LocalDevAliceAcmeCorpKey0000004KyU0e

auth login stores the key in functl’s credentials file (~/.config/fundament/credentials by default; see the config directory order), replacing a key you stored for another installation. The OpenTofu provider and scripts don’t read that file: give them the key in the FUNDAMENT_API_KEY environment variable, export FUNDAMENT_API_KEY=fun_LocalDevAliceAcmeCorpKey0000004KyU0e or in PowerShell $env:FUNDAMENT_API_KEY = "fun_LocalDevAliceAcmeCorpKey0000004KyU0e". Setting that variable for a functl command also works, and leaves the stored key alone.

If a host does not answer, check that the gateway is PROGRAMMED and every route is Accepted:

Terminal window
kubectl --context k3d-fundament -n gateway get gateway,certificate
kubectl --context k3d-fundament -n fundament get httproute

See console-frontend/README.md for the frontend commands.

The collection in bruno/ calls the stack on https://…:8443. Bruno does not read the system trust store, so point it at the mkcert CA that cluster-start installed (mkcert -CAROOT prints its folder):

  • In the app: Preferences → General → Use custom CA certificate, select rootCA.pem and keep Keep default CA certificates on.
  • With the CLI: bru run --env local --cacert "$(mkcert -CAROOT)/rootCA.pem".

Under just dev-hotreload, https://docs.fundament.localhost:8443 shows edits to existing pages in docs/ within seconds. Without the cluster:

Terminal window
just docs-dev # dev server on http://localhost:4321
just docs-build # production build, fails on broken links
Terminal window
just cluster-delete