Get Postgres password from a Nomad var, and decomission old backup.

This commit is contained in:
2024-01-15 13:10:23 +00:00
parent 72f9319138
commit ea79ff2e52
3 changed files with 7 additions and 29 deletions

View File

@@ -0,0 +1 @@
Faelaishewohlees4nei

View File

@@ -10,7 +10,6 @@ job "postgres" {
to = 9187 to = 9187
} }
port "admin" { } port "admin" { }
port "backup_healthckeck" { }
} }
task "postgres" { task "postgres" {
@@ -23,7 +22,7 @@ job "postgres" {
} }
env { env {
POSTGRES_PASSWORD = "${var.pg_password}" POSTGRES_PASSWORD = "{{ with nomadVar \"secrets/postgresql\" }}{{ .postgres_password }}{{ end }}"
} }
service { service {
@@ -52,7 +51,7 @@ job "postgres" {
} }
env { 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 { service {
@@ -106,32 +105,7 @@ 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" { variable "default_email" {

View File

@@ -24,4 +24,7 @@ glusterfs tweaking for wordpress performance:
* gluster volume set compute server.outstanding-rpc-limit 256 * gluster volume set compute server.outstanding-rpc-limit 256
mysql credentials mysql credentials
* Put secrets/mysql_root_password into a Nomad var named secrets/mysql * Put secrets/mysql_root_password into a Nomad var named secrets/mysql.root_password
postgres credentials
* Put secrets/postgres_password into a Nomad var named secrets/postgresql.postgres_password