mirror of
https://github.com/luigieai/homelab.git
synced 2025-06-07 07:56:37 -03:00
feat: added Redis to homelab
This commit is contained in:
parent
531886d13b
commit
204f04081a
4 changed files with 79 additions and 1 deletions
|
@ -20,6 +20,13 @@ module "postgree" {
|
|||
}
|
||||
}
|
||||
|
||||
module "redis" {
|
||||
source = "./modules/redis"
|
||||
providers = {
|
||||
nomad = nomad
|
||||
}
|
||||
}
|
||||
|
||||
module "keycloak" {
|
||||
source = "./modules/keycloak"
|
||||
postgree_user = var.postgree_user
|
||||
|
|
57
terraform/modules/redis/conf/redis.hcl
Normal file
57
terraform/modules/redis/conf/redis.hcl
Normal file
|
@ -0,0 +1,57 @@
|
|||
job "redis" {
|
||||
datacenters = ["dc"]
|
||||
type = "service"
|
||||
|
||||
group "redis" {
|
||||
count = 1
|
||||
|
||||
network {
|
||||
port "redis" {
|
||||
static = 6379
|
||||
to = 6379
|
||||
}
|
||||
}
|
||||
|
||||
restart {
|
||||
attempts = 2
|
||||
interval = "5m"
|
||||
delay = "30s"
|
||||
mode = "delay"
|
||||
}
|
||||
|
||||
task "redis" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "redis:7.2"
|
||||
ports = ["redis"]
|
||||
volumes = [
|
||||
"${NOMAD_ALLOC_DIR}/postiz-redis-data:/data"
|
||||
]
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 500
|
||||
memory = 512
|
||||
}
|
||||
|
||||
service {
|
||||
name = "redis"
|
||||
port = "redis"
|
||||
provider = "nomad"
|
||||
check {
|
||||
name = "redis-check"
|
||||
type = "tcp"
|
||||
port = "redis"
|
||||
interval = "10s"
|
||||
timeout = "3s"
|
||||
}
|
||||
}
|
||||
|
||||
logs {
|
||||
max_files = 5
|
||||
max_file_size = 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
5
terraform/modules/redis/job.tf
Normal file
5
terraform/modules/redis/job.tf
Normal file
|
@ -0,0 +1,5 @@
|
|||
resource "nomad_job" "app" {
|
||||
jobspec = templatefile("${path.module}/conf/redis.hcl", {
|
||||
NOMAD_ALLOC_DIR = "/alloc"
|
||||
})
|
||||
}
|
9
terraform/modules/redis/providers..tf
Normal file
9
terraform/modules/redis/providers..tf
Normal file
|
@ -0,0 +1,9 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
nomad = {
|
||||
source = "hashicorp/nomad"
|
||||
version = "2.0.0-rc.1"
|
||||
}
|
||||
}
|
||||
required_version = ">= 0.14"
|
||||
}
|
Loading…
Add table
Reference in a new issue