multisite postgres, orient plume to correct db

This commit is contained in:
Alex 2023-05-04 16:39:25 +02:00
parent e23b523467
commit f3cd2e98b4
2 changed files with 11 additions and 4 deletions

View file

@ -12,7 +12,7 @@ ROCKET_SECRET_KEY={{ key "secrets/plume/secret_key" | trimSpace }}
POSTGRES_PASSWORD={{ key "secrets/plume/pgsql_pw" | trimSpace }} POSTGRES_PASSWORD={{ key "secrets/plume/pgsql_pw" | trimSpace }}
POSTGRES_USER=plume POSTGRES_USER=plume
POSTGRES_DB=plume POSTGRES_DB=plume
DATABASE_URL=postgres://plume:{{ key "secrets/plume/pgsql_pw" | trimSpace }}@psql-proxy.service.prod.consul:5432/plume DATABASE_URL=postgres://plume:{{ key "secrets/plume/pgsql_pw" | trimSpace }}@{{ env "meta.site" }}.psql-proxy.service.prod.consul:5432/plume
MIGRATION_DIRECTORY=migrations/postgres MIGRATION_DIRECTORY=migrations/postgres
USE_HTTPS=0 USE_HTTPS=0

View file

@ -1,5 +1,5 @@
job "postgres14" { job "postgres14" {
datacenters = ["orion"] datacenters = ["orion", "neptune", "bespin"]
type = "system" type = "system"
priority = 90 priority = 90
@ -16,6 +16,13 @@ job "postgres14" {
port "psql_port" { static = 5433 } port "psql_port" { static = 5433 }
} }
constraint {
attribute = "${attr.unique.hostname}"
operator = "set_contains_any"
# target: courgette,df-ymf,abricot (or ananas)
value = "diplotaxis,courgette,concombre,df-ymf"
}
restart { restart {
interval = "10m" interval = "10m"
attempts = 10 attempts = 10
@ -106,7 +113,7 @@ job "postgres14" {
} }
service { service {
tags = ["sql"] tags = ["sql", "${meta.site}"]
port = "psql_proxy_port" port = "psql_proxy_port"
address_mode = "host" address_mode = "host"
name = "psql-proxy" name = "psql-proxy"
@ -186,7 +193,7 @@ job "postgres14" {
} }
service { service {
tags = ["sql"] tags = ["sql", "${meta.site}"]
port = "psql_port" port = "psql_port"
address_mode = "host" address_mode = "host"
name = "psql-keeper" name = "psql-keeper"