Skip to content

Repository layout

Kelpie deploys what is in git. One repository holds any number of stacks, one folder each, under a stacks folder (stacks by default, set per repository):

.sops.yaml # age public keys for secrets.env files
stacks/
traefik/
compose.yaml
.env # optional, plain variables
secrets.env # optional, SOPS-encrypted variables
kelpie.yaml # optional, per-stack settings
monitoring/
compose.yaml

The folder name is the stack name. It must be lowercase letters, digits, - or _, start with a letter or digit, and be at most 63 characters. Stack names are unique across all repositories. Folders that break either rule are skipped, with a warning on the repository’s page.

The compose file is the first of compose.yaml, compose.yml, docker-compose.yaml, and docker-compose.yml that exists. Other files in the folder (configs, scripts) are available to the compose file through relative paths, as with docker stack deploy.

A new, empty repository works. On the first sync Kelpie pushes a commit with the stacks folder and, when KELPIE_AGE_KEY is set, a .sops.yaml that lists Kelpie’s public key. That needs write access, the same as editing stacks. A repository that has commits but not the configured branch is left alone and shows an error.

Removing a folder marks the stack as removed in Kelpie. Its services keep running until you remove the stack: an admin can do that from the stack page with Remove. It runs docker stack rm (or docker compose down) if anything is still running, then deletes the stack with its revisions and deployments. The audit log keeps a record.

On every new commit Kelpie fetches, finds the stack folders that changed, and creates a revision for each. It polls each repository (every 5 minutes by default, set per repository) and syncs right away when a webhook arrives.

Repositories authenticate with an SSH deploy key that Kelpie generates, or an HTTPS token. Pull requests, from edits or image updates, also need a forge token for GitHub, GitLab, or Gitea/Forgejo.

A forge token is only needed when edits or image updates open pull requests. Kelpie pushes the branch through git, with the deploy key or HTTPS token, and uses the forge token only to open the pull request and to check when the token expires.

  • GitHub: under Settings, Developer settings, Personal access tokens, create a fine-grained token for the repository with Pull requests: Read and write. A classic token needs the repo scope.
  • GitLab: create a personal access token, or a project access token with the Developer role, with the api scope.
  • Gitea and Forgejo: under Settings, Applications, generate a token with the write:repository scope.

With HTTPS authentication the forge token can be left empty, and the HTTPS token is used for both; it then needs the permissions of both. Kelpie checks the token daily and sends a notification before it expires.