Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore(dogfood): replace deprecated `coder_workspace.owner_oidc_access…
…_token` and add `order` to agent `metadata`
  • Loading branch information
matifali authored Jun 3, 2024
commit 99fdf241f952606ec12f3b413ec18db8418d9b46
26 changes: 17 additions & 9 deletions dogfood/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ resource "coder_agent" "dev" {
os = "linux"
dir = local.repo_dir
env = {
OIDC_TOKEN : data.coder_workspace.me.owner_oidc_access_token,
OIDC_TOKEN : data.coder_workspace_owner.me.oidc_access_token,
}
startup_script_behavior = "blocking"

Expand All @@ -169,39 +169,44 @@ resource "coder_agent" "dev" {
# if you don't want to display any information.
metadata {
display_name = "CPU Usage"
key = "0_cpu_usage"
key = "cpu_usage"
order = 0
script = "coder stat cpu"
interval = 10
timeout = 1
}

metadata {
display_name = "RAM Usage"
key = "1_ram_usage"
key = "ram_usage"
order = 1
script = "coder stat mem"
interval = 10
timeout = 1
}

metadata {
display_name = "CPU Usage (Host)"
key = "2_cpu_usage_host"
key = "cpu_usage_host"
order = 2
script = "coder stat cpu --host"
interval = 10
timeout = 1
}

metadata {
display_name = "RAM Usage (Host)"
key = "3_ram_usage_host"
key = "ram_usage_host"
order = 3
script = "coder stat mem --host"
interval = 10
timeout = 1
}

metadata {
display_name = "Swap Usage (Host)"
key = "4_swap_usage_host"
key = "swap_usage_host"
order = 4
script = <<EOT
#!/bin/bash
echo "$(free -b | awk '/^Swap/ { printf("%.1f/%.1f", $3/1024.0/1024.0/1024.0, $2/1024.0/1024.0/1024.0) }') GiB"
Expand All @@ -212,7 +217,8 @@ resource "coder_agent" "dev" {

metadata {
display_name = "Load Average (Host)"
key = "5_load_host"
key = "load_host"
order = 5
# get load avg scaled by number of cores
script = <<EOT
#!/bin/bash
Expand All @@ -224,15 +230,17 @@ resource "coder_agent" "dev" {

metadata {
display_name = "Disk Usage (Host)"
key = "6_disk_host"
key = "disk_host"
order = 6
script = "coder stat disk --path /"
interval = 600
timeout = 10
}

metadata {
display_name = "Word of the Day"
key = "7_word"
key = "word"
order = 7
script = <<EOT
#!/bin/bash
curl -o - --silent https://www.merriam-webster.com/word-of-the-day 2>&1 | awk ' $0 ~ "Word of the Day: [A-z]+" { print $5; exit }'
Expand Down