Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21e6bea

Browse files
authored
docs: add health checks to docs & examples (#4223)
1 parent 27c8345 commit 21e6bea

File tree

10 files changed

+92
-13
lines changed

10 files changed

+92
-13
lines changed

docs/ides/web-ides.md

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,19 @@ resources in the template. With our generic model, any web application can
1515
be used as a Coder application. For example:
1616

1717
```hcl
18-
# Give template users the portainer.io web UI
18+
# Add button to open Portainer in the workspace dashboard
19+
# Note: Portainer must be already running in the workspace
1920
resource "coder_app" "portainer" {
2021
agent_id = coder_agent.main.id
2122
name = "portainer"
2223
icon = "https://simpleicons.org/icons/portainer.svg"
23-
url = "http://localhost:8000"
24-
relative_path = true
24+
url = "https://localhost:9443/api/status"
25+
26+
healthcheck {
27+
url = "https://localhost:9443/api/status"
28+
interval = 6
29+
threshold = 10
30+
}
2531
}
2632
```
2733

@@ -73,13 +79,16 @@ resource "coder_app" "code-server" {
7379
name = "code-server"
7480
url = "http://localhost:13337/?folder=/home/coder"
7581
icon = "/icon/code.svg"
82+
83+
healthcheck {
84+
url = "http://localhost:13337/healthz"
85+
interval = 2
86+
threshold = 10
87+
}
88+
7689
}
7790
```
7891

79-
<blockquote class="warning">
80-
If the code-server integrated terminal fails to load, (i.e., xterm fails to load), go to DevTools to ensure xterm is loaded, clear your browser cache and refresh.
81-
</blockquote>
82-
8392
## JetBrains Projector
8493

8594
[JetBrains Projector](https://jetbrains.github.io/projector-client/mkdocs/latest/) is a JetBrains Incubator project which renders JetBrains IDEs in the web browser.
@@ -106,8 +115,6 @@ Workspace requirements:
106115
- RubyMine
107116
- WebStorm
108117

109-
- ➕ code-server (just in case!)
110-
111118
For advanced users who want to make a custom image, you can install the Projector CLI in the `startup_script` of the `coder_agent` resource in a Coder template. Using the Projector CLI, you can use `projector ide autoinstall` and `projector run` to download and start a JetBrains IDE in your workspace.
112119

113120
![IntelliJ in Coder](../images/projector-intellij.png)
@@ -176,7 +183,13 @@ resource "coder_app" "intellij" {
176183
name = "${var.jetbrains-ide}"
177184
icon = "/icon/intellij.svg"
178185
url = "http://localhost:8997/"
179-
relative_path = true
186+
187+
healthcheck {
188+
url = "http://localhost:8997/"
189+
interval = 6
190+
threshold = 20
191+
}
192+
180193
}
181194
```
182195

@@ -207,20 +220,31 @@ data "coder_workspace" "me" {}
207220
## The name of the app must always be equal to the "/apps/<name>"
208221
## string in the base_url. This caveat is unique to Jupyter.
209222
223+
locals {
224+
jupyter_base_path = "/@${data.coder_workspace.me.owner}/${data.coder_workspace.me.name}/apps/jupyter/"
225+
}
226+
210227
resource "coder_agent" "coder" {
211228
os = "linux"
212229
arch = "amd64"
213230
dir = "/home/coder"
214231
startup_script = <<-EOF
215232
pip3 install jupyterlab
216-
jupyter lab --ServerApp.base_url=/@${data.coder_workspace.me.owner}/${data.coder_workspace.me.name}/apps/jupyter/ --ServerApp.token='' --ip='*'
233+
$HOME/.local/bin/jupyter lab --ServerApp.base_url=${local.jupyter_base_path} --ServerApp.token='' --ip='*'
217234
EOF
218235
}
219236
220237
resource "coder_app" "jupyter" {
221238
agent_id = coder_agent.coder.id
222-
url = "http://localhost:8888/@${data.coder_workspace.me.owner}/${data.coder_workspace.me.name}/apps/jupyter"
223-
icon = "/icon/jupyter.svg"
239+
name = "JupyterLab"
240+
url = "http://localhost:8888${local.jupyter_base_path}"
241+
icon = "/icon/jupyter.svg"
242+
243+
healthcheck {
244+
url = "http://localhost:8888${local.jupyter_base_path}"
245+
interval = 5
246+
threshold = 10
247+
}
224248
}
225249
```
226250

dogfood/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ resource "coder_app" "code-server" {
4242
name = "code-server"
4343
url = "http://localhost:13337/"
4444
icon = "/icon/code.svg"
45+
46+
healthcheck {
47+
url = "http://localhost:1337/healthz"
48+
interval = 3
49+
threshold = 10
50+
}
4551
}
4652

4753

examples/templates/aws-ecs-container/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,10 @@ resource "coder_app" "code-server" {
110110
icon = "/icon/code.svg"
111111
url = "http://localhost:13337?folder=/home/coder"
112112
relative_path = true
113+
114+
healthcheck {
115+
url = "http://localhost:1337/healthz"
116+
interval = 3
117+
threshold = 10
118+
}
113119
}

examples/templates/aws-linux/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ resource "coder_app" "code-server" {
9090
name = "code-server"
9191
url = "http://localhost:13337/?folder=/home/coder"
9292
icon = "/icon/code.svg"
93+
94+
healthcheck {
95+
url = "http://localhost:1337/healthz"
96+
interval = 3
97+
threshold = 10
98+
}
9399
}
94100

95101
locals {

examples/templates/bare/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,10 @@ resource "coder_app" "fake-app" {
4747
icon = "/icon/code.svg"
4848
agent_id = "fake-compute"
4949
url = "http://localhost:8080"
50+
51+
healthcheck {
52+
url = "http://localhost:1337/healthz"
53+
interval = 3
54+
threshold = 10
55+
}
5056
}

examples/templates/docker-code-server/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ resource "coder_app" "code-server" {
4141
agent_id = coder_agent.main.id
4242
url = "http://localhost:8080/?folder=/home/coder"
4343
icon = "/icon/code.svg"
44+
45+
healthcheck {
46+
url = "http://localhost:8080/healthz"
47+
interval = 3
48+
threshold = 10
49+
}
4450
}
4551

4652
resource "docker_volume" "home_volume" {

examples/templates/docker-image-builds/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ resource "coder_app" "code-server" {
3838
name = "code-server"
3939
url = "http://localhost:13337/?folder=/home/coder"
4040
icon = "/icon/code.svg"
41+
42+
healthcheck {
43+
url = "http://localhost:1337/healthz"
44+
interval = 3
45+
threshold = 10
46+
}
47+
4148
}
4249

4350
variable "docker_image" {

examples/templates/gcp-linux/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ resource "coder_app" "code-server" {
6565
icon = "/icon/code.svg"
6666
url = "http://localhost:13337?folder=/home/coder"
6767
relative_path = true
68+
69+
healthcheck {
70+
url = "http://localhost:1337/healthz"
71+
interval = 3
72+
threshold = 10
73+
}
6874
}
6975

7076
resource "google_compute_instance" "dev" {

examples/templates/gcp-vm-container/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ resource "coder_app" "code-server" {
5555
icon = "/icon/code.svg"
5656
url = "http://localhost:13337?folder=/home/coder"
5757
relative_path = true
58+
59+
healthcheck {
60+
url = "http://localhost:1337/healthz"
61+
interval = 3
62+
threshold = 10
63+
}
5864
}
5965

6066
module "gce-container" {

examples/templates/kubernetes/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ resource "coder_app" "code-server" {
7676
icon = "/icon/code.svg"
7777
url = "http://localhost:13337?folder=/home/coder"
7878
relative_path = true
79+
80+
healthcheck {
81+
url = "http://localhost:1337/healthz"
82+
interval = 3
83+
threshold = 10
84+
}
7985
}
8086

8187
resource "kubernetes_persistent_volume_claim" "home" {

0 commit comments

Comments
 (0)