Add calibre

This commit is contained in:
2025-08-12 16:24:42 +00:00
parent 6b0806bd46
commit 20334ad163
4 changed files with 105 additions and 0 deletions
@@ -0,0 +1,62 @@
terraform {
required_providers {
dotenv = {
source = "germanbrew/dotenv"
}
}
}
locals {
container_name = "calibre"
calibre_image = "docker.io/crocodilestick/calibre-web-automated"
calibre_tag = var.image_tag
calibre_internal_port = 8083
calibre_volumes = [
{
host_path = "${var.volume_path}/${local.container_name}/config"
container_path = "/config"
read_only = false
},{
host_path = "${var.volume_path}/${local.container_name}/book-ingest"
container_path = "/cwa-book-ingest"
read_only = false
},{
host_path = "${var.volume_path}/${local.container_name}/Calibre Library"
container_path = "/calibre-library"
read_only = false
},{
host_path = "${var.volume_path}/${local.container_name}/plugins"
container_path = "/config/.config/calibre/plugins"
read_only = false
},
]
calibre_env_vars = {
PUID = var.user_id
PGID = var.group_id
TZ = var.timezone
}
}
module "calibre" {
source = "../../10-generic/docker-service"
container_name = local.container_name
image = local.calibre_image
tag = local.calibre_tag
volumes = local.calibre_volumes
env_vars = local.calibre_env_vars
networks = concat(var.networks)
restart_policy = "always"
}
output "service_definition" {
description = "General service definition with optional ingress configuration"
value = {
name = local.container_name
primary_port = local.calibre_internal_port
endpoint = "http://${local.container_name}:${local.calibre_internal_port}"
subdomains = ["books"]
is_guarded = true
}
}
@@ -0,0 +1,34 @@
variable "image_tag" {
description = "The tag for the JellyFin 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"
}
+8
View File
@@ -30,4 +30,12 @@ module "jellyfin" {
networks = [
"blue",
]
}
module "calibre" {
source = "${local.module_dir}/20-services-entertainment/calibre-service"
volume_path = "${local.root_volume}/calibre"
networks = [
"blue",
]
}
+1
View File
@@ -2,6 +2,7 @@ output "service_definitions" {
description = "Service definitions for all services"
value = [
module.jellyfin.service_definition,
module.calibre.service_definition,
module.authentik.service_definition,
]
}