nomad

created pr with 5.1 on 2025-08-27 · by 84351313
cmds
checkout latest patchset:
ssh pr.in0rdr.ch print 5 | git am -3
checkout any patchset in a patch request:
ssh pr.in0rdr.ch print 5.[rev] | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.in0rdr.ch pr add 5

Patchset 5.1 on 2025-08-27 · commit 6410cd5

feat: add webssh
Andreas Gruhler 2025-08-27
Semantic diff summary
0 added, 0 modified, 0 signature changed, 0 removed across 0 analyzed files (2 files skipped: unsupported file type)
+29 -0 hcl/default/webssh/templates/nginx.conf.tmpl #
......@@ -0,0 +1,29 @@
1+# https://github.com/huashengdun/webssh/blob/master/README.md#deployment
2+server {
3+ listen {{ env "NOMAD_PORT_https" }} ssl;
4+
5+ ssl_certificate /etc/letsencrypt/live/ssh.in0rdr.ch/fullchain.pem;
6+ ssl_certificate_key /etc/letsencrypt/live/ssh.in0rdr.ch/privkey.pem;
7+
8+ location / {
9+ proxy_pass http://{{ env "NOMAD_ADDR_http" }};
10+ proxy_set_header Host $host;
11+ proxy_set_header X-Real-IP $remote_addr;
12+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
13+ proxy_set_header X-Forwarded-Proto $scheme;
14+ }
15+
16+ location /ws {
17+ proxy_pass http://{{ env "NOMAD_ADDR_http" }};
18+ proxy_set_header Host $host;
19+ proxy_set_header X-Real-IP $remote_addr;
20+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
21+ proxy_set_header X-Forwarded-Proto $scheme;
22+
23+ # WebSocket proxying
24+ # https://nginx.org/en/docs/http/websocket.html
25+ proxy_http_version 1.1;
26+ proxy_set_header Upgrade $http_upgrade;
27+ proxy_set_header Connection "upgrade";
28+ }
29+}
+73 -0 hcl/default/webssh/webssh.nomad #
......@@ -0,0 +1,73 @@
1+# https://github.com/huashengdun/webssh/blob/master/README.md#deployment
2+
3+job "webssh" {
4+ datacenters = ["dc1"]
5+
6+ vault {}
7+
8+ group "server" {
9+ count = 1
10+
11+ volume "tls" {
12+ type = "csi"
13+ source = "certbot"
14+ access_mode = "multi-node-multi-writer"
15+ attachment_mode = "file-system"
16+ }
17+
18+ network {
19+ port "http" {
20+ }
21+ port "https" {
22+ static = 44414
23+ }
24+ }
25+
26+ task "nginx" {
27+ driver = "podman"
28+
29+ config {
30+ image = "docker.io/library/nginx:stable-alpine"
31+ ports = ["https"]
32+ volumes = [
33+ # mount the templated config from the task directory to the container
34+ "local/webssh.conf:/etc/nginx/conf.d/webssh.conf",
35+ ]
36+ }
37+
38+ volume_mount {
39+ volume = "tls"
40+ destination = "/etc/letsencrypt"
41+ }
42+
43+ template {
44+ destination = "${NOMAD_TASK_DIR}/webssh.conf"
45+ data = file("./templates/nginx.conf.tmpl")
46+ }
47+
48+ resources {
49+ memory = 50
50+ memory_max = 256
51+ cpu = 200
52+ }
53+ }
54+
55+ task "webssh" {
56+ driver = "podman"
57+
58+ config {
59+ image = "haproxy.lan:5000/webssh:latest"
60+ command = "/usr/local/bin/python3"
61+ args = ["run.py", "--address=0.0.0.0", "--port=${NOMAD_PORT_http}"]
62+ force_pull = true
63+ ports = ["http"]
64+ }
65+
66+ resources {
67+ memory = 512
68+ memory_max = 1024
69+ cpu = 500
70+ }
71+ }
72+ }
73+}
Back to top