Compare commits

..

No commits in common. "484b601bc078742b8b2ed5cef059fe7c05e14e20" and "df25e8ce001d6559d5ba7685a9b94ac077c13a0e" have entirely different histories.

3 changed files with 6 additions and 18 deletions

View file

@ -67,7 +67,7 @@ k3s kubectl exec "${database_container}" --namespace "${namespace}" -- env $(cat
# Files backup
for file in 'config' 'themes'; do
printf "Copying %s\n" "${file}"
k3s kubectl --namespace "${namespace}" cp "${base_container}":"/var/www/html/${file}" "${destination}"
k3s kubectl cp "${base_container}":"/var/www/html/${file}" "${destination}"
done
# Turn off maintenance mode

View file

@ -1,10 +0,0 @@
[overlay]
type = chunker
remote = Nicole:
[Nicole]
type = ftp
host = 192.168.0.20
user = USERNAME
pass = CHANGEME

View file

@ -41,11 +41,9 @@ else
destination="${1}"
fi
namespace="ix-vaultwarden-2"
# Retrieve container names
base_container="$( k3s kubectl get pods --namespace "${namespace}" | cut -f1 -d' ' | grep -E 'vaultwarden-2-[0-9a-z]{10}-[0-9a-z]{5}' )"
database_container="$( k3s kubectl get pods --namespace "${namespace}" | cut -f1 -d' ' | grep 'vaultwarden-2-cnpg-main-1' )"
base_container="$( docker ps --format '{{.Names}}' | grep -E 'vaultwarden-2_vaultwarden-2-[0-9a-z]{10}-[0-9a-z]{5}' )"
database_container="$( docker ps --format '{{.Names}}' | grep postgres_vaultwarden-2-cnpg-main-1 )"
if ! [[ -n "${base_container}" && -n "${database_container}" ]]; then
>&2 printf "Error: Not all containers could be found.\n"
@ -61,14 +59,14 @@ set -e
database_backupfile="vaultwarden-sqlbkp_$(date +'%Y%m%d').bak"
host_database_backupfile="${destination}/${database_backupfile}"
# Create backup file in Kubernetes pod
# Create backup file in docker container
echo 'Backing up database'
k3s kubectl exec "${database_container}" --namespace "${namespace}" -- env $(cat "${env_file:=.env}" | xargs) pg_dump 'vaultwarden' -cwv -h 'localhost' -U 'vaultwarden' > "${host_database_backupfile}"
docker exec --env-file "${env_file:=.env}" "${database_container}" pg_dump 'vaultwarden' -cwv -h 'localhost' -U 'vaultwarden' > "${host_database_backupfile}"
# Files backup
for file in 'attachments' 'sends' 'rsa_key.pem' 'rsa_key.pub.pem'; do # 'config.json'
printf 'Copying %s\n' "${file}"
k3s kubectl --namespace "${namespace}" cp "${base_container}":"/data/${file}" "${destination}"
docker cp -a "${base_container}":"/data/${file}" "${destination}"
done
# Backup cleanup