feat: add media server
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "autoheal"
|
||||
image = "willfarrell/autoheal"
|
||||
tag = "latest"
|
||||
|
||||
autoheal_env_vars = {
|
||||
AUTOHEAL_CONTAINER_LABEL = "all"
|
||||
}
|
||||
|
||||
autoheal_volumes = [
|
||||
{
|
||||
host_path = "/var/run/docker.sock"
|
||||
container_path = "/var/run/docker.sock"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
module "autoheal" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.autoheal_volumes
|
||||
env_vars = local.autoheal_env_vars
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for autoheal"
|
||||
value = {
|
||||
name = local.container_name
|
||||
endpoint = "http://${local.container_name}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "log_level" {
|
||||
description = "Log level for flaresolverr"
|
||||
type = string
|
||||
default = "info"
|
||||
}
|
||||
|
||||
variable "log_html" {
|
||||
description = "Whether to log HTML"
|
||||
type = string
|
||||
default = "false"
|
||||
}
|
||||
|
||||
variable "captcha_solver" {
|
||||
description = "Type of CAPTCHA solver to use"
|
||||
type = string
|
||||
default = "none"
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "flaresolverr"
|
||||
image = "ghcr.io/flaresolverr/flaresolverr"
|
||||
tag = "latest"
|
||||
|
||||
flaresolverr_env_vars = {
|
||||
LOG_LEVEL = var.log_level
|
||||
LOG_HTML = var.log_html
|
||||
CAPTCHA_SOLVER = var.captcha_solver
|
||||
TZ = var.timezone
|
||||
}
|
||||
}
|
||||
|
||||
module "flaresolverr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
env_vars = local.flaresolverr_env_vars
|
||||
ports = [{
|
||||
internal = 8191
|
||||
external = 8191
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for flaresolverr"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 8191
|
||||
endpoint = "http://${local.container_name}:8191"
|
||||
}
|
||||
}
|
||||
114
modules/20-services-apps/media-server/services/jellyfin/main.tf
Normal file
114
modules/20-services-apps/media-server/services/jellyfin/main.tf
Normal file
@@ -0,0 +1,114 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Base directory for volumes"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_root" {
|
||||
description = "Root directory for media data"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "hostname" {
|
||||
description = "Hostname for the Jellyfin PublishedServerUrl"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "jellyfin"
|
||||
image = "jellyfin/jellyfin"
|
||||
tag = "latest"
|
||||
|
||||
internal_ports = [
|
||||
{
|
||||
internal = 8096
|
||||
external = 8096
|
||||
protocol = "tcp"
|
||||
},
|
||||
{
|
||||
internal = 7359
|
||||
external = 7359
|
||||
protocol = "udp"
|
||||
},
|
||||
{
|
||||
internal = 1900
|
||||
external = 1900
|
||||
protocol = "udp"
|
||||
}
|
||||
]
|
||||
|
||||
jellyfin_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/jellyfin"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
},
|
||||
{
|
||||
host_path = "${var.data_root}"
|
||||
container_path = "/data"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
jellyfin_devices = [
|
||||
"/dev/dri/:/dev/dri/"
|
||||
]
|
||||
|
||||
jellyfin_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
JELLYFIN_PublishedServerUrl = "${var.hostname}/jellyfin"
|
||||
}
|
||||
}
|
||||
|
||||
module "jellyfin" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.jellyfin_volumes
|
||||
env_vars = local.jellyfin_env_vars
|
||||
ports = local.internal_ports
|
||||
devices = local.jellyfin_devices
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for integration with networking modules"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 8096
|
||||
endpoint = "http://${local.container_name}:8096"
|
||||
subdomains = ["jellyfin"]
|
||||
publish_via = "reverse_proxy"
|
||||
proxied = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "jellyseerr"
|
||||
image = "fallenbagel/jellyseerr"
|
||||
tag = "latest"
|
||||
|
||||
jellyseerr_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/jellyseerr"
|
||||
container_path = "/app/config"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
jellyseerr_env_vars = {
|
||||
LOG_LEVEL = "debug"
|
||||
TZ = var.timezone
|
||||
}
|
||||
|
||||
jellyseerr_healthcheck = {
|
||||
test = ["CMD", "wget", "http://127.0.0.1:5055/api/v1/status", "-qO", "/dev/null"]
|
||||
interval = "30s"
|
||||
timeout = "5s"
|
||||
retries = 10
|
||||
start_period = "5s"
|
||||
}
|
||||
}
|
||||
|
||||
module "jellyseerr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.jellyseerr_volumes
|
||||
env_vars = local.jellyseerr_env_vars
|
||||
healthcheck = local.jellyseerr_healthcheck
|
||||
ports = [{
|
||||
internal = 5055
|
||||
external = 5055
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for integration with networking modules"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 5055
|
||||
endpoint = "http://${local.container_name}:5055"
|
||||
subdomains = ["requests"]
|
||||
publish_via = "reverse_proxy"
|
||||
proxied = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "prowlarr"
|
||||
image = "lscr.io/linuxserver/prowlarr"
|
||||
tag = "latest"
|
||||
|
||||
prowlarr_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/prowlarr"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
prowlarr_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
}
|
||||
|
||||
prowlarr_healthcheck = {
|
||||
test = ["CMD", "curl", "--fail", "http://127.0.0.1:9696/prowlarr/ping"]
|
||||
interval = "30s"
|
||||
timeout = "5s"
|
||||
retries = 10
|
||||
start_period = "5s"
|
||||
}
|
||||
}
|
||||
|
||||
module "prowlarr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.prowlarr_volumes
|
||||
env_vars = local.prowlarr_env_vars
|
||||
healthcheck = local.prowlarr_healthcheck
|
||||
ports = [{
|
||||
internal = 9696
|
||||
external = 9696
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for prowlarr"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 9696
|
||||
endpoint = "http://${local.container_name}:9696"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Base directory for volumes"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "download_root" {
|
||||
description = "Directory for downloads"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "qbittorrent"
|
||||
image = "lscr.io/linuxserver/qbittorrent"
|
||||
tag = "libtorrentv1"
|
||||
|
||||
qbittorrent_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/qbittorrent"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
},
|
||||
{
|
||||
host_path = var.download_root
|
||||
container_path = "/data/torrents"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
qbittorrent_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
WEBUI_PORT = "8080"
|
||||
DOCKER_MODS = "ghcr.io/gabe565/linuxserver-mod-vuetorrent"
|
||||
}
|
||||
|
||||
qbittorrent_healthcheck = {
|
||||
test = ["CMD", "curl", "--fail", "http://127.0.0.1:8080", "https://google.com"]
|
||||
interval = "30s"
|
||||
timeout = "5s"
|
||||
retries = 10
|
||||
start_period = "5s"
|
||||
}
|
||||
}
|
||||
|
||||
module "qbittorrent" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.qbittorrent_volumes
|
||||
env_vars = local.qbittorrent_env_vars
|
||||
healthcheck = local.qbittorrent_healthcheck
|
||||
ports = [{
|
||||
internal = 8080
|
||||
external = 8080
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for qbittorrent"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 8080
|
||||
endpoint = "http://${local.container_name}:8080"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Base directory for volumes"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_root" {
|
||||
description = "Root directory for media data"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "radarr"
|
||||
image = "lscr.io/linuxserver/radarr"
|
||||
tag = "latest"
|
||||
|
||||
radarr_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/radarr"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
},
|
||||
{
|
||||
host_path = var.data_root
|
||||
container_path = "/data"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
radarr_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
}
|
||||
|
||||
radarr_healthcheck = {
|
||||
test = ["CMD", "curl", "--fail", "http://127.0.0.1:7878/radarr/ping"]
|
||||
interval = "30s"
|
||||
timeout = "5s"
|
||||
retries = 10
|
||||
start_period = "5s"
|
||||
}
|
||||
}
|
||||
|
||||
module "radarr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.radarr_volumes
|
||||
env_vars = local.radarr_env_vars
|
||||
healthcheck = local.radarr_healthcheck
|
||||
ports = [{
|
||||
internal = 7878
|
||||
external = 7878
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for radarr"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 7878
|
||||
endpoint = "http://${local.container_name}:7878"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Base directory for volumes"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_root" {
|
||||
description = "Root directory for media data"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "readarr"
|
||||
image = "lscr.io/linuxserver/readarr"
|
||||
tag = "develop"
|
||||
|
||||
readarr_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/readarr"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
},
|
||||
{
|
||||
host_path = var.data_root
|
||||
container_path = "/books"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
readarr_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
}
|
||||
}
|
||||
|
||||
module "readarr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.readarr_volumes
|
||||
env_vars = local.readarr_env_vars
|
||||
ports = [{
|
||||
internal = 8787
|
||||
external = 8787
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for readarr"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 8787
|
||||
endpoint = "http://${local.container_name}:8787"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Base directory for volumes"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_root" {
|
||||
description = "Root directory for media data"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "sabnzbd"
|
||||
image = "lscr.io/linuxserver/sabnzbd"
|
||||
tag = "latest"
|
||||
|
||||
sabnzbd_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/sabnzbd/config"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
},
|
||||
{
|
||||
host_path = "${var.data_root}/usenet/downloads"
|
||||
container_path = "/downloads"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
sabnzbd_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
}
|
||||
}
|
||||
|
||||
module "sabnzbd" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.sabnzbd_volumes
|
||||
env_vars = local.sabnzbd_env_vars
|
||||
ports = [{
|
||||
internal = 8080
|
||||
external = 6789
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "unless-stopped"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for integration with networking modules"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 8080
|
||||
endpoint = "http://${local.container_name}:8080"
|
||||
subdomains = ["sabnzbd"]
|
||||
publish_via = "reverse_proxy"
|
||||
proxied = false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Base directory for volumes"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "data_root" {
|
||||
description = "Root directory for media data"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "sonarr"
|
||||
image = "lscr.io/linuxserver/sonarr"
|
||||
tag = "latest"
|
||||
|
||||
sonarr_volumes = [
|
||||
{
|
||||
host_path = "${var.volume_path}/sonarr"
|
||||
container_path = "/config"
|
||||
read_only = false
|
||||
},
|
||||
{
|
||||
host_path = var.data_root
|
||||
container_path = "/data"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
sonarr_env_vars = {
|
||||
PUID = var.user_id
|
||||
PGID = var.group_id
|
||||
TZ = var.timezone
|
||||
}
|
||||
|
||||
sonarr_healthcheck = {
|
||||
test = ["CMD", "curl", "--fail", "http://127.0.0.1:8989/sonarr/ping"]
|
||||
interval = "30s"
|
||||
timeout = "5s"
|
||||
retries = 10
|
||||
start_period = "5s"
|
||||
}
|
||||
}
|
||||
|
||||
module "sonarr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.sonarr_volumes
|
||||
env_vars = local.sonarr_env_vars
|
||||
healthcheck = local.sonarr_healthcheck
|
||||
ports = [{
|
||||
internal = 8989
|
||||
external = 8989
|
||||
protocol = "tcp"
|
||||
}]
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for sonarr"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = 8989
|
||||
endpoint = "http://${local.container_name}:8989"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
variable "user_id" {
|
||||
description = "User ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "group_id" {
|
||||
description = "Group ID for container permissions"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "timezone" {
|
||||
description = "Timezone for the container"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "download_root" {
|
||||
description = "Directory for downloads"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "sonarr_api_key" {
|
||||
description = "API key for Sonarr"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "radarr_api_key" {
|
||||
description = "API key for Radarr"
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
variable "monitoring" {
|
||||
description = "Enable container monitoring"
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "unpackerr"
|
||||
image = "golift/unpackerr"
|
||||
tag = "latest"
|
||||
|
||||
unpackerr_volumes = [
|
||||
{
|
||||
host_path = var.download_root
|
||||
container_path = "/data/torrents"
|
||||
read_only = false
|
||||
}
|
||||
]
|
||||
|
||||
unpackerr_env_vars = {
|
||||
TZ = var.timezone
|
||||
UN_SONARR_0_URL = "http://sonarr:8989/sonarr"
|
||||
UN_SONARR_0_API_KEY = var.sonarr_api_key
|
||||
UN_RADARR_0_URL = "http://radarr:7878/radarr"
|
||||
UN_RADARR_0_API_KEY = var.radarr_api_key
|
||||
}
|
||||
|
||||
unpackerr_security_opts = [
|
||||
"no-new-privileges:true"
|
||||
]
|
||||
}
|
||||
|
||||
module "unpackerr" {
|
||||
source = "../../../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.tag
|
||||
volumes = local.unpackerr_volumes
|
||||
env_vars = local.unpackerr_env_vars
|
||||
security_opts = local.unpackerr_security_opts
|
||||
networks = var.networks
|
||||
monitoring = var.monitoring
|
||||
restart_policy = "always"
|
||||
user = "${var.user_id}:${var.group_id}"
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "Service definition for unpackerr"
|
||||
value = {
|
||||
name = local.container_name
|
||||
endpoint = "http://${local.container_name}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user