Files
2026-03-22 18:53:14 +01:00

56 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
> Based on the work of [umair](https://github.com/l-nmch/registry/tree/main/registry/umair)
# Incus VM Template for Coder
Provision Linux VMs & Containers on Incus/LXD as [Coder workspaces](https://coder.phorge.fr). The template deploys an instance with cloud-init, and runs the Coder agent under the workspace owner's Linux user.
## Prerequisites
- Incus server / cluster with exposed API
### Setup the template
1. Create an Incus trust token:
```bash
incus config trust add coder # Save the token
```
2. Setup an Incus project with a network:
```bash
incus project create Coder -c features.network=true
incus network create Main --project Coder
```
3. Prepare `terraform.tfvars` in your environment:
```py
remote_name = "iaas"
remote_address = "https://iaas.phorge.fr:443"
remote_token = "<token>"
remote_coder_project = "Coder"
remote_coder_network = "Main"
remote_coder_storage_pool = "local"
remote_coder_profiles = ["1vCPU-2GiB-disk20GiB", "2vCPU-4GiB-disk20GiB", "4vCPU-8GiB-disk60GiB"]
remote_coder_images = ["images:ubuntu/24.04/cloud", "images:debian/13/cloud", "images:alpine/3.23/cloud"]
```
## Use
```bash
coder template push iaas-instance -d .
```
## Warnings
Incus often works with cloud image, please use `cloud` tagged images such as `images:ubuntu/22.04/cloud` to be able to use cloud-init (Using non cloud tagged images will lead into your workspaces not working as the coder agent installs through cloud-init)
## References
- Incus: [source](https://linuxcontainers.org/incus/)
- Incus Terraform Provider: [source](https://registry.terraform.io/providers/lxc/incus/latest/docs)
- Coder Best practices & templates:
- https://coder.com/docs/tutorials/best-practices/speed-up-templates
- https://coder.com/docs/tutorials/template-from-scratch