-
Notifications
You must be signed in to change notification settings - Fork 0
/
artifactory-app.nomad.tpl
256 lines (216 loc) · 8.14 KB
/
artifactory-app.nomad.tpl
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
job "${nomad_namespace}-app" {
datacenters = ["${datacenter}"]
namespace = "${nomad_namespace}"
type = "service"
update {
health_check = "checks"
min_healthy_time = "10s"
healthy_deadline = "10m"
progress_deadline = "15m"
}
vault {
policies = ["${vault_acl_policy_name}","smtp"]
change_mode = "restart"
}
group "artifactory-app" {
count ="1"
restart {
attempts = 3
delay = "60s"
interval = "1h"
mode = "fail"
}
constraint {
attribute = "$${node.class}"
value = "data"
}
network {
port "artifactory-svc" { to = 8081 }
port "artifactory-entrypoints" { to = 8082 }
}
volume "artifactory-filestore" {
type = "csi"
read_only = false
source = "nfs-artifactory"
attachment_mode = "file-system"
access_mode = "multi-node-multi-writer"
}
task "artifactory" {
volume_mount {
volume = "artifactory-filestore"
destination = "/var/opt/jfrog/artifactory/data/artifactory/filestore"
read_only = false
}
driver = "docker"
leader = true
artifact {
source = "${repo_url}/artifactory/ext-release-local/org/mariadb/jdbc/mariadb-java-client/2.7.1/mariadb-java-client-2.7.1.jar"
options {
archive = false
}
}
template {
destination = "secrets/system.yaml"
change_mode = "noop"
perms = "777"
data = <<EOH
## @formatter:off
## JFROG ARTIFACTORY SYSTEM CONFIGURATION FILE
## HOW TO USE: comment-out any field and keep the correct yaml indentation by deleting only the leading '#' character.
configVersion: 1
## NOTE: JFROG_HOME is a place holder for the JFrog root directory containing the deployed product, the home directory for all JFrog products.
## Replace JFROG_HOME with the real path! For example, in RPM install, JFROG_HOME=/opt/jfrog
## NOTE: Sensitive information such as passwords and join key are encrypted on first read.
## NOTE: The provided commented key and value is the default.
## SHARED CONFIGURATIONS
## A shared section for keys across all services in this config
shared:
## Security Configuration
security:
## Join key value for joining the cluster (takes precedence over 'joinKeyFile')
#joinKey: "<Your joinKey>"
## Join key file location
#joinKeyFile: "<For example: JFROG_HOME/artifactory/var/etc/security/join.key>"
## Master key file location
## Generated by the product on first startup if not provided
#masterKeyFile: "<For example: JFROG_HOME/artifactory/var/etc/security/master.key>"
## Maximum time to wait for key files (master.key and join.key)
#bootstrapKeysReadTimeoutSecs: 120
## Node Settings
node:
## A unique id to identify this node.
## Default auto generated at startup.
#id: "art1"
## Default auto resolved by startup script
#ip:
## Sets this node as primary in HA installation
#primary: true
## Sets this node as part of HA installation
#haEnabled: true
## Database Configuration
database:
## Example for postgresql
type: mariadb
## One of mysql, oracle, mssql, postgresql, mariadb
## Default Embedded derby
driver: org.mariadb.jdbc.Driver
url: jdbc:mariadb://{{range service ( print (env "NOMAD_NAMESPACE") "-db") }}{{.Address}}:{{.Port}}{{end}}/{{with secret "${vault_secrets_engine_name}"}}{{ .Data.data.db_name }}{{ end }}?characterEncoding=UTF-8&elideSetAutoCommits=true&useSSL=false&useMysqlMetadata=true
username: {{with secret "${vault_secrets_engine_name}"}}{{ .Data.data.psql_username }}{{ end }}
password: {{with secret "${vault_secrets_engine_name}"}}{{ .Data.data.psql_password }}{{ end }}
EOH
}
template {
destination = "secrets/master.key"
change_mode = "noop"
perms = "755"
data = <<EOH
{{with secret "${vault_secrets_engine_name}"}}{{ .Data.data.masterkey }}{{ end }}
EOH
}
template {
destination = "secrets/binarystore.xml"
change_mode = "noop"
perms = "755"
data = <<EOH
<config version="1">
<chain template="file-system"/>
<provider id="file-system" type="file-system">
<baseDataDir>/var/opt/jfrog/artifactory/data/artifactory</baseDataDir>
</provider>
</config>
EOH
}
config {
image = "${image}:${tag}"
ports = ["artifactory-svc","artifactory-entrypoints"]
volumes = ["name=$${NOMAD_JOB_NAME},io_priority=high,size=20,repl=2:/var/opt/jfrog/artifactory"]
volume_driver = "pxd"
mount {
type = "bind"
target = "/opt/jfrog/artifactory/var/etc/system.yaml"
source = "secrets/system.yaml"
readonly = false
}
mount {
type = "bind"
target = "/opt/jfrog/artifactory/var/etc/security/master.key"
source = "secrets/master.key"
readonly = false
}
mount {
type = "bind"
target = "/opt/jfrog/artifactory/var/etc/artifactory/binarystore.xml"
source = "secrets/binarystore.xml"
readonly = false
}
mount {
type = "bind"
target = "/opt/jfrog/artifactory/var/bootstrap/artifactory/tomcat/lib/mariadb-java-client-2.7.1.jar"
source = "local/mariadb-java-client-2.7.1.jar"
}
}
env {
JF_ROUTER_ENTRYPOINTS_EXTERNALPORT = "8082"
}
resources {
cpu = ${app_ressource_cpu}
memory = ${app_ressource_mem}
}
service {
name = "$${NOMAD_JOB_NAME}-svc"
tags = ["urlprefix-${external_url_artifactory_hostname}/artifactory"]
port = "artifactory-svc"
check {
name = "alive"
type = "tcp"
interval = "120s" #60s
timeout = "5m" #10s
failures_before_critical = 10 #5
port = "artifactory-svc"
}
}
service {
name = "$${NOMAD_JOB_NAME}-ep"
tags = ["urlprefix-${external_url_artifactory_hostname}/"]
port = "artifactory-entrypoints"
check {
name = "alive"
type = "tcp"
interval = "120s" #60s
timeout = "5m" #10s
failures_before_critical = 10 #5
port = "artifactory-entrypoints"
}
}
}
# log-shipper
task "log-shipper" {
driver = "docker"
restart {
interval = "3m"
attempts = 5
delay = "15s"
mode = "delay"
}
meta {
INSTANCE = "$${NOMAD_ALLOC_NAME}"
}
template {
data = <<EOH
REDIS_HOSTS = {{ range service "PileELK-redis" }}{{ .Address }}:{{ .Port }}{{ end }}
PILE_ELK_APPLICATION = ${nomad_namespace}
EOH
destination = "local/file.env"
change_mode = "restart"
env = true
}
config {
image = "${log_shipper_image}:${log_shipper_tag}"
}
resources {
cpu = 50
memory = 100
}
} #end log-shipper
}
}