coder-template/hetzner-cloud/cloud-config.yaml.tftpl
Peter Kurfer e1c9b6bb21
Some checks failed
continuous-integration/drone/push Build is failing
feat: push template from CI
2023-06-15 18:01:53 +02:00

94 lines
2.4 KiB
Text

#cloud-config
users:
- name: ${username}
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
groups: sudo
shell: /bin/bash
packages:
- zsh
- git
- git-delta
- difftastic
- curl
- jq
- htop
- exa
- ripgrep
- bat
- fzf
- dnf-plugins-core
%{ if install_podman_setup ~}
- podman
- podman-docker
- docker-compose
%{ endif ~}
%{ if install_go_setup ~}
- golang
%{ endif ~}
%{ if install_dotnet_setup ~}
- dotnet-sdk-6.0
- dotnet-sdk-7.0
%{ endif ~}
mounts:
- [
"${volume_path}",
"/home/${username}",
ext4,
"mode=0755,uid=1000,discard,rw,suid,exec,auto,async",
]
write_files:
- path: /opt/coder/init
permissions: "0755"
encoding: b64
content: ${init_script}
%{ if install_podman_setup ~}
- path: /etc/profile.d/podman.sh
permissions: "0644"
content: |
export DOCKER_HOST=unix:///run/user/$UID/podman/podman.sock
%{ endif ~}
- 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
Environment=CODER_AGENT_TOKEN=${coder_agent_token}
Restart=always
RestartSec=10
TimeoutStopSec=90
KillMode=process
OOMScoreAdjust=-900
SyslogIdentifier=coder-agent
[Install]
WantedBy=multi-user.target
%{ if code_server_setup ~}
- path: /home/${username}/.config/code-server/config.yaml
permissions: "0644"
content: |
bind-addr: 127.0.0.1:8080
auth: none
cert: false
%{ endif ~}
runcmd:
- chown -R ${username}:${username} /home/${username}
- systemctl enable coder-agent
- systemctl start coder-agent
%{ if install_dotnet_setup ~}
- loginctl enable-linger ${username}
- mkdir -p /home/${username}/.config/systemd/user/sockets.target.wants
- chown -R ${username}:${username} /home/${username}
- ln -sf /usr/lib/systemd/system/podman.socket /home/${username}/.config/systemd/user/sockets.target.wants/
- sudo -u ${username} DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" systemctl --user start podman
%{ endif ~}
%{ if code_server_setup ~}
- dnf install -y $(curl -sL https://api.github.com/repos/coder/code-server/releases/latest | jq -r '.assets[].browser_download_url' | grep "amd64.rpm")
- systemctl enable --now code-server@${username}
%{ endif }