diff --git a/examples/hetzner-linux/README.md b/examples/hetzner-linux/README.md new file mode 100644 index 0000000000000..9ec74231df71b --- /dev/null +++ b/examples/hetzner-linux/README.md @@ -0,0 +1,5 @@ +--- +name: Develop in Linux on Hetzner Cloud +description: Get started with Linux development on Hetzner Cloud. +tags: [cloud, hetzner] +--- diff --git a/examples/hetzner-linux/cloud-config.yaml.tftpl b/examples/hetzner-linux/cloud-config.yaml.tftpl new file mode 100644 index 0000000000000..ea1fc553328c7 --- /dev/null +++ b/examples/hetzner-linux/cloud-config.yaml.tftpl @@ -0,0 +1,72 @@ +#cloud-config +users: + - name: ${username} + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + groups: sudo + shell: /bin/bash +packages: + - git + - curl + - jq +mounts: + - [ + "${volume_path}", + "/home/${username}", + ext4, + "discard,defaults", + ] +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 + 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: /tmp/install_code_server.sh + permissions: "0777" + content: | + #!/bin/bash + CODE_SERVER_DOWNLOAD_URL=$(curl -sL https://api.github.com/repos/coder/code-server/releases/latest | jq -r '.assets[].browser_download_url' | grep "amd64.deb") + curl -fL $CODE_SERVER_DOWNLOAD_URL -o /tmp/code_server.deb + dpkg -i /tmp/code_server.deb + systemctl enable --now code-server@${username} + rm /tmp/code_server.deb + - path: /tmp/install_code_server.sh + permissions: "0777" + content: | + - 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 ${username}:${username} /home/${username} + - systemctl enable coder-agent + - systemctl start coder-agent +%{ if code_server_setup ~} + - /tmp/install_code_server.sh + - rm /tmp/install_code_server.sh +%{ endif } diff --git a/examples/hetzner-linux/main.tf b/examples/hetzner-linux/main.tf new file mode 100644 index 0000000000000..b426427be8d19 --- /dev/null +++ b/examples/hetzner-linux/main.tf @@ -0,0 +1,151 @@ +terraform { + required_providers { + coder = { + source = "coder/coder" + version = "0.4.2" + } + hcloud = { + source = "hetznercloud/hcloud" + version = "1.33.2" + } + } +} + +provider "hcloud" { + token = var.hcloud_token +} + +provider "coder" { +} + +variable "hcloud_token" { + description = < pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy