Use mainline redis

This commit is contained in:
Greyscale 2025-01-21 13:38:46 +01:00
parent bcea842abc
commit a856bc990c
Signed by: grey
GPG key ID: DDB392AE64B32D89
2 changed files with 40 additions and 10 deletions
products/redis

View file

@ -1,5 +1,5 @@
variable "redis_image" {
default = "ghcr.io/benzine-framework/redis"
default = "redis"
type = string
description = "The docker image to use for the redis service."
}
@ -8,13 +8,11 @@ variable "redis_version" {
type = string
description = "The version of the docker image to use for the redis service."
}
variable "auth" {
default = null
type = string
description = "The password for the database. If none is provided, a random password will be generated."
}
# Pass-thru variables
variable "stack_name" {
type = string

View file

@ -1,11 +1,43 @@
variable "log_level" {
default = "warning"
description = "The log level for redis"
type = string
validation {
error_message = "Must be one of debug, verbose, notice, warning or nothing."
condition = can(regex("^(debug|verbose|notice|warning|nothing)$", var.log_level))
}
}
variable "save_every_n_seconds" {
type = number
default = 60
description = "The number of seconds between save operations."
}
variable "save_every_n_changes" {
type = number
default = 1
description = "The number of changes between save operations."
}
variable "append_only" {
default = true
description = "Whether to use append-only mode."
type = bool
}
module "service" {
source = "../../docker/service"
image = "${var.redis_image}:${var.redis_version}"
command = ["redis-server", "--requirepass", local.auth, "--appendonly", "yes", "--save", 60, 1, "--loglevel", "warning"]
stack_name = var.stack_name
service_name = "redis"
networks = var.networks
healthcheck_interval = "10s"
source = "../../docker/service"
image = "${var.redis_image}:${var.redis_version}"
stack_name = var.stack_name
service_name = "redis"
command = [
"redis-server",
"--requirepass", local.auth,
"--appendonly", (var.append_only ? "yes" : "no"),
"--save", var.save_every_n_seconds, var.save_every_n_changes,
"--loglevel", var.log_level
]
networks = var.networks
healthcheck = ["CMD", "redis-cli", "ping"]
healthcheck_interval = "10s"
healthcheck_start_period = "10s"
volumes = {
"data" = "/data",
}