Get Postgres password from a Nomad var, and decomission old backup.
This commit is contained in:
@@ -10,7 +10,6 @@ job "postgres" {
|
||||
to = 9187
|
||||
}
|
||||
port "admin" { }
|
||||
port "backup_healthckeck" { }
|
||||
}
|
||||
|
||||
task "postgres" {
|
||||
@@ -23,7 +22,7 @@ job "postgres" {
|
||||
}
|
||||
|
||||
env {
|
||||
POSTGRES_PASSWORD = "${var.pg_password}"
|
||||
POSTGRES_PASSWORD = "{{ with nomadVar \"secrets/postgresql\" }}{{ .postgres_password }}{{ end }}"
|
||||
}
|
||||
|
||||
service {
|
||||
@@ -52,7 +51,7 @@ job "postgres" {
|
||||
}
|
||||
|
||||
env {
|
||||
DATA_SOURCE_NAME = "postgresql://postgres:${var.pg_password}@${NOMAD_ADDR_db}/postgres?sslmode=disable"
|
||||
DATA_SOURCE_NAME = "postgresql://postgres:{{ with nomadVar \"secrets/postgresql\" }}{{ .postgres_password }}{{ end }}@${NOMAD_ADDR_db}/postgres?sslmode=disable"
|
||||
}
|
||||
|
||||
service {
|
||||
@@ -106,34 +105,9 @@ EOH
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
task "backup" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "prodrigestivill/postgres-backup-local"
|
||||
ports = [ "backup_healthckeck" ]
|
||||
volumes = [ "/data/compute/appdata/pgbackup:/backups" ]
|
||||
}
|
||||
|
||||
env {
|
||||
POSTGRES_DB = "postgres"
|
||||
POSTGRES_HOST = "${NOMAD_IP_db}"
|
||||
POSTGRES_USER = "postgres"
|
||||
POSTGRES_PASSWORD = "${var.pg_password}"
|
||||
POSTGRES_CLUSTER = "TRUE"
|
||||
POSTGRES_EXTRA_OPTS = ""
|
||||
HEALTHCHECK_PORT = "${NOMAD_PORT_backup_healthckeck}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "pg_password" {
|
||||
type = string
|
||||
default = "Faelaishewohlees4nei"
|
||||
}
|
||||
|
||||
variable "default_email" {
|
||||
type = string
|
||||
default = "petru@paler.net"
|
||||
|
||||
Reference in New Issue
Block a user