Skip to content

Commit 7732865

Browse files
m4rrypromatifali
andauthored
feat: add linode vm template (#367)
Co-authored-by: Atif Ali <[email protected]>
1 parent c4c4840 commit 7732865

File tree

5 files changed

+505
-0
lines changed

5 files changed

+505
-0
lines changed

.github/typos.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[default.extend-words]
22
muc = "muc" # For Munich location code
3+
tyo = "tyo" # For Tokyo location code
34
Hashi = "Hashi"
45
HashiCorp = "HashiCorp"
56
mavrickrishi = "mavrickrishi" # Username

.icons/akamai.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
display_name: Linode Instance (Linux)
3+
description: Provision Linode instances as Coder workspaces
4+
icon: ../../../../.icons/akamai.svg
5+
verified: false
6+
tags: [vm, linux, linode]
7+
---
8+
9+
# Remote Development on Linode Instances
10+
11+
Provision Linode instances as [Coder workspaces](https://coder.com/docs/workspaces) with this example template.
12+
13+
<!-- TODO: Add screenshot -->
14+
15+
## Prerequisites
16+
17+
To deploy workspaces as Linode instances, you'll need:
18+
19+
- Linode [personal access token (PAT)](https://www.linode.com/docs/products/tools/api/guides/manage-api-tokens/)
20+
21+
### Authentication
22+
23+
This template assumes that the Coder Provisioner is run in an environment that is authenticated with Linode.
24+
25+
Obtain a [Linode Personal Access Token](https://cloud.linode.com/profile/tokens) and set the `linode_token` variable when deploying the template.
26+
For other ways to authenticate [consult the Terraform provider's docs](https://registry.terraform.io/providers/linode/linode/latest/docs).
27+
28+
## Features
29+
30+
- **Multiple Instance Types**: From Nanode 1GB to 32GB configurations
31+
- **Comprehensive OS Support**: Ubuntu, Debian, CentOS, Fedora, AlmaLinux, Rocky Linux
32+
- **Global Regions**: 32 Linode regions across North America, Europe, Asia-Pacific, South America, and Australia
33+
- **Persistent Storage**: Configurable volumes (10GB-1TB) that persist `$HOME` across workspace restarts
34+
- **Development Tools**: Pre-configured with VS Code Server
35+
- **Monitoring**: Built-in CPU, memory, and disk usage monitoring
36+
37+
## Architecture
38+
39+
This template provisions the following resources:
40+
41+
- Linode instance (ephemeral, deleted on stop)
42+
- Linode volume (persistent, mounted to `/home/coder`)
43+
44+
This means, when the workspace restarts, any tools or files outside of the home directory are not persisted. To pre-bake tools into the workspace (e.g. `python3`), modify the VM image, or use a [startup script](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/script).
45+
46+
> [!NOTE]
47+
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#cloud-config
2+
hostname: ${hostname}
3+
users:
4+
- name: ${username}
5+
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
6+
groups: sudo
7+
shell: /bin/bash
8+
packages:
9+
- git
10+
- curl
11+
- wget
12+
- unzip
13+
disk_setup:
14+
/dev/sdb:
15+
table_type: 'gpt'
16+
layout: true
17+
overwrite: false
18+
fs_setup:
19+
- label: ${home_volume_label}
20+
filesystem: ext4
21+
device: /dev/sdb
22+
partition: auto
23+
mounts:
24+
- ["/dev/sdb", "/home/${username}", "ext4", "defaults", "0", "2"]
25+
write_files:
26+
- path: /opt/coder/init
27+
permissions: "0755"
28+
encoding: b64
29+
content: ${init_script}
30+
- path: /etc/systemd/system/coder-agent.service
31+
permissions: "0644"
32+
content: |
33+
[Unit]
34+
Description=Coder Agent
35+
After=network-online.target
36+
Wants=network-online.target
37+
38+
[Service]
39+
User=${username}
40+
ExecStart=/opt/coder/init
41+
Environment=CODER_AGENT_TOKEN=${coder_agent_token}
42+
Restart=always
43+
RestartSec=10
44+
TimeoutStopSec=90
45+
KillMode=process
46+
47+
OOMScoreAdjust=-1000
48+
SyslogIdentifier=coder-agent
49+
50+
[Install]
51+
WantedBy=multi-user.target
52+
runcmd:
53+
- mkdir -p /home/${username}
54+
- chown ${username}:${username} /home/${username}
55+
- systemctl enable coder-agent
56+
- systemctl start coder-agent

0 commit comments

Comments
 (0)