Outline: configure backups
This commit is contained in:
		| @@ -8,6 +8,11 @@ echo "Backup: perform gitea backup" | ||||
| su --login gitea --command '/home/gitea/backup.sh' | ||||
|  | ||||
|  | ||||
| echo "Backup: perform outline backup" | ||||
|  | ||||
| su --login outline --command '/home/outline/backup.sh' | ||||
|  | ||||
|  | ||||
| echo "Backup: perform gramps backup" | ||||
|  | ||||
| su --login {{ primary_user }} --command '/home/{{ primary_user }}/applications/gramps/backup.sh' | ||||
| @@ -15,7 +20,7 @@ su --login {{ primary_user }} --command '/home/{{ primary_user }}/applications/g | ||||
|  | ||||
| echo "Backup: send backups to remote storage with retic" | ||||
|  | ||||
| restic-shell.sh backup --verbose /home/gitea/backups /home/major/applications/gramps/backups \ | ||||
| restic-shell.sh backup --verbose /home/gitea/backups /home/outline/backups /home/major/applications/gramps/backups \ | ||||
|     && restic-shell.sh check \ | ||||
| 	&& restic-shell.sh forget --compact --prune --keep-daily 90 --keep-monthly 36 \ | ||||
| 	&& restic-shell.sh check | ||||
| @@ -28,4 +33,5 @@ curl -s -X POST 'https://api.telegram.org/bot{{ notifications_tg_bot_token }}/se | ||||
|   -d 'parse_mode=HTML' \ | ||||
|   -d 'text=<b>{{ notifications_name }}</b>: бекап успешно завершен!' | ||||
|  | ||||
|  | ||||
| echo -e "\nBackup: done" | ||||
|   | ||||
							
								
								
									
										25
									
								
								files/outline/backup.sh.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								files/outline/backup.sh.j2
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| set -eu | ||||
| set -o pipefail | ||||
|  | ||||
| TIMESTAMP=$(date +%Y%m%d_%H%M%S) | ||||
| BACKUP_FILE="outline_postgres_${TIMESTAMP}.sql.gz" | ||||
|  | ||||
| echo "Outline: backing up PostgreSQL database" | ||||
|  | ||||
| docker compose --file "{{ base_dir }}/docker-compose.yml" exec \ | ||||
|     outline_postgres \ | ||||
|     pg_dump \ | ||||
|         -U "{{ outline_postgres_user }}" \ | ||||
|         "{{ outline_postgres_database }}" \ | ||||
|     | gzip > "{{ postgres_backups_dir }}/${BACKUP_FILE}" | ||||
|  | ||||
| echo "Outline: PostgreSQL backup saved to {{ postgres_backups_dir }}/${BACKUP_FILE}" | ||||
|  | ||||
| echo "Outline: removing old backups" | ||||
|  | ||||
| # Keep only the 3 most recent backups | ||||
| keep-files.py "{{ postgres_backups_dir }}" --keep 3 | ||||
|  | ||||
| echo "Outline: backup completed successfully." | ||||
| @@ -58,11 +58,8 @@ services: | ||||
|     container_name: outline_postgres | ||||
|     restart: unless-stopped | ||||
|     volumes: | ||||
|       - ./data/postgres:/var/lib/postgresql/data | ||||
|       - {{ postgres_data_dir }}:/var/lib/postgresql/data | ||||
|     environment: | ||||
|       POSTGRES_USER: '{{ outline_postgres_user }}' | ||||
|       POSTGRES_PASSWORD: '{{ outline_postgres_password }}' | ||||
|       POSTGRES_DB: '{{ outline_postgres_database }}' | ||||
|  | ||||
| volumes: | ||||
|   database-data: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user