-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudflared.nomad
77 lines (73 loc) · 1.57 KB
/
cloudflared.nomad
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
job "cloudflare-tunnel" {
datacenters = ["dc1"]
type = "service"
group "app" {
network {
port "metrics" {}
port "cloudflared" {}
mode = "bridge"
}
service {
name = "cloudflared-test"
tags = ["cloudflared", "test"]
port = "cloudflared"
// check {
// name = "alive"
// type = "tcp"
// interval = "10s"
// timeout = "2s"
// }
check {
name = "metrics"
type = "http"
interval = "10s"
timeout = "2s"
port = "metrics"
path = "/metrics"
}
}
reschedule {
attempts = 1
interval = "1m"
unlimited = false
delay_function = "constant"
}
restart {
attempts = 1
interval = "2m"
delay = "15s"
mode = "delay"
}
task "tunnel" {
vault {}
template {
data = <<EOH
TUNNEL_TOKEN="{{ with secret "hashiatho.me-v2/data/cloudflare" }}{{- .Data.data.cloudflare_access_test_token -}}{{ end }}"
EOH
destination = "secrets/.env"
env = true
}
env {
TUNNEL_METRICS = "0.0.0.0:${NOMAD_PORT_metrics}"
TUNNEL_LOGLEVEL = "info"
}
restart {
interval = "1m"
attempts = 1
delay = "5s"
mode = "fail"
}
driver = "docker"
config {
image = "cloudflare/cloudflared"
args = [
"tunnel", "run"
]
}
resources {
cpu = 100
memory = 64
}
}
}
}