From f969b1728e0a91c635da2b0d934aff2fcdc17ae3 Mon Sep 17 00:00:00 2001 From: Jeroen Vijgen Date: Wed, 15 Apr 2026 17:38:16 +0000 Subject: [PATCH] FEATURE: Add ECO service for friends --- .../eco-service/main.tf | 68 +++++++++++++++++++ .../eco-service/variable.tf | 34 ++++++++++ services/main.tf | 6 ++ services/outputs.tf | 1 + 4 files changed, 109 insertions(+) create mode 100644 modules/20-services-entertainment/eco-service/main.tf create mode 100644 modules/20-services-entertainment/eco-service/variable.tf diff --git a/modules/20-services-entertainment/eco-service/main.tf b/modules/20-services-entertainment/eco-service/main.tf new file mode 100644 index 0000000..cd91b45 --- /dev/null +++ b/modules/20-services-entertainment/eco-service/main.tf @@ -0,0 +1,68 @@ +terraform { + required_providers { + dotenv = { + source = "germanbrew/dotenv" + } + } +} + +locals { + container_name = "eco" + eco_image = "docker.io/strangeloopgames/eco-game-server" + eco_tag = var.image_tag + env_file = "${path.module}/.env" + eco_internal_port = 3000 +} + +module "eco" { + source = "../../10-generic/docker-service" + container_name = local.container_name + image = local.eco_image + tag = local.eco_internal_port + networks = var.networks + restart_policy = "always" + ports = [ + { + internal = 3000 + external = 3000 + protocol = "udp" + }, + { + internal = 3001 + external = 3001 + protocol = "tcp" + } + ] + volumes = [ + { + host_path = "${var.volume_path}/${local.container_name}/config" + container_path = "/app/Configs/" + read_only = false + }, + { + host_path = "${var.volume_path}/${local.container_name}/data" + container_path = "/app/Storage/" + read_only = false + }, + { + host_path = "${var.volume_path}/${local.container_name}/mods" + container_path = "/app/Mods/" + read_only = false + }, + ] + env_vars = { + MAXPLAYERS = provider::dotenv::get_by_key("MAXPLAYERS", local.env_file) + PUID = var.user_id + PGID = var.group_id + } +} + + +output "service_definition" { + description = "General service definition with optional ingress configuration" + value = { + name = local.container_name + primary_port = local.eco_internal_port + endpoint = "http://${local.container_name}:${local.eco_internal_port}" + } +} diff --git a/modules/20-services-entertainment/eco-service/variable.tf b/modules/20-services-entertainment/eco-service/variable.tf new file mode 100644 index 0000000..729e278 --- /dev/null +++ b/modules/20-services-entertainment/eco-service/variable.tf @@ -0,0 +1,34 @@ +variable "image_tag" { + description = "The tag for the Eco container image. Default: latest" + 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 = [] +} + +variable "user_id" { + description = "User ID for container permissions" + type = string + default = "1000" +} + +variable "group_id" { + description = "Group ID for container permissions" + type = string + default = "1000" +} + +variable "timezone" { + description = "Timezone for the container" + type = string + default = "Europe/Helsinki" +} diff --git a/services/main.tf b/services/main.tf index 03db117..6c757bf 100644 --- a/services/main.tf +++ b/services/main.tf @@ -31,6 +31,12 @@ module "satisfactory" { networks = [module.infrastructure_int.name] } +module "eco" { + source = "${local.module_dir}/20-services-entertainment/eco-service" + volume_path = "${local.root_volume}/eco" + networks = [module.infrastructure_int.name] +} + module "authentik" { source = "${local.module_dir}/30-services-software/authentik-service" volume_path = "${local.root_volume}/authentik" diff --git a/services/outputs.tf b/services/outputs.tf index 62171e5..218c173 100644 --- a/services/outputs.tf +++ b/services/outputs.tf @@ -3,6 +3,7 @@ output "service_definitions" { value = [ module.jellyfin.service_definition, module.satisfactory.service_definition, + module.eco.service_definition, module.authentik.service_definition, module.traccar.service_definition, module.tandoor.service_definition,