deluge deployment

This commit is contained in:
Luigi Oliveira 2024-11-26 04:10:17 -03:00
parent 690b2b01c4
commit 4200d70105
5 changed files with 78 additions and 0 deletions

View file

@ -12,3 +12,9 @@ module "freqtrade" {
username = var.username
password = var.password
}
module "deluge" {
source = "./modules/deluge"
providers = {
nomad = nomad
}
}

View file

@ -0,0 +1,56 @@
job "deluge" {
datacenters = ["marioverde"]
type = "service"
group "deluge" {
count = 1
network {
port "http" { static = 8112 }
port "tcp1" { static = 58846 }
port "tcp2" { static = 58946 }
}
service {
port = "http"
name = "deluge"
provider = "nomad"
tags = [
"traefik.enable=true",
"traefik.http.routers.deluge_http.entrypoints=web,websecure",
"traefik.http.routers.deluge_http.rule=Host(`deluge.marioverde.com.br`)",
]
check {
type = "http"
path = "/"
interval = "10s"
timeout = "2s"
}
}
task "deluge" {
driver = "podman"
config {
image = "docker.io/linuxserver/deluge:2.1.1"
network_mode = "host"
ports = ["http", "tcp1", "tcp2"]
privileged = "true"
volumes = [
"/etc/deluge:/config",
"/opt/media/deluge:/downloads",
]
}
env {
PUID = "0"
PGID = "0"
}
resources {
cpu = 2000
memory = 2048
}
}
}
}

View file

@ -0,0 +1,4 @@
resource "nomad_job" "app" {
jobspec = templatefile("${path.module}/conf/deluge.hcl", {})
}

View file

@ -0,0 +1,9 @@
terraform {
required_providers {
nomad = {
source = "hashicorp/nomad"
version = "2.4.0"
}
}
required_version = ">= 0.14"
}

View file

@ -7,6 +7,9 @@ resource "nomad_job" "app" {
exchange_password = var.exchange_password,
telegram_token = var.telegram_token,
telegram_chat_id = var.telegram_chat_id
jwt_secret_key = var.jwt_secret_key
username = var.username
password = var.password
})
STRATEGY_NAME = file("${path.module}/conf/strategy.py")
})