-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathagent.tf
112 lines (106 loc) · 3.53 KB
/
agent.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
resource "coder_agent" "iipod" {
arch = data.coder_provisioner.ii.arch
os = data.coder_provisioner.ii.os
dir = "$HOME" # Could set to somewhere
motd_file = "/etc/motd"
startup_script_behavior = "non-blocking" # blocking, non-blocking
troubleshooting_url = "http://ii.nz" # blocking, non-blocking
connection_timeout = 300
startup_script = file("./iipod-startup.sh")
startup_script_timeout = 300
shutdown_script = file("./iipod-shutdown.sh")
shutdown_script_timeout = 300
env = {
# GITHUB_TOKEN = "$${data.coder_git_auth.github.access_token}"
# GITHUB_TOKEN = "${data.coder_external_auth.github.access_token}"
# Just a hidden feature for now to try out
OPENAI_API_TOKEN = "${var.openai_api_token}"
ORGFILE_URL = "${data.coder_parameter.org-url.value}"
SESSION_NAME = "${lower(data.coder_workspace.ii.name)}"
GIT_REPO = "${data.coder_parameter.git-url.value}"
SPACE_DOMAIN = "${local.space_domain}"
GIT_AUTHOR_NAME = "${data.coder_workspace.ii.owner}"
GIT_COMMITTER_NAME = "${data.coder_workspace.ii.owner}"
GIT_AUTHOR_EMAIL = "${data.coder_workspace.ii.owner_email}"
GIT_COMMITTER_EMAIL = "${data.coder_workspace.ii.owner_email}"
}
display_apps {
port_forwarding_helper = true
ssh_helper = true
vscode = true
vscode_insiders = true
web_terminal = true
}
# metadata {
# key = "tmux-clients"
# display_name = "tmux clients"
# interval = 5
# timeout = 5
# script = <<-EOT
# #!/bin/bash
# set -e
# tmux list-clients -F "#{client_session}:#{client_width}x#{client_height}" | xargs echo
# EOT
# }
# metadata {
# key = "tmux-windows"
# display_name = "tmux windows"
# interval = 5
# timeout = 5
# script = <<-EOT
# #!/bin/bash
# set -e
# tmux list-windows -F "#{window_index}:#{window_name}" | xargs echo
# EOT
# }
# The following metadata blocks are optional. They are used to display
# information about your workspace in the dashboard. You can remove them
# if you don't want to display any information.
# For basic resources, you can use the `coder stat` command.
# If you need more control, you can write your own script.
metadata {
display_name = "CPU Usage"
key = "0_cpu_usage"
script = "coder stat cpu"
interval = 10
timeout = 1
}
metadata {
display_name = "RAM Usage"
key = "1_ram_usage"
script = "coder stat mem"
interval = 10
timeout = 1
}
metadata {
display_name = "Home Disk"
key = "3_home_disk"
script = "coder stat disk --path $${HOME}"
interval = 60
timeout = 1
}
metadata {
display_name = "CPU Usage (Host)"
key = "4_cpu_usage_host"
script = "coder stat cpu --host"
interval = 10
timeout = 1
}
metadata {
display_name = "Memory Usage (Host)"
key = "5_mem_usage_host"
script = "coder stat mem --host"
interval = 10
timeout = 1
}
metadata {
display_name = "Load Average (Host)"
key = "6_load_host"
# get load avg scaled by number of cores
script = <<EOT
echo "`cat /proc/loadavg | awk '{ print $1 }'` `nproc`" | awk '{ printf "%0.2f", $1/$2 }'
EOT
interval = 60
timeout = 1
}
}