mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Add 6 new base templates to the template builder, covering all major cloud providers and platforms: - **scratch**: Minimal starter template with only `coder_agent` and metadata - **aws-windows**: AWS EC2 Windows instances with PowerShell user_data - **azure-linux**: Azure VMs with cloud-init and managed disk persistence - **gcp-linux**: Google Compute Engine Linux instances with persistent disk - **gcp-windows**: Google Compute Engine Windows instances - **digitalocean-linux**: DigitalOcean Linux droplets with persistent volumes Each base includes `base.json`, `main.tf.tmpl`, `README.md` (with prerequisite markers), and any static files (cloud-init configs). Tests verify all 9 bases load, render without error, and produce valid single-agent declarations. `azure-windows` is deferred; it needs to be registered in the `examples` package first. Depends on #26633 > [!NOTE] > This PR was authored by Coder Agents on behalf of @jeremyruppel. --- NB: This is very much an agent-generated PR and draws completely from base templates that exist in `examples/templates/`. The base.json files are new, so review those, but don't spend any brain tokens on the correctness of the terraform and supporting files: any issues there are issues with the upstream example template
57 lines
1.3 KiB
Plaintext
57 lines
1.3 KiB
Plaintext
#cloud-config
|
|
cloud_final_modules:
|
|
- [scripts-user, always]
|
|
bootcmd:
|
|
# work around https://github.com/hashicorp/terraform-provider-azurerm/issues/6117
|
|
- until [ -e /dev/disk/azure/scsi1/lun10 ]; do sleep 1; done
|
|
device_aliases:
|
|
homedir: /dev/disk/azure/scsi1/lun10
|
|
disk_setup:
|
|
homedir:
|
|
table_type: gpt
|
|
layout: true
|
|
fs_setup:
|
|
- label: coder_home
|
|
filesystem: ext4
|
|
device: homedir.1
|
|
mounts:
|
|
- ["LABEL=coder_home", "/home/${username}"]
|
|
hostname: ${hostname}
|
|
users:
|
|
- name: ${username}
|
|
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
|
|
groups: sudo
|
|
shell: /bin/bash
|
|
packages:
|
|
- git
|
|
write_files:
|
|
- path: /opt/coder/init
|
|
permissions: "0755"
|
|
encoding: b64
|
|
content: ${init_script}
|
|
- path: /etc/systemd/system/coder-agent.service
|
|
permissions: "0644"
|
|
content: |
|
|
[Unit]
|
|
Description=Coder Agent
|
|
After=network-online.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
User=${username}
|
|
ExecStart=/opt/coder/init
|
|
Restart=always
|
|
RestartSec=10
|
|
TimeoutStopSec=90
|
|
KillMode=process
|
|
|
|
OOMScoreAdjust=-900
|
|
SyslogIdentifier=coder-agent
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
runcmd:
|
|
- chown ${username}:${username} /home/${username}
|
|
- systemctl enable coder-agent
|
|
- systemctl start coder-agent
|