-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpscextract.nomad.tpl
More file actions
164 lines (150 loc) · 5.27 KB
/
pscextract.nomad.tpl
File metadata and controls
164 lines (150 loc) · 5.27 KB
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
job "pscextract" {
datacenters = ["${datacenter}"]
type = "service"
namespace = "${nomad_namespace}"
vault {
policies = ["psc-ecosystem"]
change_mode = "restart"
}
group "pscextract-services" {
count = "1"
// Volume portworx CSI
volume "pscextract" {
attachment_mode = "file-system"
access_mode = "single-node-writer"
type = "csi"
read_only = false
source = "vs-${nomad_namespace}-pscextract-data"
}
affinity {
attribute = "$\u007Bnode.class\u007D"
value = "compute"
}
network {
port "http" {
to = 8080
}
}
task "prep-volume" {
driver = "docker"
// Monter le volume portworx CSI
volume_mount {
volume = "pscextract"
destination = "/app/extract-repo"
read_only = false
}
config {
image = "busybox:latest"
command = "sh"
args = ["-c", "mkdir -p /app/extract-repo/working-directory && chown -R 1:1 /app/extract-repo"]
}
resources {
cpu = 200
memory = 128
}
lifecycle {
hook = "prestart"
sidecar = "false"
}
}
task "pscextract" {
restart {
attempts = 3
delay = "60s"
interval = "1h"
mode = "fail"
}
driver = "docker"
env {
JAVA_TOOL_OPTIONS = "-Dspring.config.location=/secrets/application.properties -Xms256m -Xmx2048m -XX:+UseG1GC"
}
config {
extra_hosts = [ "psc-api-maj.internal:$\u007BNOMAD_IP_http\u007D" ]
image = "${artifact.image}:${artifact.tag}"
volumes = [
"name=${nomad_namespace}-pscextract-data,io_priority=high,size=10,repl=3:/app/extract-repo"
]
volume_driver = "pxd"
ports = ["http"]
}
template {
destination = "local/file.env"
env = true
data = <<EOF
PUBLIC_HOSTNAME={{ with secret "psc-ecosystem/${nomad_namespace}/pscextract" }}{{ .Data.data.public_hostname }}{{ end }}
EOF
}
template {
data = <<EOF
server.servlet.context-path=/pscextract/v1
mongodb.host={{ range service "${nomad_namespace}-psc-mongodb" }}{{ .Address }}{{ end }}
mongodb.port={{ range service "${nomad_namespace}-psc-mongodb" }}{{ .Port }}{{ end }}
mongodb.name=mongodb
mongodb.username={{ with secret "psc-ecosystem/${nomad_namespace}/mongodb" }}{{ .Data.data.root_user}}{{ end }}
mongodb.password={{ with secret "psc-ecosystem/${nomad_namespace}/mongodb" }}{{ .Data.data.root_pass}}{{ end }}
mongodb.admin.database=admin
files.directory=/app/extract-repo
working.directory=/app/extract-repo/working-directory
api.base.url={{ range service "${nomad_namespace}-psc-api-maj-v2" }}http://{{ .Address }}:{{ .Port }}/psc-api-maj/api{{ end }}
extract.name=Extraction_Pro_sante_connect
extract.test.name={{ with secret "psc-ecosystem/${nomad_namespace}/pscextract" }}{{ .Data.data.test_file_name }}{{ end }}
page.size=50000
first.name.count=3
server.servlet.context-path=/pscextract/v1
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
spring.mail.host={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_server_host }}{{ end }}
spring.mail.port={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_server_port }}{{ end }}
spring.mail.username={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_username }}{{ end }}
spring.mail.password={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_password }}{{ end }}
spring.mail.properties.mail.smtp.auth={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_smtp_auth }}{{ end }}
spring.mail.properties.mail.smtp.starttls.enable={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_enable_tls }}{{ end }}
pscextract.mail.receiver={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.mail_receiver }}{{ end }}
secpsc.environment={{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}{{ .Data.data.platform }}{{ end }}
{{ with secret "psc-ecosystem/${nomad_namespace}/admin" }}logging.level.fr.ans.psc={{ .Data.data.log_level }}{{ end }}
EOF
destination = "secrets/application.properties"
}
resources {
cpu = 1000
memory = 2560
}
service {
name = "$\u007BNOMAD_NAMESPACE\u007D-$\u007BNOMAD_JOB_NAME\u007D"
tags = ["urlprefix-$\u007BPUBLIC_HOSTNAME\u007D/pscextract/v1/"]
port = "http"
check {
type = "http"
path = "/pscextract/v1/check"
port = "http"
interval = "30s"
timeout = "2s"
failures_before_critical = 5
}
}
}
task "log-shipper" {
driver = "docker"
restart {
interval = "30m"
attempts = 5
delay = "15s"
mode = "delay"
}
meta {
INSTANCE = "$\u007BNOMAD_ALLOC_NAME\u007D"
}
template {
data = <<EOH
LOGSTASH_HOST = {{ range service "${nomad_namespace}-logstash" }}{{ .Address }}:{{ .Port }}{{ end }}
ENVIRONMENT = "${datacenter}"
EOH
destination = "local/file.env"
env = true
}
config {
image = "${registry_username}/filebeat:7.14.2"
}
}
}
}