From e91d1730f696359be088e1f0558169775226a4e1 Mon Sep 17 00:00:00 2001 From: Yuris Cakranegara Date: Sat, 7 Jun 2025 16:31:27 +1000 Subject: [PATCH] feat: add ntfy --- modules/20-services-apps/ntfy/main.tf | 56 +++++++++++++++++++++++++++ services/main.tf | 7 ++++ services/outputs.tf | 3 +- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 modules/20-services-apps/ntfy/main.tf diff --git a/modules/20-services-apps/ntfy/main.tf b/modules/20-services-apps/ntfy/main.tf new file mode 100644 index 0000000..886dec5 --- /dev/null +++ b/modules/20-services-apps/ntfy/main.tf @@ -0,0 +1,56 @@ +variable "image_tag" { + description = "Tag of the ntfy image to use" + type = string + default = "latest" +} + +variable "volume_path" { + description = "Host path for ntfy data volume" + type = string +} + +variable "networks" { + description = "List of networks to which the container should be attached" + type = list(string) +} + +locals { + container_name = "ntfy" + image = "binwiederhier/ntfy" + image_tag = var.image_tag != "" ? var.image_tag : "latest" + monitoring = true + exposed_port = 80 + subdomains = ["ntfy"] + default_volumes = [ + { + container_path = "/etc/ntfy" + host_path = "${var.volume_path}/app" + read_only = false + }, + { + container_path = "/var/cache/ntfy" + host_path = "${var.volume_path}/cache" + read_only = false + } + ] +} + +module "ntfy" { + source = "../../10-services-generic/docker-service" + container_name = local.container_name + image = local.image + tag = local.image_tag + volumes = local.default_volumes + networks = var.networks + monitoring = local.monitoring +} + +output "service_definition" { + description = "General service definition with optional ingress configuration" + value = { + name = local.container_name + primary_port = local.exposed_port + endpoint = "http://${local.container_name}:${local.exposed_port}" + subdomains = local.subdomains + } +} \ No newline at end of file diff --git a/services/main.tf b/services/main.tf index 660f84a..70e1580 100644 --- a/services/main.tf +++ b/services/main.tf @@ -28,3 +28,10 @@ module "emulatorjs" { source = "${local.module_dir}/20-services-apps/emulatorjs" volume_path = "${local.volume_host}/emulatorjs" } + +module "ntfy" { + source = "${local.module_dir}/20-services-apps/ntfy" + volume_path = "${local.volume_host}/ntfy" + networks = [module.homelab_docker_network.name] +} + \ No newline at end of file diff --git a/services/outputs.tf b/services/outputs.tf index 5673d3a..5c55192 100644 --- a/services/outputs.tf +++ b/services/outputs.tf @@ -5,7 +5,8 @@ output "service_definitions" { description = "Service definitions for all services" value = [ module.actualbudget.service_definition, - module.emulatorjs.service_definition + module.emulatorjs.service_definition, + module.ntfy.service_definition ] }