upgrade uptime kuma to 2.0 and disable auto backups as we use shared mysql now [ci skip]

This commit is contained in:
Viktor Barzin 2025-10-20 20:35:51 +00:00
parent 7e7b6f638a
commit cc1951c828

View file

@ -48,7 +48,7 @@ resource "kubernetes_deployment" "uptime-kuma" {
}
spec {
container {
image = "louislam/uptime-kuma:latest"
image = "louislam/uptime-kuma:2"
name = "uptime-kuma"
port {
@ -109,67 +109,59 @@ module "ingress" {
}
}
locals {
namespace = "db-backups"
backup_pvc = "sqlite-backup-pvc"
sqlite_db_path = "/data/mydatabase.db" # Path to your SQLite DB in the source pod
backup_dir = "/backups"
}
# CronJob for daily SQLite backups # no longer needed as we're using the mysql
# resource "kubernetes_cron_job_v1" "sqlite-backup" {
# metadata {
# name = "backup"
# namespace = "uptime-kuma"
# }
# spec {
# concurrency_policy = "Replace"
# failed_jobs_history_limit = 5
# schedule = "0 0 * * *"
# # schedule = "* * * * *"
# starting_deadline_seconds = 10
# successful_jobs_history_limit = 3
# job_template {
# metadata {}
# spec {
# active_deadline_seconds = 600 # should finish in 10 minutes
# backoff_limit = 3
# ttl_seconds_after_finished = 10
# template {
# metadata {}
# spec {
# container {
# name = "backup"
# image = "alpine/sqlite:latest"
# command = ["/bin/sh", "-c", <<-EOT
# set -e
# export now=$(date +"%Y_%m_%d_%H_%M")
# echo "Backing up SQLite database to /app/data/backup/backup_$now.sqlite"
# sqlite3 /app/data/kuma.db ".backup /app/data/backup/backup_$now.sqlite"
# echo "Backup completed. Deleting old backups..."
# CronJob for daily SQLite backups
resource "kubernetes_cron_job_v1" "postgresql-backup" {
metadata {
name = "backup"
namespace = "uptime-kuma"
}
spec {
concurrency_policy = "Replace"
failed_jobs_history_limit = 5
schedule = "0 0 * * *"
# schedule = "* * * * *"
starting_deadline_seconds = 10
successful_jobs_history_limit = 3
job_template {
metadata {}
spec {
active_deadline_seconds = 600 # should finish in 10 minutes
backoff_limit = 3
ttl_seconds_after_finished = 10
template {
metadata {}
spec {
container {
name = "backup"
image = "alpine/sqlite:latest"
command = ["/bin/sh", "-c", <<-EOT
set -e
export now=$(date +"%Y_%m_%d_%H_%M")
echo "Backing up SQLite database to /app/data/backup/backup_$now.sqlite"
sqlite3 /app/data/kuma.db ".backup /app/data/backup/backup_$now.sqlite"
echo "Backup completed. Deleting old backups..."
# Rotate - delete last log file
cd /app/data/backup
find . -name "*.sqlite" -type f -mtime +7 -delete # 7 day retention of backups
echo "Old backups deleted."
EOT
]
volume_mount {
name = "data"
mount_path = "/app/data"
}
}
volume {
name = "data"
nfs {
server = "10.0.10.15"
path = "/mnt/main/uptime-kuma"
}
}
}
}
}
}
}
}
# # Rotate - delete last log file
# cd /app/data/backup
# find . -name "*.sqlite" -type f -mtime +7 -delete # 7 day retention of backups
# echo "Old backups deleted."
# EOT
# ]
# volume_mount {
# name = "data"
# mount_path = "/app/data"
# }
# }
# volume {
# name = "data"
# nfs {
# server = "10.0.10.15"
# path = "/mnt/main/uptime-kuma"
# }
# }
# }
# }
# }
# }
# }
# }