database DNS entry in consul

This commit is contained in:
vincent 2023-11-01 08:42:04 +01:00
parent 8718bfe051
commit 4cd583622b
18 changed files with 35 additions and 18 deletions

View File

@ -18,3 +18,6 @@ postgresql_databases:
owner: vikunja owner: vikunja
- name: ghostfolio - name: ghostfolio
owner: ghostfolio owner: ghostfolio
postgres_consul_service: true
postgres_consul_service_name: db

View File

@ -0,0 +1 @@
postgres_consul_tag: "active"

View File

@ -0,0 +1 @@
postgres_consul_tag: "standby"

View File

@ -4,10 +4,16 @@ gerard
[dhcp] [dhcp]
gerard gerard
[database] [database_active]
oscar
bleys bleys
[database_standby]
oscar
[database:children]
database_active
database_standby
[rsyncd] [rsyncd]
oscar oscar
bleys bleys

View File

@ -1,9 +1,15 @@
[DNS] [DNS]
oscar-dev oscar-dev
[database] [database_active]
oscar-dev oscar-dev
[database_standby]
[database:children]
database_active
database_standby
[wireguard:children] [wireguard:children]
staging staging

View File

@ -12,7 +12,7 @@ job "backup-postgress" {
value = "amd64" value = "amd64"
} }
periodic { periodic {
cron = "0 3 * * *" crons = ["0 3 * * *"]
prohibit_overlap = true prohibit_overlap = true
} }
group "backup-postgress" { group "backup-postgress" {
@ -38,7 +38,7 @@ job "backup-postgress" {
{{ with secret "secrets/data/database/dump"}} {{ with secret "secrets/data/database/dump"}}
PGUSER = "dump" PGUSER = "dump"
PGPASSWORD = "{{ .Data.data.password }}" PGPASSWORD = "{{ .Data.data.password }}"
PGHOST = "db1.ducamps.win" PGHOST = "active.db.service.consul"
{{end}} {{end}}
EOH EOH
destination = "secrets/secrets.env" destination = "secrets/secrets.env"

View File

@ -64,7 +64,7 @@ global:
database: database:
{{ with secret "secrets/data/database/dendrite"}} {{ 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}} {{end}}
max_open_conns: 100 max_open_conns: 100

View File

@ -63,7 +63,7 @@ job "nextcloud" {
NEXTCLOUD_ADMIN_USER="vincent" NEXTCLOUD_ADMIN_USER="vincent"
NEXTCLOUD_ADMIN_PASSWORD="{{ .Data.data.ADMIN_PASSWORD }}" NEXTCLOUD_ADMIN_PASSWORD="{{ .Data.data.ADMIN_PASSWORD }}"
NEXTCLOUD_TRUSTED_DOMAINS="file.ducamps.win" NEXTCLOUD_TRUSTED_DOMAINS="file.ducamps.win"
POSTGRES_HOST="db1.ducamps.win" POSTGRES_HOST="active.db.service.consul"
{{end}} {{end}}
EOH EOH
destination = "secrets/nextcloud.env" destination = "secrets/nextcloud.env"

View File

@ -56,7 +56,7 @@ job "wikijs" {
data= <<EOH data= <<EOH
{{ with secret "secrets/data/database/wikijs"}} {{ with secret "secrets/data/database/wikijs"}}
DB_TYPE="postgres" DB_TYPE="postgres"
DB_HOST="db1.ducamps.win" DB_HOST="active.db.service.consul"
DB_PORT="5432" DB_PORT="5432"
DB_USER="wikijs" DB_USER="wikijs"
DB_PASS="{{.Data.data.password}}" DB_PASS="{{.Data.data.password}}"

View File

@ -68,7 +68,7 @@ job "drone" {
{{end}} {{end}}
{{ with secret "secrets/data/database/droneci"}} {{ with secret "secrets/data/database/droneci"}}
DRONE_DATABASE_DATASOURCE="postgres://drone:{{ .Data.data.password }}@db1.ducamps.win:5432/drone?sslmode=disable" DRONE_DATABASE_DATASOURCE="postgres://drone:{{ .Data.data.password }}@active.db.service.consul:5432/drone?sslmode=disable"
{{end}} {{end}}
EOH EOH
destination = "secrets/drone.env" destination = "secrets/drone.env"

View File

@ -69,7 +69,7 @@ job "ghostfolio" {
template { template {
data= <<EOH data= <<EOH
{{ with secret "secrets/data/database/ghostfolio"}} {{ with secret "secrets/data/database/ghostfolio"}}
DATABASE_URL = postgresql://ghostfolio:{{.Data.data.password}}@db1.ducamps.win:5432/ghostfolio?connect_timeout=300&sslmode=prefer DATABASE_URL = postgresql://ghostfolio:{{.Data.data.password}}@active.db.service.consul/ghostfolio?connect_timeout=300&sslmode=prefer
{{end}} {{end}}
{{ with secret "secrets/data/nomad/ghostfolio"}} {{ with secret "secrets/data/nomad/ghostfolio"}}
ACCESS_TOKEN_SALT = {{.Data.data.token}} ACCESS_TOKEN_SALT = {{.Data.data.token}}

View File

@ -74,7 +74,7 @@ job "git" {
GITEA__server__SSH_LISTEN_PORT = "2222" GITEA__server__SSH_LISTEN_PORT = "2222"
GITEA__server__START_SSH_SERVER = "false" GITEA__server__START_SSH_SERVER = "false"
GITEA__database__DB_TYPE = "postgres" GITEA__database__DB_TYPE = "postgres"
GITEA__database__HOST = "db1.ducamps.win" GITEA__database__HOST = "active.db.service.consul"
GITEA__database__NAME = "gitea" GITEA__database__NAME = "gitea"
GITEA__database__USER = "gitea" GITEA__database__USER = "gitea"
GITEA__service__DISABLE_REGISTRATION = "true" GITEA__service__DISABLE_REGISTRATION = "true"

View File

@ -75,7 +75,7 @@ job "paperless-ng" {
} }
env { env {
PAPERLESS_REDIS = "redis://${NOMAD_ADDR_redis}" PAPERLESS_REDIS = "redis://${NOMAD_ADDR_redis}"
PAPERLESS_DBHOST = "db1.ducamps.win" PAPERLESS_DBHOST = "active.db.service.consul"
PAPERLESS_DBNAME = "paperless" PAPERLESS_DBNAME = "paperless"
PAPERLESS_DBUSER = "paperless" PAPERLESS_DBUSER = "paperless"
PAPERLESS_OCR_LANGUAGE = "fra" PAPERLESS_OCR_LANGUAGE = "fra"

View File

@ -12,7 +12,7 @@ job "seedboxsync" {
value = "amd64" value = "amd64"
} }
periodic { periodic {
cron = "0,30 * * * *" crons = ["0,30 * * * *"]
prohibit_overlap = true prohibit_overlap = true
} }
group "seedboxsync" { group "seedboxsync" {

View File

@ -114,7 +114,7 @@ http {
template { template {
data = <<EOH data = <<EOH
{{ with secret "secrets/data/database/supysonic"}} {{ with secret "secrets/data/database/supysonic"}}
SUPYSONIC_DB_URI = "postgres://supysonic:{{ .Data.data.password}}@db1.ducamps.win/supysonic" SUPYSONIC_DB_URI = "postgres://supysonic:{{ .Data.data.password}}@active.db.service.consul/supysonic"
{{end}} {{end}}
{{ with secret "secrets/data/nomad/supysonic"}} {{ with secret "secrets/data/nomad/supysonic"}}
SUPYSONIC_LDAP_BIND_DN = "{{ .Data.data.serviceAccountName }}" SUPYSONIC_LDAP_BIND_DN = "{{ .Data.data.serviceAccountName }}"

View File

@ -60,7 +60,7 @@ job "tt-rss" {
} }
env { env {
TTRSS_DB-TYPE = "pgsql" TTRSS_DB-TYPE = "pgsql"
TTRSS_DB_HOST = "db1.ducamps.win" TTRSS_DB_HOST = "active.db.serice.consul"
TTRSS_DB_NAME = "ttrss" TTRSS_DB_NAME = "ttrss"
TTRSS_DB_USER = "ttrss" TTRSS_DB_USER = "ttrss"
TTRSS_SELF_URL_PATH = "https://www.ducamps.win/tt-rss" TTRSS_SELF_URL_PATH = "https://www.ducamps.win/tt-rss"
@ -92,7 +92,7 @@ job "tt-rss" {
} }
env { env {
TTRSS_DB-TYPE = "pgsql" TTRSS_DB-TYPE = "pgsql"
TTRSS_DB_HOST = "db1.ducamps.win" TTRSS_DB_HOST = "active.db.service.consul"
TTRSS_DB_NAME = "ttrss" TTRSS_DB_NAME = "ttrss"
TTRSS_DB_USER = "ttrss" TTRSS_DB_USER = "ttrss"
TTRSS_SELF_URL_PATH = "https://www.ducamps.win/tt-rss" TTRSS_SELF_URL_PATH = "https://www.ducamps.win/tt-rss"

View File

@ -67,7 +67,7 @@ job "vaultwarden" {
template { template {
data = <<EOH data = <<EOH
{{ with secret "secrets/data/database/vaultwarden"}} {{ with secret "secrets/data/database/vaultwarden"}}
DATABASE_URL=postgresql://vaultwarden:{{ .Data.data.password }}@db1.ducamps.win/vaultwarden DATABASE_URL=postgresql://vaultwarden:{{ .Data.data.password }}@active.db.service.consul/vaultwarden
{{end}} {{end}}
EOH EOH
destination = "secrets/vaultwarden.env" destination = "secrets/vaultwarden.env"

View File

@ -39,7 +39,7 @@ job "vikunja" {
ports = ["api"] ports = ["api"]
} }
env { env {
VIKUNJA_DATABASE_HOST = "db1.ducamps.win" VIKUNJA_DATABASE_HOST = "active.db.service.consul"
VIKUNJA_DATABASE_TYPE = "postgres" VIKUNJA_DATABASE_TYPE = "postgres"
VIKUNJA_DATABASE_USER = "vikunja" VIKUNJA_DATABASE_USER = "vikunja"
VIKUNJA_DATABASE_DATABASE = "vikunja" VIKUNJA_DATABASE_DATABASE = "vikunja"