Formatting and friends
This commit is contained in:
parent
4927ecba4a
commit
b679424f8f
13 changed files with 128 additions and 7 deletions
products
forgejo/forgejo
minio
pgadmin
pgbackweb
postgres
quassel
redis
smokeping
statping
|
@ -7,4 +7,7 @@ output "postgres" {
|
|||
|
||||
output "endpoint" {
|
||||
value = module.forgejo.endpoint
|
||||
}
|
||||
output "network" {
|
||||
value = module.forgejo_network.network
|
||||
}
|
|
@ -39,9 +39,9 @@ variable "mounts" {
|
|||
|
||||
variable "ports" {
|
||||
type = list(object({
|
||||
host = optional(number, null)
|
||||
host = optional(number, null)
|
||||
container = number
|
||||
protocol = optional(string, "tcp")
|
||||
protocol = optional(string, "tcp")
|
||||
}))
|
||||
default = []
|
||||
}
|
|
@ -21,9 +21,9 @@ module "minio" {
|
|||
MINIO_SERVER_URL = "https://${var.domain}"
|
||||
MINIO_BROWSER_REDIRECT_URL = "https://${var.domain}/ui/"
|
||||
#MINIO_BROWSER_REDIRECT = true
|
||||
MINIO_API_ROOT_ACCESS = "on"
|
||||
MINIO_API_ROOT_ACCESS = "on"
|
||||
}
|
||||
ports = var.ports
|
||||
ports = var.ports
|
||||
mounts = var.mounts
|
||||
networks = var.networks
|
||||
placement_constraints = var.placement_constraints
|
||||
|
@ -48,7 +48,7 @@ module "minio" {
|
|||
"traefik.http.middlewares.minio_ui.stripprefix.prefixes" = "/ui"
|
||||
|
||||
# Attach the middleware to the UI router
|
||||
"traefik.http.routers.minio_ui.middlewares" = "minio_ui"
|
||||
"traefik.http.routers.minio_ui.middlewares" = "minio_ui"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
28
products/pgadmin/inputs.tf
Normal file
28
products/pgadmin/inputs.tf
Normal file
|
@ -0,0 +1,28 @@
|
|||
variable "placement_constraints" {
|
||||
default = []
|
||||
type = list(string)
|
||||
description = "Docker Swarm placement constraints"
|
||||
}
|
||||
variable "networks" {
|
||||
type = list(object({
|
||||
name = string
|
||||
id = string
|
||||
}))
|
||||
default = []
|
||||
description = "A list of network names to attach the service to."
|
||||
}
|
||||
|
||||
variable "traefik" {
|
||||
default = null
|
||||
type = object({
|
||||
domain = string
|
||||
port = optional(number, 80)
|
||||
ssl = optional(bool)
|
||||
})
|
||||
description = "Whether to enable traefik for the service."
|
||||
}
|
||||
|
||||
variable "email" {
|
||||
description = "The email address to use for the pgadmin login"
|
||||
type = string
|
||||
}
|
49
products/pgadmin/pgadmin.tf
Normal file
49
products/pgadmin/pgadmin.tf
Normal file
|
@ -0,0 +1,49 @@
|
|||
resource "random_password" "default" {
|
||||
length = 32
|
||||
special = false
|
||||
}
|
||||
|
||||
variable "servers" {
|
||||
type = list(object({
|
||||
Name = string
|
||||
Group = optional(string)
|
||||
Host = string
|
||||
Port = number
|
||||
Username = string
|
||||
SSLMode = optional(string, "prefer")
|
||||
MaintenanceDB = optional(string, "postgres")
|
||||
Comment = optional(string, null)
|
||||
UseSSHTunnel = optional(bool, null)
|
||||
TunnelHost = optional(string, null)
|
||||
TunnelPort = optional(number, null)
|
||||
TunnelUsername = optional(string, null)
|
||||
TunnelAuthentication = optional(string, null)
|
||||
}))
|
||||
}
|
||||
module "pgadmin" {
|
||||
source = "../../docker/service"
|
||||
image = "dpage/pgadmin4:8"
|
||||
service_name = "pgadmin"
|
||||
stack_name = "pgadmin"
|
||||
placement_constraints = var.placement_constraints
|
||||
networks = var.networks
|
||||
traefik = var.traefik
|
||||
environment_variables = {
|
||||
PGADMIN_DEFAULT_EMAIL = var.email
|
||||
PGADMIN_DEFAULT_PASSWORD = nonsensitive(random_password.default.result)
|
||||
}
|
||||
configs = {
|
||||
"/pgadmin4/servers.json" = jsonencode({
|
||||
Servers = { for server in var.servers : index(var.servers, server) => server }
|
||||
})
|
||||
}
|
||||
healthcheck = ["CMD", "wget", "-q", "-O", "-", "http://localhost:80/misc/ping"]
|
||||
healthcheck_start_period = "60s"
|
||||
converge_timeout = "5m"
|
||||
}
|
||||
output "credentials" {
|
||||
value = {
|
||||
username = var.email
|
||||
password = nonsensitive(random_password.default.result)
|
||||
}
|
||||
}
|
15
products/pgadmin/terraform.tf
Normal file
15
products/pgadmin/terraform.tf
Normal file
|
@ -0,0 +1,15 @@
|
|||
terraform {
|
||||
required_version = "~> 1.6"
|
||||
required_providers {
|
||||
docker = {
|
||||
source = "kreuzwerker/docker"
|
||||
version = "~>3.0"
|
||||
}
|
||||
random = {
|
||||
source = "hashicorp/random"
|
||||
version = "~> 3.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4,4 +4,8 @@ output "docker_service" {
|
|||
|
||||
output "postgres" {
|
||||
value = module.postgres
|
||||
}
|
||||
|
||||
output "network" {
|
||||
value = module.network.network
|
||||
}
|
|
@ -19,4 +19,16 @@ output "docker_service" {
|
|||
|
||||
output "endpoint" {
|
||||
value = "postgres://${local.username}:${local.password}@${module.service.service_name}:5432/${local.database}"
|
||||
}
|
||||
|
||||
output "pgadmin_config" {
|
||||
value = {
|
||||
"Group" = var.stack_name
|
||||
"Name" = module.service.service_name
|
||||
"Host" = module.service.service_name
|
||||
"Port" = 5432
|
||||
"Username" = local.username
|
||||
"MaintenanceDB" = local.database
|
||||
"Comment" = "${var.stack_name} ${local.database} database"
|
||||
}
|
||||
}
|
|
@ -19,4 +19,8 @@ output "postgres_service" {
|
|||
}
|
||||
output "postgres" {
|
||||
value = module.postgres
|
||||
}
|
||||
|
||||
output "network" {
|
||||
value = module.network.network
|
||||
}
|
|
@ -9,4 +9,7 @@ output "ports" {
|
|||
}
|
||||
output "docker_service" {
|
||||
value = module.service.docker_service
|
||||
}
|
||||
output "endpoint" {
|
||||
value = "redis://${module.service.service_name}:6379"
|
||||
}
|
|
@ -7,7 +7,7 @@ variable "traefik" {
|
|||
default = null
|
||||
type = object({
|
||||
domain = string
|
||||
port = optional(number)
|
||||
port = optional(number,80)
|
||||
ssl = optional(bool, false)
|
||||
rule = optional(string)
|
||||
})
|
||||
|
|
|
@ -49,7 +49,7 @@ variable "traefik" {
|
|||
default = null
|
||||
type = object({
|
||||
domain = string
|
||||
port = optional(number)
|
||||
port = optional(number,8080)
|
||||
ssl = optional(bool, false)
|
||||
rule = optional(string)
|
||||
})
|
||||
|
|
|
@ -16,4 +16,7 @@ output "endpoint" {
|
|||
}
|
||||
output "postgres" {
|
||||
value = module.postgres
|
||||
}
|
||||
output "network" {
|
||||
value = module.network.network
|
||||
}
|
Loading…
Reference in a new issue