Skip to content

Commit 4e5367c

Browse files
bamhm182matifali
andauthored
chore: update Digital Ocean example template (#11528) (#11535)
Co-authored-by: Muhammad Atif Ali <atif@coder.com>
1 parent 9b43703 commit 4e5367c

File tree

3 files changed

+90
-88
lines changed

3 files changed

+90
-88
lines changed

examples/templates/do-linux/main.tf

Lines changed: 73 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,40 @@ data "coder_parameter" "droplet_image" {
5656
type = "string"
5757
mutable = false
5858
option {
59-
name = "Ubuntu 22.04"
60-
value = "ubuntu-22-04-x64"
61-
icon = "/icon/ubuntu.svg"
59+
name = "AlmaLinux 9"
60+
value = "almalinux-9-x64"
61+
icon = "/icon/almalinux.svg"
6262
}
6363
option {
64-
name = "Ubuntu 20.04"
65-
value = "ubuntu-20-04-x64"
66-
icon = "/icon/ubuntu.svg"
64+
name = "AlmaLinux 8"
65+
value = "almalinux-8-x64"
66+
icon = "/icon/almalinux.svg"
6767
}
6868
option {
69-
name = "Fedora 36"
70-
value = "fedora-36-x64"
69+
name = "Fedora 39"
70+
value = "fedora-39-x64"
7171
icon = "/icon/fedora.svg"
7272
}
7373
option {
74-
name = "Fedora 35"
75-
value = "fedora-35-x64"
74+
name = "Fedora 38"
75+
value = "fedora-38-x64"
7676
icon = "/icon/fedora.svg"
7777
}
78+
option {
79+
name = "CentOS Stream 9"
80+
value = "centos-stream-9-x64"
81+
icon = "/icon/centos.svg"
82+
}
83+
option {
84+
name = "CentOS Stream 8"
85+
value = "centos-stream-8-x64"
86+
icon = "/icon/centos.svg"
87+
}
88+
option {
89+
name = "Debian 12"
90+
value = "debian-12-x64"
91+
icon = "/icon/debian.svg"
92+
}
7893
option {
7994
name = "Debian 11"
8095
value = "debian-11-x64"
@@ -86,24 +101,24 @@ data "coder_parameter" "droplet_image" {
86101
icon = "/icon/debian.svg"
87102
}
88103
option {
89-
name = "CentOS Stream 9"
90-
value = "centos-stream-9-x64"
91-
icon = "/icon/centos.svg"
92-
}
93-
option {
94-
name = "CentOS Stream 8"
95-
value = "centos-stream-8-x64"
96-
icon = "/icon/centos.svg"
104+
name = "Rocky Linux 9"
105+
value = "rockylinux-9-x64"
106+
icon = "/icon/rockylinux.svg"
97107
}
98108
option {
99109
name = "Rocky Linux 8"
100110
value = "rockylinux-8-x64"
101111
icon = "/icon/rockylinux.svg"
102112
}
103113
option {
104-
name = "Rocky Linux 8.4"
105-
value = "rockylinux-8-4-x64"
106-
icon = "/icon/rockylinux.svg"
114+
name = "Ubuntu 22.04 (LTS)"
115+
value = "ubuntu-22-04-x64"
116+
icon = "/icon/ubuntu.svg"
117+
}
118+
option {
119+
name = "Ubuntu 20.04 (LTS)"
120+
value = "ubuntu-20-04-x64"
121+
icon = "/icon/ubuntu.svg"
107122
}
108123
}
109124

@@ -115,6 +130,8 @@ data "coder_parameter" "droplet_size" {
115130
type = "string"
116131
icon = "/icon/memory.svg"
117132
mutable = false
133+
# s-1vcpu-512mb-10gb is unsupported in tor1, blr1, lon1, sfo2, and nyc3 regions
134+
# s-8vcpu-16gb access requires a support ticket with Digital Ocean
118135
option {
119136
name = "1 vCPU, 1 GB RAM"
120137
value = "s-1vcpu-1gb"
@@ -135,13 +152,8 @@ data "coder_parameter" "droplet_size" {
135152
name = "4 vCPU, 8 GB RAM"
136153
value = "s-4vcpu-8gb"
137154
}
138-
option {
139-
name = "8 vCPU, 16 GB RAM"
140-
value = "s-8vcpu-16gb"
141-
}
142155
}
143156

144-
145157
data "coder_parameter" "home_volume_size" {
146158
name = "home_volume_size"
147159
display_name = "Home volume size"
@@ -151,7 +163,7 @@ data "coder_parameter" "home_volume_size" {
151163
mutable = false
152164
validation {
153165
min = 1
154-
max = 999999
166+
max = 100 # Sizes larger than 100 GB require a support ticket with Digital Ocean
155167
}
156168
}
157169

@@ -163,70 +175,56 @@ data "coder_parameter" "region" {
163175
type = "string"
164176
default = "ams3"
165177
mutable = false
178+
# nyc1, sfo1, and ams2 regions were excluded because they do not support volumes, which are used to persist data while decreasing cost
166179
option {
167-
name = "New York 1"
168-
value = "nyc1"
169-
icon = "/emojis/1f1fa-1f1f8.png"
170-
}
171-
option {
172-
name = "New York 2"
173-
value = "nyc2"
174-
icon = "/emojis/1f1fa-1f1f8.png"
175-
}
176-
option {
177-
name = "New York 3"
178-
value = "nyc3"
179-
icon = "/emojis/1f1fa-1f1f8.png"
180-
}
181-
option {
182-
name = "San Francisco 1"
183-
value = "sfo1"
184-
icon = "/emojis/1f1fa-1f1f8.png"
185-
}
186-
option {
187-
name = "San Francisco 2"
188-
value = "sfo2"
189-
icon = "/emojis/1f1fa-1f1f8.png"
180+
name = "Canada (Toronto)"
181+
value = "tor1"
182+
icon = "/emojis/1f1e8-1f1e6.png"
190183
}
191184
option {
192-
name = "San Francisco 3"
193-
value = "sfo3"
194-
icon = "/emojis/1f1fa-1f1f8.png"
185+
name = "Germany (Frankfurt)"
186+
value = "fra1"
187+
icon = "/emojis/1f1e9-1f1ea.png"
195188
}
196189
option {
197-
name = "Amsterdam 2"
198-
value = "ams2"
199-
icon = "/emojis/1f1f3-1f1f1.png"
190+
name = "India (Bangalore)"
191+
value = "blr1"
192+
icon = "/emojis/1f1ee-1f1f3.png"
200193
}
201194
option {
202-
name = "Amsterdam 3"
195+
name = "Netherlands (Amsterdam)"
203196
value = "ams3"
204197
icon = "/emojis/1f1f3-1f1f1.png"
205198
}
206199
option {
207-
name = "Singapore 1"
200+
name = "Singapore"
208201
value = "sgp1"
209202
icon = "/emojis/1f1f8-1f1ec.png"
210203
}
211204
option {
212-
name = "London 1"
205+
name = "United Kingdom (London)"
213206
value = "lon1"
214207
icon = "/emojis/1f1ec-1f1e7.png"
215208
}
216209
option {
217-
name = "Frankfurt 1"
218-
value = "fra1"
219-
icon = "/emojis/1f1e9-1f1ea.png"
210+
name = "United States (California - 2)"
211+
value = "sfo2"
212+
icon = "/emojis/1f1fa-1f1f8.png"
220213
}
221214
option {
222-
name = "Toronto 1"
223-
value = "tor1"
224-
icon = "/emojis/1f1e8-1f1e6.png"
215+
name = "United States (California - 3)"
216+
value = "sfo3"
217+
icon = "/emojis/1f1fa-1f1f8.png"
225218
}
226219
option {
227-
name = "Bangalore 1"
228-
value = "blr1"
229-
icon = "/emojis/1f1ee-1f1f3.png"
220+
name = "United States (New York - 1)"
221+
value = "nyc1"
222+
icon = "/emojis/1f1fa-1f1f8.png"
223+
}
224+
option {
225+
name = "United States (New York - 3)"
226+
value = "nyc3"
227+
icon = "/emojis/1f1fa-1f1f8.png"
230228
}
231229
}
232230

@@ -247,35 +245,22 @@ resource "coder_agent" "main" {
247245
display_name = "CPU Usage"
248246
interval = 5
249247
timeout = 5
250-
script = <<-EOT
251-
#!/bin/bash
252-
set -e
253-
top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4 "%"}'
254-
EOT
248+
script = "coder stat cpu"
255249
}
256250
metadata {
257251
key = "memory"
258252
display_name = "Memory Usage"
259253
interval = 5
260254
timeout = 5
261-
script = <<-EOT
262-
#!/bin/bash
263-
set -e
264-
free -m | awk 'NR==2{printf "%.2f%%\t", $3*100/$2 }'
265-
EOT
255+
script = "coder stat mem"
266256
}
267257
metadata {
268-
key = "disk"
269-
display_name = "Disk Usage"
258+
key = "home"
259+
display_name = "Home Usage"
270260
interval = 600 # every 10 minutes
271261
timeout = 30 # df can take a while on large filesystems
272-
script = <<-EOT
273-
#!/bin/bash
274-
set -e
275-
df /home/coder | awk '$NF=="/"{printf "%s", $5}'
276-
EOT
262+
script = "coder stat disk --path /home/${lower(data.coder_workspace.me.owner)}"
277263
}
278-
279264
}
280265

281266
resource "digitalocean_volume" "home_volume" {
@@ -293,13 +278,13 @@ resource "digitalocean_volume" "home_volume" {
293278
resource "digitalocean_droplet" "workspace" {
294279
region = data.coder_parameter.region.value
295280
count = data.coder_workspace.me.start_count
296-
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
281+
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
297282
image = data.coder_parameter.droplet_image.value
298283
size = data.coder_parameter.droplet_size.value
299284

300285
volume_ids = [digitalocean_volume.home_volume.id]
301286
user_data = templatefile("cloud-config.yaml.tftpl", {
302-
username = data.coder_workspace.me.owner
287+
username = lower(data.coder_workspace.me.owner)
303288
home_volume_label = digitalocean_volume.home_volume.initial_filesystem_label
304289
init_script = base64encode(coder_agent.main.init_script)
305290
coder_agent_token = coder_agent.main.token

site/src/theme/icons.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[
2+
"almalinux.svg",
23
"android-studio.svg",
34
"apache-guacamole.svg",
45
"apple-black.svg",

site/static/icon/almalinux.svg

Lines changed: 16 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)
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