From 520d7c56b9a9ec759ce8352985e722c987539b4a Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 23 Jun 2022 09:48:01 -0700 Subject: [PATCH] Move databases to a single module --- nomad/{mysql => databases}/adminer.nomad | 0 nomad/{mysql => databases}/mysql.nomad | 0 nomad/{mysql => databases}/mysql.tf | 6 ++++++ nomad/{redis => databases}/redis.nomad | 0 nomad/{redis => databases}/redis.tf | 10 +++++++++- nomad/{redis => databases}/rediscommander.nomad | 0 nomad/services.tf | 14 +++++--------- 7 files changed, 20 insertions(+), 10 deletions(-) rename nomad/{mysql => databases}/adminer.nomad (100%) rename nomad/{mysql => databases}/mysql.nomad (100%) rename nomad/{mysql => databases}/mysql.tf (86%) rename nomad/{redis => databases}/redis.nomad (100%) rename nomad/{redis => databases}/redis.tf (75%) rename nomad/{redis => databases}/rediscommander.nomad (100%) diff --git a/nomad/mysql/adminer.nomad b/nomad/databases/adminer.nomad similarity index 100% rename from nomad/mysql/adminer.nomad rename to nomad/databases/adminer.nomad diff --git a/nomad/mysql/mysql.nomad b/nomad/databases/mysql.nomad similarity index 100% rename from nomad/mysql/mysql.nomad rename to nomad/databases/mysql.nomad diff --git a/nomad/mysql/mysql.tf b/nomad/databases/mysql.tf similarity index 86% rename from nomad/mysql/mysql.tf rename to nomad/databases/mysql.tf index 45aa6f9..1fe86c9 100644 --- a/nomad/mysql/mysql.tf +++ b/nomad/databases/mysql.tf @@ -36,6 +36,12 @@ resource "consul_config_entry" "mysql_intents" { Precedence = 9 Type = "consul" }, + { + Action = "allow" + Name = "backups" + Precedence = 9 + Type = "consul" + }, ] }) } diff --git a/nomad/redis/redis.nomad b/nomad/databases/redis.nomad similarity index 100% rename from nomad/redis/redis.nomad rename to nomad/databases/redis.nomad diff --git a/nomad/redis/redis.tf b/nomad/databases/redis.tf similarity index 75% rename from nomad/redis/redis.tf rename to nomad/databases/redis.tf index 80f82d0..07094f1 100644 --- a/nomad/redis/redis.tf +++ b/nomad/databases/redis.tf @@ -4,6 +4,9 @@ resource "nomad_job" "redis" { } jobspec = file("${path.module}/redis.nomad") + + # Block until deployed as there are servics dependent on this one + detach = false } resource "nomad_job" "rediscommander" { @@ -14,7 +17,6 @@ resource "nomad_job" "rediscommander" { jobspec = file("${path.module}/rediscommander.nomad") } -# NOTE: This may need to be moved to after the services are created resource "consul_config_entry" "redis_intents" { name = "redis" kind = "service-intentions" @@ -33,6 +35,12 @@ resource "consul_config_entry" "redis_intents" { Precedence = 9 Type = "consul" }, + { + Action = "allow" + Name = "authelia" + Precedence = 9 + Type = "consul" + }, ] }) } diff --git a/nomad/redis/rediscommander.nomad b/nomad/databases/rediscommander.nomad similarity index 100% rename from nomad/redis/rediscommander.nomad rename to nomad/databases/rediscommander.nomad diff --git a/nomad/services.tf b/nomad/services.tf index 2a439cb..1cb9d8b 100644 --- a/nomad/services.tf +++ b/nomad/services.tf @@ -1,16 +1,12 @@ -module "mysql-server" { - source = "./mysql" -} - -module "redis" { - source = "./redis" +module "databases" { + source = "./databases" } module "blocky" { source = "./blocky" base_hostname = var.base_hostname - depends_on = [module.redis] + depends_on = [module.databases] } module "traefik" { @@ -29,13 +25,13 @@ module "metrics" { module "nextcloud" { source = "./nextcloud" - depends_on = [module.mysql-server] + depends_on = [module.databases] } module "backups" { source = "./backups" - depends_on = [module.mysql-server] + depends_on = [module.databases] } module "media" {