More consistency between modules

This commit is contained in:
Greyscale 2025-01-21 18:18:44 +01:00
parent d30dad2f5b
commit c03ef33e1e
Signed by: grey
GPG key ID: DDB392AE64B32D89
8 changed files with 48 additions and 15 deletions

View file

@ -37,21 +37,39 @@ variable "shared_rsync_threads" {
description = "The number of rsync threads to use"
default = 2
}
resource "random_password" "warrior_password" {
count = var.http_password == null ? 1 : 0
length = 32
special = false
}
variable "port" {
type = number
description = "The port to expose the warrior on"
default = 8001
}
variable "service_name" {
type = string
description = "The name of the service to create."
default = "warrior"
}
variable "stack_name" {
type = string
description = "The name of the stack to deploy the service to."
default = "archiveteam"
}
variable "traefik" {
default = null
type = object({
domain = string
port = optional(number)
non-ssl = optional(bool)
ssl = optional(bool)
rule = optional(string)
middlewares = optional(list(string))
network = optional(object({ name = string, id = string }))
basic-auth-users = optional(list(string))
headers = optional(map(string))
udp_entrypoints = optional(list(string)) # List of UDP entrypoints
})
description = "Whether to enable traefik for the service."
}

View file

@ -22,5 +22,7 @@ module "warrior" {
"SHARED_RSYNC_THREADS" = var.shared_rsync_threads
}
parallelism = var.warrior_instances
traefik = var.traefik
converge_enable = false # @todo MB: add healthcheck and fix this.
}

View file

@ -27,6 +27,11 @@ variable "threads" {
variable "stack_name" {
type = string
}
variable "service_name" {
default = "memcached"
type = string
description = "The name of the service to create."
}
variable "networks" {
type = list(object({
name = string

View file

@ -2,14 +2,15 @@ module "service" {
source = "../../docker/service"
image = "${var.memcached_image}:${var.memcached_version}"
stack_name = var.stack_name
service_name = "mysql"
service_name = var.service_name
networks = var.networks
command = ["memcached", "--memory-limit", var.memory_limit_mb, "--threads", var.threads, "--connection-limit", var.connection_limit]
healthcheck = ["CMD-SHELL", "echo \"version\" | nc -vn -w 1 127.0.0.1 11211"]
healthcheck_start_period = "10s"
healthcheck_interval = "10s"
healthcheck_timeout = "5s"
healthcheck_retries = 3
#healthcheck = ["CMD-SHELL", "echo \"version\" | nc -vn -w 1 127.0.0.1 11211"]
#healthcheck_start_period = "10s"
#healthcheck_interval = "10s"
#healthcheck_timeout = "5s"
#healthcheck_retries = 3
converge_enable = false # @todo MB: fix healthcheck and fix this.
volumes = local.volumes
mounts = local.mounts
ports = var.ports

View file

@ -28,11 +28,15 @@ variable "database" {
type = string
description = "The name of the database. If none is provided, a random name will be generated."
}
# Pass-thru variables
variable "stack_name" {
type = string
}
variable "service_name" {
default = "mysql"
type = string
description = "The name of the service to create."
}
variable "networks" {
type = list(object({
name = string

View file

@ -2,13 +2,12 @@ module "service" {
source = "../../docker/service"
image = "${var.mysql_image}:${var.mysql_version}"
stack_name = var.stack_name
service_name = "mysql"
service_name = var.service_name
networks = var.networks
healthcheck = ["CMD", "/usr/local/bin/healthcheck.sh", "--connect", "--mariadbupgrade", "--innodb_initialized"]
healthcheck_start_period = "10s"
healthcheck_start_period = "30s"
healthcheck_interval = "10s"
healthcheck_timeout = "5s"
healthcheck_retries = 3
environment_variables = {
MARIADB_ROOT_PASSWORD = local.root_password
MARIADB_USER = local.username

View file

@ -23,11 +23,15 @@ variable "database" {
type = string
description = "The name of the database. If none is provided, a random name will be generated."
}
# Pass-thru variables
variable "stack_name" {
type = string
}
variable "service_name" {
default = "postgres"
type = string
description = "The name of the service to create."
}
variable "networks" {
type = list(object({
name = string

View file

@ -2,7 +2,7 @@ module "service" {
source = "../../docker/service"
image = "${var.postgres_image}:${var.postgres_version}"
stack_name = var.stack_name
service_name = "postgres"
service_name = var.service_name
networks = var.networks
healthcheck = ["CMD-SHELL", "pg_isready", "-U", local.username, "-d", local.database]
healthcheck_interval = "10s"