Skip to content

Commit 20983a5

Browse files
committed
Updates
1 parent 9184a7a commit 20983a5

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

influxdb/nomad/influxdb.hcl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ variable "admin_password" {
6666
type = string
6767
}
6868

69+
///////////////////////////////////////////////////////////////////////////////
70+
// LOCALS
71+
6972
locals {
70-
DATA_PATH = var.data == "" ? "${NOMAD_ALLOC_DIR}/data" : "/var/lib/influxdb/"
73+
DATA_PATH = var.data == "" ? "${NOMAD_ALLOC_DIR}/data" : "/var/lib/influxdb"
7174
}
7275

7376
///////////////////////////////////////////////////////////////////////////////
@@ -120,14 +123,13 @@ job "influxdb" {
120123
data_path = local.DATA_PATH
121124
}
122125

123-
124126
template {
125127
destination = "local/config/config.yml"
126128
data = <<-EOF
127129
secret-store: bolt
128130
engine-path: {{ env "NOMAD_META_data_path" }}/engine
129-
bolt-path: {{ env "NOMAD_META_data_path" }}/influxd.bolt
130-
sqlite-path: {{ env "NOMAD_META_data_path" }}/influxd.sqlite
131+
bolt-path: {{ env "NOMAD_META_data_path" }}/influxd.bolt
132+
sqlite-path: {{ env "NOMAD_META_data_path" }}/influxd.sqlite
131133
http-bind-address: :8086
132134
ui-disabled: false
133135
EOF

mosquitto/nomad/mosquitto.hcl

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ variable "data" {
5151
default = ""
5252
}
5353

54+
///////////////////////////////////////////////////////////////////////////////
55+
// LOCALS
56+
57+
locals {
58+
DATA_PATH = var.data == "" ? "${NOMAD_ALLOC_DIR}/data" : "/mosquitto/data"
59+
}
60+
5461
///////////////////////////////////////////////////////////////////////////////
5562
// JOB
5663

@@ -90,16 +97,24 @@ job "mosquitto" {
9097
provider = var.service_provider
9198
}
9299

100+
ephemeral_disk {
101+
migrate = true
102+
}
103+
93104
task "daemon" {
94105
driver = "docker"
95106

107+
meta {
108+
data_path = local.DATA_PATH
109+
}
110+
96111
template {
97112
destination = "/local/config/mosquitto.conf"
98113
data = <<-EOF
99114
listener 1883
100115
allow_anonymous true
101116
persistence true
102-
persistence_location /mosquitto/data
117+
persistence_location {{ env "NOMAD_META_data_path" }}
103118
log_dest stderr
104119
EOF
105120
}
@@ -108,7 +123,7 @@ job "mosquitto" {
108123
image = var.docker_image
109124
force_pull = var.docker_always_pull
110125
volumes = compact([
111-
format("%s:/mosquitto/data", var.data == "" ? "../alloc/data" : var.data),
126+
var.data == "" ? "" : format("%s:/mosquitto/data",var.data),
112127
"local/config:/mosquitto/config:ro"
113128
])
114129
ports = ["mqtt"]

openldap/nomad/openldap.hcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,24 @@ job "openldap" {
9999
provider = var.service_provider
100100
}
101101

102+
ephemeral_disk {
103+
migrate = true
104+
}
105+
102106
task "daemon" {
103107
driver = "docker"
104108

105109
config {
106110
image = var.docker_image
107111
force_pull = var.docker_always_pull
108112
volumes = compact([
109-
format("%s:/var/lib/openldap", var.data == "" ? "../alloc/data" : var.data)
113+
var.data == "" ? "" : format("%s:/bitnami/openldap",var.data)
110114
])
111115
ports = ["ldap"]
112116
}
113117

118+
// TODO: /bitnami/openldap should be /alloc/data when var.data is empty
119+
114120
env {
115121
LDAP_ADMIN_USERNAME = "admin"
116122
LDAP_ADMIN_PASSWORD = var.admin_password

postgresql/nomad/postgresql.hcl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ variable "database" {
6161
default = "default"
6262
}
6363

64+
///////////////////////////////////////////////////////////////////////////////
65+
// LOCALS
66+
67+
locals {
68+
data_path = var.data == "" ? "${NOMAD_ALLOC_DIR}/data" : "/var/lib/postgresql"
69+
}
70+
6471
///////////////////////////////////////////////////////////////////////////////
6572
// JOB
6673

@@ -100,6 +107,10 @@ job "postgresql" {
100107
provider = var.service_provider
101108
}
102109

110+
ephemeral_disk {
111+
migrate = true
112+
}
113+
103114
task "server" {
104115
driver = "docker"
105116

@@ -108,15 +119,15 @@ job "postgresql" {
108119
force_pull = var.docker_always_pull
109120
ports = ["postgresql"]
110121
volumes = compact([
111-
format("%s:/var/lib/postgresql", var.data == "" ? "" : var.data)
122+
var.data == "" ? "" : format("%s:/var/lib/postgresql",var.data)
112123
])
113124
}
114125

115126
env {
116127
POSTGRES_USER = "root"
117128
POSTGRES_PASSWORD = var.root_password
118129
POSTGRES_DB = var.database
119-
PGDATA = var.data == "" ? format("%s/data",NOMAD_ALLOC_DIR) : "/var/lib/postgresql/data"
130+
PGDATA = local.data_path
120131
}
121132

122133
} // task "server"

0 commit comments

Comments
 (0)