File tree Expand file tree Collapse file tree 6 files changed +96
-5
lines changed Expand file tree Collapse file tree 6 files changed +96
-5
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ resource "docker_volume" "home_volume" {
133
133
134
134
resource "docker_container" "workspace" {
135
135
count = data. coder_workspace . me . start_count
136
- image = " ghcr.io/phorcys420/coder-templates/docker-android-env"
136
+ image = " ghcr.io/phorcys420/coder-templates/docker-android-env@sha256:35e00111ab49985c68635b6df75d786327d59ba4566124b2b9066a798464c9f4 "
137
137
# Uses lower() to avoid Docker restriction on container names.
138
138
name = " coder-${ lower (data. coder_workspace_owner . me . name )} -${ lower (data. coder_workspace . me . name )} "
139
139
# Hostname makes the shell more user friendly: coder@my-workspace:~$
@@ -231,3 +231,11 @@ module "novnc" {
231
231
232
232
agent_id = coder_agent. main . id
233
233
}
234
+
235
+ module "adb-tools" {
236
+ count = data. coder_workspace . me . start_count
237
+
238
+ source = " ./modules/adb-tools"
239
+
240
+ agent_id = coder_agent. main . id
241
+ }
Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_providers {
3
+ coder = {
4
+ source = " coder/coder"
5
+ version = " ~> 2.8.0"
6
+ }
7
+ }
8
+ }
9
+
10
+ variable "agent_id" {
11
+ type = string
12
+ description = " The ID of a Coder agent."
13
+ }
14
+
15
+ variable "listen_host" {
16
+ type = string
17
+ description = " The host adb-tools should be listening on."
18
+ default = " localhost:15555"
19
+ }
20
+
21
+ variable "host_to_proxy" {
22
+ type = string
23
+ description = " The ADB server websockify should be proxying."
24
+ default = " localhost:5555"
25
+ }
26
+
27
+ resource "coder_script" "novnc" {
28
+ agent_id = var. agent_id
29
+ display_name = " adb-tools"
30
+ icon = " /icon/widgets.svg"
31
+
32
+ script = templatefile (" ${ path . module } /run.sh" , {
33
+ WEB_SERVER_LISTEN_HOST = var.listen_host,
34
+ ADB_SERVER_HOST = var.host_to_proxy
35
+ })
36
+
37
+ run_on_start = true
38
+ }
39
+
40
+ resource "coder_app" "adb-tools" {
41
+ agent_id = var. agent_id
42
+
43
+ display_name = " adb-tools"
44
+ slug = " adb-tools"
45
+ icon = " /emojis/1f4f1.png"
46
+
47
+ url = " http://${ var . listen_host } "
48
+
49
+ group = " adb-tools"
50
+ subdomain = true
51
+
52
+ order = 4
53
+
54
+ healthcheck {
55
+ url = " http://${ var . listen_host } /"
56
+ interval = 5
57
+ threshold = 6
58
+ }
59
+ }
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # Injected by terraform through templatefile()
4
+ WEB_SERVER_LISTEN_HOST=' ${WEB_SERVER_LISTEN_HOST}'
5
+ ADB_SERVER_HOST=' ${ADB_SERVER_HOST}'
6
+
7
+ STATIC_SITE_PATH=" /tmp/adb-tools-static-site"
8
+
9
+ # echo "[adb-tools] Installing websockify"
10
+ # sudo apt-get update -y
11
+ # sudo apt-get install -y websockify
12
+
13
+ echo " [adb-tools] Downloading frontend"
14
+ wget https://nightly.link/phorcys420/adb-tools/workflows/deploy/main/adb-tools-static-site.zip
15
+ unzip adb-tools-static-site.zip -d " $STATIC_SITE_PATH "
16
+
17
+ # TODO: remove this once we support coder_script ordering
18
+ sleep 20
19
+
20
+ echo " [adb-tools] Starting websockify"
21
+ websockify " $WEB_SERVER_LISTEN_HOST " " $ADB_SERVER_HOST " --web " $STATIC_SITE_PATH " > /tmp/adb-tools-websockify.log 2>&1 &
Original file line number Diff line number Diff line change @@ -43,5 +43,5 @@ resource "coder_app" "novnc2" {
43
43
threshold = 6
44
44
}
45
45
46
- order = 4
46
+ order = 5
47
47
}
Original file line number Diff line number Diff line change @@ -69,11 +69,12 @@ resource "coder_app" "novnc" {
69
69
70
70
url = " http://${ var . listen_host } /${ var . coder_app_uri_parameters } "
71
71
72
- # TODO: make variable for those
73
- share = var. coder_app_share
74
-
72
+ # TODO: make variable for these
73
+ share = var. coder_app_share
75
74
order = 3
76
75
76
+ subdomain = true
77
+
77
78
healthcheck {
78
79
url = " http://${ var . listen_host } /"
79
80
interval = 5
Original file line number Diff line number Diff line change 4
4
NOVNC_LISTEN_HOST=' ${NOVNC_LISTEN_HOST}'
5
5
NOVNC_HOST_TO_PROXY=' ${NOVNC_HOST_TO_PROXY}'
6
6
7
+ # TODO: support a noVNC repo already being present
8
+ # TODO: move to git-clone module once coder_script ordering is supported
7
9
echo " [noVNC] Installing noVNC"
8
10
sudo apt-get update -y
9
11
sudo apt-get install -y websockify && git clone https://github.com/novnc/noVNC && mv noVNC/vnc.html noVNC/index.html
You can’t perform that action at this time.
0 commit comments