-
Notifications
You must be signed in to change notification settings - Fork 0
/
postgresql.hcl
107 lines (90 loc) · 2.27 KB
/
postgresql.hcl
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
job "postgres" {
datacenters = ["dc1"]
constraint {
attribute = "${attr.cpu.arch}"
value = "amd64"
}
group "db" {
network {
port "db" {
static = 5432
}
}
task "postgresql-db" {
driver = "docker"
template {
data = <<EOH
POSTGRES_PASSWORD="{{ key "postgresql/password/root" }}"
POSTGRES_USER="root"
EOH
destination = "local/file.env"
env = true
}
config {
image = "postgres:latest"
ports = ["db"]
volumes = [
"local/postgresql.conf:/etc/postgres/postgresql.conf",
"local/pg_hba.conf:/pg_hba.conf",
"local/pg_ident.conf:/pg_ident.conf"
]
}
template {
data = <<EOH
max_connections = 100
shared_buffers = 2GB
effective_cache_size = 6GB
maintenance_work_mem = 512MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 5242kB
min_wal_size = 1GB
max_wal_size = 4GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
max_parallel_maintenance_workers = 2
hba_file = "/pg_hba.conf"
ident_file = "/pg_ident.conf"
EOH
destination = "local/postgresql.conf"
}
template {
data = <<EOH
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
host all all all scram-sha-256
local homeassistant homeassistant peer
EOH
destination = "local/pg_hba.conf"
}
template {
data = <<EOH
map-name root homeassistant
EOH
destination = "/local/pg_ident.conf"
}
resources {
cpu = 400
memory = 800
}
service {
name = "postgresql"
port = "db"
tags = ["alloc=${NOMAD_ALLOC_ID}"]
check {
type = "tcp"
interval = "2s"
timeout = "2s"
}
}
}
}
}