Modified stuff
This commit is contained in:
parent
088bb700ab
commit
a49776d2ab
6 changed files with 121 additions and 31 deletions
|
@ -1,11 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Backup script for Calibre-web in a kubernetes cluster
|
||||
#!/bin/sh
|
||||
# Backup script for Calibre-web in a Kubernetes cluster
|
||||
|
||||
PROGRAM_NAME='backup_calibre-web'
|
||||
printlog () {
|
||||
printf '%s: %s\n' "${PROGRAM_NAME}" "${1}"
|
||||
}
|
||||
|
||||
BACKUP_DEST='/mnt/PRIVATE_DOCS/BACKUPS/calibre-web'
|
||||
DATABASE_FILE='/config/app.db'
|
||||
|
||||
# Create filename for database backup
|
||||
database_backupfile="calibre-web-app_$(date +'%Y%m%d').db"
|
||||
database_backupfile="calibre-web-app_$( date +'%Y%m%d' ).db"
|
||||
|
||||
# Retrieve container name
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep tkioskje-calibre-web_tkioskje-calibre-web )"
|
||||
|
@ -14,20 +19,12 @@ base_container="$( docker ps --format '{{.Names}}' | grep tkioskje-calibre-web_t
|
|||
set -e
|
||||
|
||||
# Database backup
|
||||
>&2 echo 'Backing up database'
|
||||
printlog 'Backing up database'
|
||||
docker cp "${base_container}":"${DATABASE_FILE}" "${BACKUP_DEST}/${database_backupfile}"
|
||||
|
||||
# Backup cleanup
|
||||
# Only keep 30 most recent backups
|
||||
>&2 echo 'Cleaning up old database backups'
|
||||
pushd "${BACKUP_DEST}"
|
||||
excess="$( ls -x | head -n -30 )"
|
||||
if [ -n "${excess}" ]; then
|
||||
>&2 echo "Removing ${excess}"
|
||||
rm "${excess}"
|
||||
else
|
||||
>&2 echo 'Skipping: nothing to remove'
|
||||
fi
|
||||
popd
|
||||
printlog 'Cleaning up old database backups'
|
||||
find "${BACKUP_DEST}" -type f -mtime +30 -print -delete
|
||||
|
||||
>&2 echo 'Done'
|
||||
printlog 'Done'
|
||||
|
|
28
backups/create_freshrss_backup.sh
Normal file
28
backups/create_freshrss_backup.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
# Backup script for FreshRSS in a Kubernetes cluster
|
||||
|
||||
PROGRAM_NAME='backup_freshrss'
|
||||
printlog () {
|
||||
printf '%s: %s\n' "${PROGRAM_NAME}" "${1}"
|
||||
}
|
||||
|
||||
BACKUP_DEST='/mnt/PRIVATE_DOCS/BACKUPS/freshrss'
|
||||
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep rss-freshrss_rss-freshrss )"
|
||||
|
||||
# Abort entire script if any command fails
|
||||
set -e
|
||||
|
||||
# Enable maintenance mode
|
||||
# TODO
|
||||
|
||||
# Backup config
|
||||
# TODO
|
||||
|
||||
# Backup Database
|
||||
# TODO
|
||||
|
||||
# Disable maintenance mode
|
||||
# TODO
|
||||
|
||||
printlog 'Done'
|
|
@ -3,31 +3,37 @@
|
|||
|
||||
# `gitea dump` is a mess that we should not touch. We write our own backup scripts instead.
|
||||
|
||||
PROGRAM_NAME='backup_gitea'
|
||||
printlog () {
|
||||
printf '%s: %s\n' "${PROGRAM_NAME}" "${1}"
|
||||
}
|
||||
|
||||
BACKUP_DEST='/mnt/PRIVATE_DOCS/BACKUPS/gitea'
|
||||
PASSFILE='./gitea_pass.txt'
|
||||
|
||||
# Retrieve container names
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep 'hugit-gitea_hugit-gitea' )"
|
||||
database_container="$( docker ps --format '{{.Names}}' | grep 'hugit-postgresql_hugit-postgresql' )"
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep hugit-gitea_hugit-gitea )"
|
||||
database_container="$( docker ps --format '{{.Names}}' | grep hugit-postgresql_hugit-postgresql )"
|
||||
|
||||
# Abort entire script if any command fails
|
||||
set -e
|
||||
|
||||
# Enable maintenance mode
|
||||
# Flush queues
|
||||
printlog 'Flushing queues'
|
||||
docker exec "${base_container}" gitea manager flush-queues
|
||||
# Pause queues
|
||||
# TODO
|
||||
|
||||
# Backup the database
|
||||
>&2 echo 'Backing up database'
|
||||
printlog 'Backing up database'
|
||||
database_backupfile="gitea-sqlbkp_$( date +'%Y%m%d' ).bak"
|
||||
internal_database_backupfile="/tmp/${database_backupfile}"
|
||||
docker exec --env-file "${PASSFILE}" "${database_container}" pg_dump 'gitea' -cwv -h 'localhost' -U 'gitea' -f "${internal_database_backupfile}"
|
||||
docker cp "${database_container}":"${internal_database_backupfile}" "${BACKUP_DEST}"
|
||||
|
||||
# Backup files
|
||||
tar czvf "${BACKUP_DEST}/gitea-data_$(date +'%Y%m%d').tar.gz" -C "/mnt/APPS/hugit"
|
||||
printlog 'Backing up files'
|
||||
tar czvf "${BACKUP_DEST}/gitea-data_$( date +'%Y%m%d' ).tar.gz" -C "/mnt/APPS/hugit"
|
||||
|
||||
# Disable maintenance mode
|
||||
# TODO
|
||||
|
@ -35,3 +41,5 @@ tar czvf "${BACKUP_DEST}/gitea-data_$(date +'%Y%m%d').tar.gz" -C "/mnt/APPS/hugi
|
|||
# Double check
|
||||
# gitea doctor --all --log-file /tmp/doctor.log
|
||||
# TODO
|
||||
|
||||
printlog 'Done'
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Backup script for Nextcloud in a kubernetes cluster
|
||||
# Backup script for Nextcloud in a Kubernetes cluster
|
||||
|
||||
PROGRAM_NAME='backup_nextcloud'
|
||||
printlog () {
|
||||
printf '%s: %s\n' "${PROGRAM_NAME}" "${1}"
|
||||
}
|
||||
|
||||
BACKUP_DEST='/mnt/PRIVATE_DOCS/home/backup'
|
||||
PASSFILE='./nextcloud_pass.txt'
|
||||
|
||||
# Create filename for database
|
||||
database_backupfile="nextcloud-sqlbkp_$(date +'%Y%m%d').bak"
|
||||
database_backupfile="nextcloud-sqlbkp_$( date +'%Y%m%d' ).bak"
|
||||
|
||||
# Retrieve container names
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep hugocloud-nextcloud_hugocloud-nextcloud )"
|
||||
|
@ -18,7 +23,7 @@ set -e
|
|||
docker exec --user www-data "${base_container}" php occ maintenance:mode --on
|
||||
|
||||
# Database backup
|
||||
>&2 echo 'Backing up database'
|
||||
printlog 'Backing up database'
|
||||
internal_database_backupfile="/tmp/${database_backupfile}"
|
||||
docker exec --env-file "${PASSFILE}" "${database_container}" pg_dump 'nextcloud' -cwv -h 'localhost' -U 'nextcloud' -f "${internal_database_backupfile}"
|
||||
docker cp "${database_container}":"${internal_database_backupfile}" "${BACKUP_DEST}"
|
||||
|
@ -34,7 +39,7 @@ docker exec --user www-data "${base_container}" php occ maintenance:mode --off
|
|||
|
||||
# Backup cleanup
|
||||
# Only keep 30 days of backups
|
||||
>&2 echo 'Clean up old database backups'
|
||||
printlog 'Clean up old database backups'
|
||||
find "${BACKUP_DEST}" -name '*sqlbkp*' -type f -mtime +30 -print -delete
|
||||
|
||||
>&2 echo 'Done'
|
||||
printlog 'Done'
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#!/bin/bash
|
||||
# Backup script for Vaultwarden in a kubernetes cluster
|
||||
# Backup script for Vaultwarden in a Kubernetes cluster
|
||||
|
||||
PROGRAM_NAME='backup_vaultwarden'
|
||||
printlog () {
|
||||
printf '%s: %s\n' "${PROGRAM_NAME}" "${1}"
|
||||
}
|
||||
|
||||
BACKUP_DEST='/mnt/PRIVATE_DOCS/BACKUPS/vaultwarden'
|
||||
PASSFILE='./vaultwarden_pass.txt'
|
||||
|
||||
# Create filename for database
|
||||
database_backupfile="vaultwarden-sqlbkp_$(date +'%Y%m%d').bak"
|
||||
database_backupfile="vaultwarden-sqlbkp_$( date +'%Y%m%d' ).bak"
|
||||
|
||||
# Retrieve container names
|
||||
base_container="$( docker ps --format '{{.Names}}' | grep vaultwarden_vaultwarden )"
|
||||
|
@ -15,7 +20,7 @@ database_container="$( docker ps --format '{{.Names}}' | grep vaultwarden-postgr
|
|||
set -e
|
||||
|
||||
# Database backup
|
||||
>&2 echo 'Backing up database'
|
||||
printlog 'Backing up database'
|
||||
internal_database_backupfile="/tmp/${database_backupfile}"
|
||||
# Create backup file in docker container
|
||||
docker exec --env-file "${PASSFILE}" "${database_container}" pg_dump 'vaultwarden' -cwv -h 'localhost' -U 'vaultwarden' -f "${internal_database_backupfile}"
|
||||
|
@ -24,13 +29,13 @@ docker cp "${database_container}":"${internal_database_backupfile}" "${BACKUP_DE
|
|||
|
||||
# Files backup
|
||||
for file in 'attachments' 'sends' 'config.json' 'rsa_key.pem' 'rsa_key.pub.pem'; do
|
||||
>&2 printf 'Copying %s\n' "${file}"
|
||||
printlog "$( printf 'Copying %s\n' "${file}" )"
|
||||
docker cp -a "${base_container}":"/data/${file}" "${BACKUP_DEST}"
|
||||
done
|
||||
|
||||
# Backup cleanup
|
||||
# Only keep 30 days of backups, seems about right.
|
||||
>&2 echo 'Cleaning up old database backups'
|
||||
printlog 'Cleaning up old database backups'
|
||||
find "${BACKUP_DEST}" -name '*sqlbkp*' -type f -mtime +30 -print -delete
|
||||
|
||||
>&2 echo 'Done'
|
||||
printlog 'Done'
|
||||
|
|
47
layout.txt
Normal file
47
layout.txt
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
Router------------------------------
|
||||
| (Ethernet)
|
||||
----------------------H------------------------
|
||||
| |
|
||||
| |
|
||||
(Thunderbolt)= =(USB A)-----------Dock 1
|
||||
| |
|
||||
| Dell Precision 7560 |
|
||||
| |
|
||||
---(Thunderbolt)= =(USB A)-----------Dock 2
|
||||
| | |
|
||||
| | |
|
||||
| -----------------------------------------------
|
||||
|
|
||||
|
|
||||
----------------------------
|
||||
|
|
||||
|
|
||||
-----------H------------
|
||||
| |
|
||||
| |
|
||||
AC----(Powerline)= =(Thunderbolt)----4TB Disk 3
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
(Ethernet)= =(USB A)----------2TB Disk
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
4TB Disk 1--------(USB A)= |
|
||||
| |
|
||||
| Dell Docking Station |
|
||||
| |
|
||||
4TB Disk 2--------(USB A)= |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
(DisplayPort)= |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
(HDMI)= |
|
||||
| |
|
||||
| |
|
||||
------------------------
|
||||
|
Loading…
Reference in a new issue