Compare commits
7
Commits
624bceb2ca
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
013465ffec | ||
|
|
562ee0edae | ||
|
|
df39551a46 | ||
|
|
bc5fb92b24 | ||
|
|
191f7b4fd5 | ||
|
|
f712611861 | ||
|
|
300f3460e0 |
@@ -0,0 +1,119 @@
|
||||
variable "cronjob" {
|
||||
type = map(object({
|
||||
name = optional(string)
|
||||
image = string
|
||||
enabled = bool
|
||||
namespace = optional(string)
|
||||
connected_namespace = optional(string, "")
|
||||
schedule = string
|
||||
command = optional(list(string))
|
||||
args = optional(list(string))
|
||||
|
||||
|
||||
pvc = optional(map(object({
|
||||
name = string
|
||||
pvc = optional(bool, false)
|
||||
config_map = optional(bool, false)
|
||||
secret = optional(bool, false)
|
||||
host_path = optional(string)
|
||||
pvc_size = optional(string)
|
||||
storage_class_name = optional(string, "nfs-storage-intelligent")
|
||||
annotations_fileType = optional(string)
|
||||
existing_pvc = optional(bool, false)
|
||||
mount_path = string
|
||||
sub_path = optional(string)
|
||||
})))
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
|
||||
locals {
|
||||
pvc_list = flatten([
|
||||
for key, value in var.cronjob : [
|
||||
for index, pvc in value.pvc : {
|
||||
key = "${coalesce(value.namespace, value.connected_namespace, key)}/${pvc.name}"
|
||||
index = index
|
||||
pvc = pvc.pvc
|
||||
name = pvc.name
|
||||
pvc_size = pvc.pvc_size
|
||||
mount_path = pvc.mount_path
|
||||
storage_class_name = pvc.storage_class_name
|
||||
annotations_fileType = pvc.annotations_fileType
|
||||
existing_pvc = pvc.existing_pvc
|
||||
sub_path = pvc.sub_path
|
||||
namespace = coalesce(value.namespace, value.connected_namespace, key)
|
||||
}] if value.enabled == true && value.pvc != null
|
||||
])
|
||||
|
||||
# group duplicates instead of throwing an error
|
||||
pvc_map_grouped = {
|
||||
for p in local.pvc_list :
|
||||
p.key => p...
|
||||
}
|
||||
|
||||
# keep only one PVC per key (take the first)
|
||||
pvc_map = {
|
||||
for k, list in local.pvc_map_grouped :
|
||||
k => list[0]
|
||||
}
|
||||
|
||||
pvc_details = values(local.pvc_map)
|
||||
}
|
||||
|
||||
resource "kubernetes_persistent_volume_claim_v1" "automatic-pvc-cronjob" {
|
||||
for_each = { for key, value in local.pvc_details : "${value.index}" => merge(value, { mew_key = value.index }) if value.pvc && value.existing_pvc != true }
|
||||
metadata {
|
||||
namespace = coalesce(each.value.namespace, each.key)
|
||||
name = "${each.value.name}-pvc"
|
||||
labels = {
|
||||
deployment_method = "Terraform"
|
||||
}
|
||||
annotations = {
|
||||
fileType = try(each.value.annotations_fileType, "file")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
spec {
|
||||
access_modes = ["ReadWriteMany"]
|
||||
storage_class_name = each.value.storage_class_name
|
||||
resources {
|
||||
requests = {
|
||||
storage = each.value.pvc_size
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_cron_job_v1" "automatic_cronjob" {
|
||||
for_each = { for key, value in var.cronjob : key => value if value.enabled == true }
|
||||
metadata {
|
||||
name = "${each.key}-cronjob"
|
||||
namespace = coalesce(each.value.namespace, each.value.connected_namespace, each.key)
|
||||
|
||||
labels = {
|
||||
app = each.key
|
||||
deployment_method = "Terraform"
|
||||
}
|
||||
}
|
||||
spec {
|
||||
schedule = each.value.schedule
|
||||
job_template {
|
||||
metadata {}
|
||||
spec {
|
||||
template {
|
||||
metadata {}
|
||||
spec {
|
||||
container {
|
||||
name = coalesce(each.value.name, each.key)
|
||||
image = each.value.image
|
||||
command = each.value.command != null ? each.value.command : []
|
||||
args = each.value.args != null ? each.value.args : []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -612,7 +612,7 @@ resource "kubernetes_deployment_v1" "database-automatic" {
|
||||
|
||||
metadata {
|
||||
namespace = coalesce(each.value.namespace, each.value.connected_namespace, each.key)
|
||||
name = "${coalesce(each.value.namespace, each.key)}-db"
|
||||
name = "${coalesce(each.value.name, each.key)}-db"
|
||||
labels = {
|
||||
app = each.key
|
||||
deployment_method = "Terraform"
|
||||
@@ -786,7 +786,7 @@ resource "kubernetes_deployment_v1" "redis-automatic" {
|
||||
|
||||
metadata {
|
||||
namespace = coalesce(each.value.namespace, each.value.connected_namespace, each.key)
|
||||
name = "${coalesce(each.value.namespace, each.key)}-redis"
|
||||
name = "${coalesce(each.value.name, each.key)}-redis"
|
||||
labels = {
|
||||
app = each.key
|
||||
deployment_method = "Terraform"
|
||||
|
||||
@@ -43,3 +43,48 @@ server {
|
||||
return 404;
|
||||
|
||||
}
|
||||
############################################
|
||||
# config file for ${name_site}
|
||||
############################################
|
||||
|
||||
upstream ${name_site}_backend_root {
|
||||
server ${name_service};
|
||||
server 1.1.1.1 backup;
|
||||
}
|
||||
|
||||
server {
|
||||
server_name ${name_site}.geeraert.eu www.${name_site}.geeraert.eu;
|
||||
location / {
|
||||
proxy_pass http://${name_site}_backend_root;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
access_log /var/log/nginx/access.log my_custom_format;
|
||||
access_log /var/log/nginx/ip_audit.log ip_audit;
|
||||
|
||||
listen 443 ssl;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/live/geeraert.eu/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/live/geeraert.eu/privkey.pem;
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
if ($host = www.${name_site}.geeraert.eu) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
|
||||
if ($host = ${name_site}.geeraert.eu) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server_name www.${name_site}.geeraert.eu ${name_site}.geeraert.eu;
|
||||
listen 80;
|
||||
return 404;
|
||||
|
||||
}
|
||||
|
||||
+2757
-1448
File diff suppressed because it is too large
Load Diff
+2758
-1449
File diff suppressed because it is too large
Load Diff
+81
-72
@@ -1,9 +1,10 @@
|
||||
kubernetes = {
|
||||
bookstack = {
|
||||
enabled = false
|
||||
#enabled = false
|
||||
replicas = 01
|
||||
image = "linuxserver/bookstack:latest"
|
||||
service_port = [80, 443]
|
||||
domain_name = "bookstack"
|
||||
database = {
|
||||
"engine" = "mysql"
|
||||
"image" = "lscr.io/linuxserver/mariadb"
|
||||
@@ -671,72 +672,40 @@ kubernetes = {
|
||||
|
||||
|
||||
|
||||
next = {
|
||||
nextcloud = {
|
||||
enabled = false
|
||||
namespace = "next"
|
||||
replicas = 01
|
||||
image = "nextcloud:29.0.3-apache"
|
||||
service_port = [80]
|
||||
extra_manifest = ["/opt/kubernetes/Nextcloud_kube/next.secret.yaml"]
|
||||
namespace = "next"
|
||||
#replicas = 0
|
||||
image = "nextcloud:29.0.3-apache"
|
||||
domain_name = "next"
|
||||
service_port = [80]
|
||||
#extra_manifest = ["/opt/kubernetes/Nextcloud_kube/next.secret.yaml"]
|
||||
secret_ref = ["nextcloud-credentials"]
|
||||
secret_import = ["b207c4b6-0489-4ab2-a032-b4a400a708e0"]
|
||||
database = {
|
||||
image = "docker.io/library/postgres:14" }
|
||||
redis = {
|
||||
image = "docker.io/library/redis:7" }
|
||||
requirements = {
|
||||
limits-cpu = "800Mi"
|
||||
limits-memory = "800Mi"
|
||||
requests-cpu = "800Mi"
|
||||
requests-memory = "800Mi"
|
||||
}
|
||||
#requirements = {
|
||||
# limits-cpu = "800Mi"
|
||||
# limits-memory = "800Mi"
|
||||
# requests-cpu = "800Mi"
|
||||
# requests-memory = "800Mi"
|
||||
#}
|
||||
environment = {
|
||||
POSTGRES_DB = {
|
||||
value_from = {
|
||||
secret_key_ref = {
|
||||
name = "nextcloud-credentials"
|
||||
key = "POSTGRES_DB"
|
||||
}
|
||||
}
|
||||
}
|
||||
POSTGRES_USER = {
|
||||
value_from = {
|
||||
secret_key_ref = {
|
||||
name = "nextcloud-credentials"
|
||||
key = "POSTGRES_USER"
|
||||
}
|
||||
}
|
||||
}
|
||||
POSTGRES_PASSWORD = {
|
||||
value_from = {
|
||||
secret_key_ref = {
|
||||
name = "nextcloud-credentials"
|
||||
key = "POSTGRES_PASSWORD"
|
||||
}
|
||||
}
|
||||
}
|
||||
POSTGRES_HOST = {
|
||||
value_from = {
|
||||
secret_key_ref = {
|
||||
name = "nextcloud-credentials"
|
||||
key = "POSTGRES_HOST"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# REDIS_HOST = {
|
||||
# value = "redis://next-redis-svc:6379"
|
||||
# }
|
||||
TRUSTED_PROXIES = {
|
||||
value = "192.168.88.50 192.168.88.52"
|
||||
}
|
||||
OVERWRITECLIURL = {
|
||||
value = "https://nextcloud.tryton.geeraert.eu"
|
||||
value = "https://next.geeraert.eu"
|
||||
}
|
||||
OVERWRITEPROTOCOL = {
|
||||
value = "https"
|
||||
}
|
||||
|
||||
NEXTCLOUD_TRUSTED_DOMAINS = {
|
||||
value = "nextcloud.tryton.geeraert.eu 192.168.88.52"
|
||||
value = "next.geeraert.eu next.tryton.geeraert.eu 192.168.88.52"
|
||||
}
|
||||
NEXTCLOUD_ADMIN_USER = {
|
||||
value = "admin"
|
||||
@@ -749,6 +718,7 @@ kubernetes = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
pvc = {
|
||||
nextcloud-webserver = {
|
||||
@@ -830,7 +800,7 @@ kubernetes = {
|
||||
}
|
||||
|
||||
jellyfin = {
|
||||
# enabled = false
|
||||
enabled = false
|
||||
replicas = 0
|
||||
image = "jellyfin/jellyfin:latest"
|
||||
service_port = [8096]
|
||||
@@ -838,7 +808,7 @@ kubernetes = {
|
||||
environment = {
|
||||
|
||||
JELLYFIN_PublishedServerUrl = {
|
||||
value = "https://jellyfin.tryton.geeraert.eu"
|
||||
value = "https://jellyfin.geeraert.eu"
|
||||
}
|
||||
}
|
||||
pvc = {
|
||||
@@ -1553,11 +1523,14 @@ kubernetes = {
|
||||
|
||||
environment = {
|
||||
ALLOWED_HOSTS = {
|
||||
value = "django.tryton.geeraert.eu,redirect.tryton.geeraert.eu"
|
||||
value = "django.geeraert.eu,admin.geeraert.eu,redirect.geeraert.eu,streaming.geeraert.eu,stash.geeraert.eu,simpsons.geeraert.eu,kubernetes.geeraert.eu,cloudmanager.geeraert.eu,podcast.geeraert.eu"
|
||||
}
|
||||
DEBUG = {
|
||||
value = "False"
|
||||
}
|
||||
ENVIRONMENT = {
|
||||
value = "PRODUCTION"
|
||||
}
|
||||
#CELERY_BROKER_URL = {
|
||||
# value = "redis://django-redis-svc:6379"
|
||||
#}
|
||||
@@ -1676,7 +1649,7 @@ kubernetes = {
|
||||
secret_import = ["68dce7aa-8e5f-4483-9083-b474016e34fc"]
|
||||
environment = {
|
||||
ALLOWED_HOSTS = {
|
||||
value = "django-testing.tryton.geeraert.eu,redirect.tryton.geeraert.eu,redirect-testing.tryton.geeraert.eu,job-testing.tryton.geeraert.eu"
|
||||
value = "django-testing.geeraert.eu,admin-testing.geeraert.eu,redirect-testing.geeraert.eu,streaming-testing.geeraert.eu,stash-testing.geeraert.eu,simpsons-testing.geeraert.eu,kubernetes-testing.geeraert.eu,cloudmanager-testing.geeraert.eu,podcast-testing.geeraert.eu"
|
||||
}
|
||||
CELERY_BROKER_URL = {
|
||||
value = "redis://django-testing-redis-svc:6379"
|
||||
@@ -2643,24 +2616,6 @@ kubernetes = {
|
||||
}
|
||||
|
||||
|
||||
nextcloudt = {
|
||||
enabled = false
|
||||
replicas = 1
|
||||
image = "nextcloud:29.0.3-apache"
|
||||
service_port = [80]
|
||||
domain_name = "nextcloudnew"
|
||||
database = {
|
||||
image = "docker.io/library/postgres:14" }
|
||||
|
||||
pvc = {
|
||||
nextcloud-webserver = {
|
||||
name = "nextcloud-webserver"
|
||||
pvc = true
|
||||
pvc_size = "2Gi"
|
||||
mount_path = "/var/www/html"
|
||||
}
|
||||
}
|
||||
}
|
||||
reactive = {
|
||||
#disabled because it needs AI to import a pdf and AI integration is not working
|
||||
enabled = false
|
||||
@@ -2882,4 +2837,58 @@ kubernetes = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
kopia = {
|
||||
enabled = false
|
||||
replicas = 01
|
||||
image = "kopia/kopia"
|
||||
service_port = [51515]
|
||||
domain_name = "kopia"
|
||||
command = ["start", "--disable-csrf-token-checks", "--insecure", "--address=0.0.0.0:51515", "--server-username=USERNAME", "--server-password=SECRET_PASSWORD"]
|
||||
environment = {
|
||||
KOPIA_PASSWORD = {
|
||||
value = "123456789"
|
||||
}
|
||||
USER = {
|
||||
value = "user" }
|
||||
}
|
||||
pvc = {
|
||||
kopia-storage = {
|
||||
name = "kopia-storage"
|
||||
pvc = true
|
||||
pvc_size = "2Gi"
|
||||
mount_path = "/app"
|
||||
}
|
||||
}
|
||||
kopia-data = {
|
||||
name = "kopia-data"
|
||||
pvc_size = "100Mi"
|
||||
pvc = true
|
||||
mount_path = "/data"
|
||||
storage_class_name = "nfs-storage-fastaccess"
|
||||
}
|
||||
}
|
||||
|
||||
degoog = {
|
||||
enabled = false
|
||||
replicas = 01
|
||||
image = "ghcr.io/degoog-org/degoog:latest"
|
||||
service_port = [4444]
|
||||
domain_name = "degoog"
|
||||
environment = {
|
||||
DEGOOG_SETTINGS_PASSWORDS = {
|
||||
value = "Crease1-City-Canned"
|
||||
}
|
||||
}
|
||||
pvc = {
|
||||
degoog-data = {
|
||||
name = "degoog-data"
|
||||
pvc = true
|
||||
pvc_size = "2Gi"
|
||||
mount_path = "/app/data"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user