-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostgresql.nomad
87 lines (76 loc) · 1.51 KB
/
postgresql.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
job "postgres" {
datacenters = ["dc1"]
type = "service"
group "postgres" {
count = 1
volume "postgres" {
type = "csi"
read_only = false
source = "postgres"
}
network {
port "db" {
static = 5432
}
}
task "postgres" {
driver = "docker"
config {
image = "postgres:13.2"
ports = ["db"]
}
vault {
policies = ["db"]
change_mode = "signal"
change_signal = "SIGUSR1"
}
volume_mount {
volume = "postgres"
destination = "/var/lib/postgresql/data"
read_only = false
}
template {
data = <<EOT
{{ with secret "secret/data/db/config" }}
POSTGRES_USER="{{ .Data.data.user }}"
POSTGRES_PASSWORD="{{ .Data.data.pass | toJSON }}"
PGDATA="/var/lib/postgresql/data/pgdata"
{{ end }}
EOT
destination = "db.env"
env = true
}
logs {
max_files = 5
max_file_size = 15
}
resources {
cpu = 1000
memory = 1024
}
service {
name = "postgres"
port = "db"
check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}
}
restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}
}
update {
max_parallel = 1
min_healthy_time = "5s"
healthy_deadline = "3m"
auto_revert = false
canary = 0
}
}