module "open-webui" {
  source = "../../modules/apps/open-webui"

  persistent_folder = local.persistent_folder
  fqdn              = local.open_webui_fqdn
  ollama_proxy      = local.ollama_proxy
  tag               = "0.6-slim"
}

module "samba" {
  source = "../../modules/apps/samba"

  shared_folder = local.samba_shared_folder
}

module "dns" {
  source = "../../modules/apps/coredns"

  forward_dns_servers = local.dns_nameservers
  override_hosts      = local.override_hosts
  zones               = local.zones
}

module "proxy" {
  source = "../../modules/utils/proxy"

  services = local.proxy_services
  streams  = local.streams
}


module "nextcloud" {
  source = "../../modules/apps/nextcloud"

  fqdn                       = local.nextcloud_fqdn
  persistent_folder          = local.persistent_folder
  app_config                 = local.nextcloud_config
  db_credentials_are_secrets = true

  tls_enabled = true
  issuer      = local.internal_issuer
}

module "comfyui_proxy" {
  source = "../../modules/utils/wol_proxy"

  upstream   = local.comfyui_proxy
  proxy_port = local.comfyui_proxy.port
  namespace  = "comfyui"
}

module "prometheus" {
  source = "../../modules/utils/prometheus"

  persistent_folder = "${local.persistent_folder}/monitoring"
  config            = file("${path.module}/resources/prometheus.yml")
}

module "grafana" {
  source = "../../modules/apps/grafana"

  persistent_folder = "${local.persistent_folder}/monitoring"
  fqdn              = local.grafana_fqdn
}
