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 { spec {
container { container {
image = "louislam/uptime-kuma:latest" image = "louislam/uptime-kuma:2"
name = "uptime-kuma" name = "uptime-kuma"
port { port {
@ -109,67 +109,59 @@ module "ingress" {
} }
} }
locals { # CronJob for daily SQLite backups # no longer needed as we're using the mysql
namespace = "db-backups" # resource "kubernetes_cron_job_v1" "sqlite-backup" {
backup_pvc = "sqlite-backup-pvc" # metadata {
sqlite_db_path = "/data/mydatabase.db" # Path to your SQLite DB in the source pod # name = "backup"
backup_dir = "/backups" # 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
# CronJob for daily SQLite backups # cd /app/data/backup
resource "kubernetes_cron_job_v1" "postgresql-backup" { # find . -name "*.sqlite" -type f -mtime +7 -delete # 7 day retention of backups
metadata { # echo "Old backups deleted."
name = "backup" # EOT
namespace = "uptime-kuma" # ]
} # volume_mount {
spec { # name = "data"
concurrency_policy = "Replace" # mount_path = "/app/data"
failed_jobs_history_limit = 5 # }
schedule = "0 0 * * *" # }
# schedule = "* * * * *" # volume {
starting_deadline_seconds = 10 # name = "data"
successful_jobs_history_limit = 3 # nfs {
job_template { # server = "10.0.10.15"
metadata {} # path = "/mnt/main/uptime-kuma"
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"
}
}
}
}
}
}
}
}