k3s-configs/apps/gitea/restic/backup.sh

23 lines
611 B
Bash
Raw Permalink Normal View History

2024-01-30 16:12:59 +00:00
#!/bin/sh
# Set up colors
GREEN='\033[0;32m'
NC='\033[0m'
echo -e "\n${GREEN}`date` - Starting backup...${NC}\n"
2024-02-01 17:44:03 +00:00
restic unlock
2024-01-30 16:12:59 +00:00
# Gitea
echo -e "\n${GREEN}`date` - Backing up Gitea...${NC}\n"
2024-01-30 19:44:56 +00:00
gitea=$(kubectl get deploy -n gitea -l app=gitea -o name --no-headers=true)
kubectl scale -n gitea --replicas=0 $gitea
2024-01-30 16:12:59 +00:00
restic backup /gitea
2024-02-01 16:25:19 +00:00
restic backup /backup/postgres_backup.dump
2024-01-30 19:44:56 +00:00
kubectl scale -n gitea --replicas=1 $gitea
2024-01-30 16:12:59 +00:00
# Forget and prune
echo -e "\n${GREEN}`date` - Running forget and prune...${NC}\n"
restic forget --prune --keep-daily 7 --keep-weekly 2
echo -e "\n${GREEN}`date` - Backup finished.${NC}\n"