2022-10-27 21:28:34 +00:00
|
|
|
# module "nextcloud" {
|
|
|
|
# source = "./nextcloud"
|
|
|
|
#
|
|
|
|
# depends_on = [module.databases]
|
|
|
|
# }
|
|
|
|
|
|
|
|
module "backups" {
|
|
|
|
source = "./backups"
|
|
|
|
|
|
|
|
# In parent module
|
|
|
|
# depends_on = [module.databases]
|
|
|
|
}
|
|
|
|
|
|
|
|
module "media" {
|
|
|
|
source = "./media"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_job" "whoami" {
|
|
|
|
hcl2 {
|
|
|
|
enabled = true
|
|
|
|
vars = {
|
|
|
|
"count" = 1,
|
|
|
|
# "count" = "${2 * length(data.consul_service.nomad.service)}",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
jobspec = file("${path.module}/whoami.nomad")
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "nomad_job" "ipdvr" {
|
|
|
|
jobspec = file("${path.module}/ip-dvr.nomad")
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "consul_config_entry" "nzbget_intents" {
|
|
|
|
depends_on = [nomad_job.ipdvr]
|
|
|
|
|
|
|
|
name = "nzbget"
|
|
|
|
kind = "service-intentions"
|
|
|
|
|
|
|
|
config_json = jsonencode({
|
|
|
|
Sources = [
|
|
|
|
{
|
|
|
|
Action = "allow"
|
|
|
|
Name = "sonarr"
|
|
|
|
Precedence = 9
|
|
|
|
Type = "consul"
|
|
|
|
},
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-11-15 17:02:57 +00:00
|
|
|
module "minitor" {
|
|
|
|
source = "./service"
|
2022-11-10 19:15:43 +00:00
|
|
|
|
2022-11-15 17:02:57 +00:00
|
|
|
name = "minitor"
|
|
|
|
args = ["-metrics", "-config=$${NOMAD_TASK_DIR}/config.yml"]
|
|
|
|
image = "iamthefij/minitor-go:1.1"
|
|
|
|
service_port = 8080
|
|
|
|
metrics_port_name = "main"
|
|
|
|
use_vault = true
|
2022-11-11 21:34:08 +00:00
|
|
|
|
2022-11-15 17:02:57 +00:00
|
|
|
templates = [
|
|
|
|
{
|
|
|
|
data = <<EOF
|
|
|
|
{{ with secret "kv/data/mailgun_api" -}}
|
|
|
|
MAILGUN_API_KEY={{ .Data.data.key }}
|
|
|
|
{{ end -}}
|
|
|
|
EOF
|
|
|
|
dest = "env"
|
|
|
|
dest_prefix = "$${NOMAD_SECRETS_DIR}/"
|
|
|
|
env = true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
data = file("${path.module}/minitor-config.yml")
|
|
|
|
dest = "config.yml"
|
|
|
|
mount = false
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
2022-11-11 21:34:08 +00:00
|
|
|
|
|
|
|
module "photoprism_module" {
|
|
|
|
source = "./service"
|
|
|
|
|
|
|
|
name = "photoprism"
|
|
|
|
image = "photoprism/photoprism:latest"
|
|
|
|
ingress = true
|
|
|
|
service_port = 2342
|
|
|
|
sticky_disk = true
|
|
|
|
healthcheck_path = "/library/login"
|
|
|
|
env = {
|
2022-11-12 00:21:47 +00:00
|
|
|
# UI
|
2022-11-11 21:34:08 +00:00
|
|
|
PHOTOPRISM_SITE_CAPTION = "AI-Powered Photos App"
|
|
|
|
PHOTOPRISM_SITE_DESCRIPTION = "Fijolek home photos"
|
|
|
|
PHOTOPRISM_SITE_TITLE = "PhotoPrism"
|
2022-11-15 16:59:43 +00:00
|
|
|
PHOTOPRISM_SITE_URL = "https://photoprism.thefij.rocks/"
|
2022-11-11 21:34:08 +00:00
|
|
|
PHOTOPRISM_SPONSOR = "true"
|
2022-11-12 00:21:47 +00:00
|
|
|
# Worker config
|
|
|
|
PHOTOPRISM_WORKERS = 2
|
2022-11-11 21:34:08 +00:00
|
|
|
# Paths
|
|
|
|
PHOTOPRISM_ORIGINALS_PATH = "/photoprism-media/Library"
|
|
|
|
PHOTOPRISM_IMPORT_PATH = "/photoprism-media/Import"
|
|
|
|
PHOTOPRISM_STORAGE_PATH = "$${NOMAD_TASK_DIR}/storage" # Storage PATH for generated files like cache and index
|
|
|
|
# Unix permissions
|
|
|
|
PHOTOPRISM_UID = 500
|
|
|
|
PHOTOPRISM_GID = 100
|
|
|
|
PHOTOPRISM_UMASK = 0000
|
|
|
|
}
|
|
|
|
resources = {
|
2022-11-12 00:21:47 +00:00
|
|
|
cpu = 1000
|
|
|
|
memory = 2000
|
|
|
|
# memory_max = 2000
|
2022-11-11 21:34:08 +00:00
|
|
|
}
|
|
|
|
use_mysql = true
|
|
|
|
use_vault = true
|
|
|
|
host_volumes = [
|
|
|
|
{
|
|
|
|
name = "photoprism-media"
|
|
|
|
dest = "/photoprism-media"
|
|
|
|
read_only = false
|
|
|
|
},
|
|
|
|
]
|
|
|
|
mysql_bootstrap = {
|
|
|
|
vault_key = "kv/data/photoprism"
|
2022-11-10 19:15:43 +00:00
|
|
|
}
|
2022-11-11 21:34:08 +00:00
|
|
|
templates = [
|
|
|
|
{
|
|
|
|
data = <<EOF
|
|
|
|
{{ with secret "kv/data/photoprism" -}}
|
|
|
|
PHOTOPRISM_ADMIN_USER={{ .Data.data.admin_user }}
|
|
|
|
PHOTOPRISM_ADMIN_PASSWORD={{ .Data.data.admin_password }}
|
|
|
|
PHOTOPRISM_DATABASE_DRIVER=mysql
|
|
|
|
PHOTOPRISM_DATABASE_NAME={{ .Data.data.db_name }}
|
|
|
|
PHOTOPRISM_DATABASE_USER={{ .Data.data.db_user }}
|
|
|
|
PHOTOPRISM_DATABASE_PASSWORD={{ .Data.data.db_pass }}
|
|
|
|
PHOTOPRISM_DATABASE_SERVER="{{ env "NOMAD_UPSTREAM_ADDR_mysql_server" }}"
|
|
|
|
{{ end -}}
|
|
|
|
EOF
|
|
|
|
dest_prefix = "$${NOMAD_SECRETS_DIR}/"
|
|
|
|
dest = "env"
|
|
|
|
env = true
|
|
|
|
mount = false
|
|
|
|
},
|
|
|
|
]
|
2022-11-10 19:15:43 +00:00
|
|
|
}
|