From 88f171425b51ea3acbd24b6c115c45dc1487ce34 Mon Sep 17 00:00:00 2001 From: Yuris Cakranegara Date: Sun, 8 Jun 2025 19:22:05 +1000 Subject: [PATCH] feat: add searxng --- modules/20-services-apps/searxng/main.tf | 59 ++++++++++++++++++++++++ services/main.tf | 6 +++ services/outputs.tf | 3 +- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 modules/20-services-apps/searxng/main.tf diff --git a/modules/20-services-apps/searxng/main.tf b/modules/20-services-apps/searxng/main.tf new file mode 100644 index 0000000..989cc11 --- /dev/null +++ b/modules/20-services-apps/searxng/main.tf @@ -0,0 +1,59 @@ +terraform { + required_providers { + dotenv = { + source = "germanbrew/dotenv" + } + } +} + +variable "image_tag" { + description = "The tag for the searxng container image" + type = string + default = "latest" +} + +variable "volume_path" { + description = "Base directory for volumes" + type = string +} + +variable "networks" { + description = "List of networks to which the container should be attached" + type = list(string) + default = [] +} + +locals { + container_name = "searxng" + image = "searxng/searxng" + tag = var.image_tag != "" ? var.image_tag : "latest" + monitoring = true + internal_port = 8080 + volumes = [ + { + host_path = "${var.volume_path}/config" + container_path = "/etc/searxng" + read_only = false + } + ] +} + +module "searxng" { + source = "../../10-services-generic/docker-service" + container_name = local.container_name + image = local.image + tag = local.tag + volumes = local.volumes + networks = var.networks + monitoring = local.monitoring +} + +output "service_definition" { + description = "Service definition with ingress configuration" + value = { + name = local.container_name + primary_port = local.internal_port + endpoint = "http://${local.container_name}:${local.internal_port}" + subdomains = ["search"] + } +} diff --git a/services/main.tf b/services/main.tf index ddac48b..d8cea4d 100644 --- a/services/main.tf +++ b/services/main.tf @@ -58,3 +58,9 @@ module "n8n" { volume_path = "${local.volume_host}/n8n" networks = [module.homelab_docker_network.name] } + +module "searxng" { + source = "${local.module_dir}/20-services-apps/searxng" + volume_path = "${local.volume_host}/searxng" + networks = [module.homelab_docker_network.name] +} diff --git a/services/outputs.tf b/services/outputs.tf index 85ddcd6..30f0a90 100644 --- a/services/outputs.tf +++ b/services/outputs.tf @@ -10,7 +10,8 @@ output "service_definitions" { module.ntfy.service_definition, module.pterodactyl_wings.service_definition, module.pterodactyl_panel.service_definition, - module.n8n.service_definition + module.n8n.service_definition, + module.searxng.service_definition ] }