Add Template to deploy forgejo.
This template allows deploying a forgejo en either Scaleway or Hetzner (untested) without much knowledge about them. It DOES require knowledge about Terragrunt and ansible. A wizard of sorts is provided but it will not guarantee success without some knowledge about the underlying technology.
This commit is contained in:
parent
a9f546f92a
commit
822e42dbb8
48 changed files with 6846 additions and 2 deletions
24
ansible/roles/forgejo/templates/postgres_backup.sh.j2
Normal file
24
ansible/roles/forgejo/templates/postgres_backup.sh.j2
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# PostgreSQL Backup Script
|
||||
# Generated by Ansible
|
||||
|
||||
set -e
|
||||
|
||||
BACKUP_DIR="{{ forgejo_backup_path }}"
|
||||
TIMESTAMP=$(date +%Y%m%dT%H%M%S)
|
||||
LOG_FILE="/var/log/postgres-backup.log"
|
||||
|
||||
# Ensure backup directory exists
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
echo "[$(date)] Starting PostgreSQL backup..." | tee -a "$LOG_FILE"
|
||||
|
||||
# Create database backup
|
||||
sudo -u postgres pg_dump {{ forgejo_db_name }} | gzip > "$BACKUP_DIR/postgres-$TIMESTAMP.sql.gz"
|
||||
|
||||
echo "[$(date)] PostgreSQL backup completed: postgres-$TIMESTAMP.sql.gz" | tee -a "$LOG_FILE"
|
||||
|
||||
# Clean old PostgreSQL backups (keep last {{ forgejo_backup_retention_days }} days)
|
||||
find "$BACKUP_DIR" -type f -name "postgres-*.sql.gz" -mtime +{{ forgejo_backup_retention_days }} -delete
|
||||
|
||||
echo "[$(date)] Old PostgreSQL backups cleaned" | tee -a "$LOG_FILE"
|
||||
Loading…
Add table
Add a link
Reference in a new issue