diff --git a/ansible/group_vars/database/database b/ansible/group_vars/database/database index 3c0540b..74b49ca 100644 --- a/ansible/group_vars/database/database +++ b/ansible/group_vars/database/database @@ -18,3 +18,6 @@ postgresql_databases: owner: vikunja - name: ghostfolio owner: ghostfolio + +postgres_consul_service: true +postgres_consul_service_name: db diff --git a/ansible/group_vars/database_active b/ansible/group_vars/database_active new file mode 100644 index 0000000..723e354 --- /dev/null +++ b/ansible/group_vars/database_active @@ -0,0 +1 @@ +postgres_consul_tag: "active" diff --git a/ansible/group_vars/database_standby b/ansible/group_vars/database_standby new file mode 100644 index 0000000..0a2c263 --- /dev/null +++ b/ansible/group_vars/database_standby @@ -0,0 +1 @@ +postgres_consul_tag: "standby" diff --git a/ansible/production b/ansible/production index ba5847c..c1d5f0d 100644 --- a/ansible/production +++ b/ansible/production @@ -4,10 +4,16 @@ gerard [dhcp] gerard -[database] -oscar +[database_active] bleys +[database_standby] +oscar + +[database:children] +database_active +database_standby + [rsyncd] oscar bleys diff --git a/ansible/staging b/ansible/staging index ad06426..63843d3 100644 --- a/ansible/staging +++ b/ansible/staging @@ -1,9 +1,15 @@ [DNS] oscar-dev -[database] +[database_active] oscar-dev +[database_standby] + +[database:children] +database_active +database_standby + [wireguard:children] staging diff --git a/nomad-job/backup-postgress.nomad b/nomad-job/backup-postgress.nomad index 3c4b0ec..cf3e93f 100644 --- a/nomad-job/backup-postgress.nomad +++ b/nomad-job/backup-postgress.nomad @@ -12,7 +12,7 @@ job "backup-postgress" { value = "amd64" } periodic { - cron = "0 3 * * *" + crons = ["0 3 * * *"] prohibit_overlap = true } group "backup-postgress" { @@ -38,7 +38,7 @@ job "backup-postgress" { {{ with secret "secrets/data/database/dump"}} PGUSER = "dump" PGPASSWORD = "{{ .Data.data.password }}" - PGHOST = "db1.ducamps.win" + PGHOST = "active.db.service.consul" {{end}} EOH destination = "secrets/secrets.env" diff --git a/nomad-job/decom/matrix.nomad b/nomad-job/decom/matrix.nomad index 89509ac..265f9a4 100644 --- a/nomad-job/decom/matrix.nomad +++ b/nomad-job/decom/matrix.nomad @@ -64,7 +64,7 @@ global: database: {{ with secret "secrets/data/database/dendrite"}} - connection_string: postgresql://dendrite:{{.Data.data.password}}@db1.ducamps.win/dendrite?sslmode=disable + connection_string: postgresql://dendrite:{{.Data.data.password}}@active.db.service.consul/dendrite?sslmode=disable {{end}} max_open_conns: 100 diff --git a/nomad-job/decom/nextcloud.nomad b/nomad-job/decom/nextcloud.nomad index abc4def..9f0ff5a 100644 --- a/nomad-job/decom/nextcloud.nomad +++ b/nomad-job/decom/nextcloud.nomad @@ -63,7 +63,7 @@ job "nextcloud" { NEXTCLOUD_ADMIN_USER="vincent" NEXTCLOUD_ADMIN_PASSWORD="{{ .Data.data.ADMIN_PASSWORD }}" NEXTCLOUD_TRUSTED_DOMAINS="file.ducamps.win" - POSTGRES_HOST="db1.ducamps.win" + POSTGRES_HOST="active.db.service.consul" {{end}} EOH destination = "secrets/nextcloud.env" diff --git a/nomad-job/decom/wikijs.nomad b/nomad-job/decom/wikijs.nomad index 8302219..4f72732 100644 --- a/nomad-job/decom/wikijs.nomad +++ b/nomad-job/decom/wikijs.nomad @@ -56,7 +56,7 @@ job "wikijs" { data= <