From 46dd041c0b43acbe4a64908730a302e260d7baac Mon Sep 17 00:00:00 2001 From: David Thorpe Date: Tue, 2 Apr 2024 09:41:43 +0200 Subject: [PATCH] Updated postgresql --- README.md | 4 ++++ _examples/postgresql.tf | 3 ++- postgresql/nomad/postgresql.hcl | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ac1fd65..c36c7c3 100755 --- a/README.md +++ b/README.md @@ -118,6 +118,10 @@ PostgreSQL is a database server TODO: * [ ] LDAP integration + * [ ] Add TLS support + * [ ] Add replication support + * [ ] Use volume instead when the data does not have '/' as prefix + * [ ] Add users, databases and roles support on initialization ## seaweedfs diff --git a/_examples/postgresql.tf b/_examples/postgresql.tf index 0485f6a..2d30e9a 100755 --- a/_examples/postgresql.tf +++ b/_examples/postgresql.tf @@ -6,11 +6,12 @@ module "postgresql" { dc = local.datacenter // Nomad datacenter for the cluster namespace = local.namespace // Nomad namespace for the cluster hosts = ["server1"] // Host constraint for the job + root_user = local.POSTGRESQL_ROOT_USER // User for the 'root' user (default: postgres) root_password = local.POSTGRESQL_ROOT_PASSWORD // Password for the 'root' user // Optional parameters enabled = true // If false, no-op - port = 5432 // Port to expose + port = 5432 // Port to expose (optional) database = "default" // Default database name data = "/var/lib/postgresql" // Persistence directory } diff --git a/postgresql/nomad/postgresql.hcl b/postgresql/nomad/postgresql.hcl index 54052e5..907d5be 100755 --- a/postgresql/nomad/postgresql.hcl +++ b/postgresql/nomad/postgresql.hcl @@ -89,7 +89,7 @@ variable "database" { // LOCALS locals { - data_path = var.data == "" ? "${NOMAD_ALLOC_DIR}/data" : "/var/lib/postgresql/data" + data_path = var.data == "" ? "${NOMAD_ALLOC_DIR}/data" : "/var/lib/postgresql/data/pgdata" } /////////////////////////////////////////////////////////////////////////////// @@ -147,7 +147,7 @@ job "postgresql" { ports = ["postgresql"] dns_servers = var.service_dns volumes = compact([ - var.data == "" ? "" : format("%s:/var/lib/postgresql", var.data) + var.data == "" ? "" : format("%s:/var/lib/postgresql/data", var.data) ]) }