-
Notifications
You must be signed in to change notification settings - Fork 0
/
keycloak.nomad
162 lines (130 loc) · 3.99 KB
/
keycloak.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
job "keycloak" {
region = "campus"
datacenters = ["bcdc"]
type = "service"
group "keycloak" {
volume "run" {
type = "host"
source = "run"
}
network {
port "http" {}
port "management" {}
}
task "keycloak" {
driver = "docker"
config {
image = "quay.io/keycloak/keycloak:26.0.5"
force_pull = true
network_mode = "host"
entrypoint = [
"/bin/bash",
"-xeuo",
"pipefail",
"-c",
"/opt/keycloak/bin/kc.sh build && KC_BOOTSTRAP_ADMIN_USERNAME=$(head -c 512 /dev/urandom | sha256sum --binary | cut -f 1 -d ' ') KC_BOOTSTRAP_ADMIN_PASSWORD=$(head -c 512 /dev/urandom | sha256sum --binary | cut -f 1 -d ' ') /opt/keycloak/bin/kc.sh start --optimized"
]
mount {
type = "bind"
source = "local/"
target = "/opt/keycloak/providers/"
}
}
artifact {
source = "https://artifacts.gatech.aws.robojackets.net/io/github/johnjcool/keycloak-cas-services/25.0.5-SNAPSHOT/keycloak-cas-services-25.0.5-20240919.003827-12.jar"
options {
checksum = "sha1:5977450783b7598fac0bf39b6f3e3237659bcb09"
}
}
artifact {
source = "https://artifacts.gatech.aws.robojackets.net/com/dawidgora/unique-attribute-validator-provider/25.0.0-SNAPSHOT/unique-attribute-validator-provider-25.0.0-20240610.220735-4.jar"
options {
checksum = "sha1:0b6ee9030e94044ac741da66c60f26dd20049a77"
}
}
template {
data = <<EOH
{{- range $key, $value := (key "keycloak" | parseJSON) -}}
{{- $key | trimSpace -}}={{- $value | toJSON }}
{{ end -}}
KC_CACHE=local
KC_DB=mysql
KC_FEATURES_DISABLED=kerberos,authorization,ciba,client-policies,device-flow,par,step-up-authentication,persistent-user-sessions,organization
KC_HTTP_MANAGEMENT_PORT={{ env "NOMAD_PORT_management" }}
KC_HTTP_PORT={{ env "NOMAD_PORT_http" }}
KC_HTTP_HOST=127.0.0.1
KC_HOSTNAME=https://{{- with (key "nginx/hostnames" | parseJSON) -}}{{- index . (env "NOMAD_JOB_NAME") -}}{{- end }}:443
KC_HOSTNAME_BACKCHANNEL_DYNAMIC=false
KC_HEALTH_ENABLED=true
KC_HTTP_ENABLED=true
KC_PROXY_HEADERS=forwarded
{{ if eq (env "NOMAD_JOB_NAME") "keycloak-test" }}
KC_DB=dev-file
KC_HOSTNAME_DEBUG=true
{{ end }}
EOH
destination = "/secrets/.env"
env = true
}
resources {
cpu = 100
memory = 512
memory_max = 2048
}
service {
name = "${NOMAD_JOB_NAME}"
port = "http"
address = "127.0.0.1"
tags = [
"http"
]
check {
success_before_passing = 3
failures_before_critical = 2
interval = "5s"
name = "Health"
path = "/health"
port = "management"
protocol = "http"
timeout = "1s"
type = "http"
}
check {
success_before_passing = 3
failures_before_critical = 2
interval = "5s"
name = "OIDC Discovery"
path = "/realms/master/.well-known/openid-configuration"
port = "http"
protocol = "http"
timeout = "1s"
type = "http"
}
check_restart {
limit = 5
grace = "120s"
}
meta {
nginx-config = trimspace(trimsuffix(trimspace(regex_replace(regex_replace(regex_replace(regex_replace(regex_replace(regex_replace(regex_replace(regex_replace(trimspace(file("nginx.conf")),"server\\s{\\s",""),"server_name\\s\\S+;",""),"root\\s\\S+;",""),"listen\\s.+;",""),"#.+\\n",""),";\\s+",";"),"{\\s+","{"),"\\s+"," ")),"}"))
firewall-rules = jsonencode(["internet"])
no-default-headers = true
}
}
restart {
attempts = 1
delay = "10s"
interval = "1m"
mode = "fail"
}
}
}
reschedule {
delay = "10s"
delay_function = "fibonacci"
max_delay = "60s"
unlimited = true
}
update {
max_parallel = 0
}
}