Skip to content

Latest commit

 

History

83 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coder Templates

Coder workspace templates

Custom Coder workspace templates for DataKnife. Templates are written in Terraform and define the underlying infrastructure that Coder workspaces run on.

Overview

This repository contains reusable Coder templates for provisioning development workspaces. Use these as starting points or import them directly into your Coder deployment.

Templates

Template Description
kubernetes Kubernetes Deployments with code-server — base template for K8s workspaces
DKAI DevPod (dkai-dev) Cursor IDE on Kubernetes (Ubuntu) — 2/4 CPU, 4/8 GB RAM, 50–100 GB disk (no subdomain required)
DKAI Arch (dkai-arch) Same as DKAI DevPod on Arch Linux (archlinux image, pacman, gh/glab from repos)
DKAI Agent (dkai-agent) DKAI Arch plus Cloud Agent worker (start-cursor-worker), second PVC for tool configs (kubectl / rancher / gh / glab), individual API key
DKAI Hermes (dkai-hermes) Hermes Agent controller → remote Enodios vLLM (vllm.dataknife.net; Enodios does not run in the workspace)

References

Getting Started

Prerequisites

  • Coder deployment
  • Terraform familiarity
  • Access to your target infrastructure (Kubernetes, AWS, Docker, etc.)

Using Templates

  1. From Coder UI: Create a template → Import from registry or Git
  2. From CLI: coder templates create <name> --directory ./path/to/template
  3. From Terraform: Reference this repo as a module or copy the template files

Local Validation

Validate templates locally before pushing:

make test
Target Description
make test Init, validate, and format-check all templates
make fmt Format Terraform files
make clean Remove .terraform and lock files
make debug Run tests with verbose Terraform output (V=1)

Debug a live workspace (Coder CLI + optional kubectl): scripts/coder-workspace-debug.sh <workspace-name>.

Key Concepts

  • Templates = Terraform configs that provision workspace infrastructure
  • Parameters = User-configurable options (CPU, memory, disk, etc.)
  • Resources = The actual infrastructure (pods, VMs, volumes)

Template Structure

coder-templates/
├── README.md
├── Makefile           # Local validation (make test)
├── docs/
│   └── build-parameters.md
└── templates/
    ├── kubernetes/
    │   ├── main.tf
    │   └── README.md
    ├── dkai-dev/
    │   ├── main.tf
    │   └── README.md
    ├── dkai-arch/
    │   ├── main.tf
    │   └── README.md
    ├── dkai-agent/
    │   ├── main.tf
    │   └── README.md
    └── dkai-hermes/
        ├── main.tf
        └── README.md

Extending Templates

Common customizations:

  • Images — Use custom Docker images with preinstalled tools
  • Parameters — Add disk size, instance type, region options
  • IDEs — Add JetBrains, RDP, Cursor, or other IDE support
  • Persistence — Configure volume mounts and backup behavior

See Coder's extending templates guide for details.

CI/CD

GitHub Actions runs on every push and pull request:

  • Testterraform init, terraform validate, and terraform fmt -check for each template
  • Push to GitLab — After tests pass on main, syncs to a GitLab mirror (optional)

GitLab Mirror Setup (GitHub Actions)

To enable pushing to GitLab after tests pass, add this repository secret (same as freya):

Secret Description
GITLAB_TOKEN GitLab Personal Access Token or Project Access Token with write_repository scope

Mirror URL: https://gitlab.com/dk-raas/dkai/devops/coder-templates

GitLab CI (Push to Coder)

The GitLab pipeline tests templates and pushes updates to Coder when changes land on main. Configure these CI/CD variables (Settings > CI/CD > Variables):

Variable Type Description
CODER_URL Variable Coder instance URL (e.g. https://coder.dataknife.net)
CODER_SESSION_TOKEN Masked Long-lived token: coder token create --lifetime 8760h --name "GitLab CI"

Links

Releases

Packages

Contributors

Languages