Compare commits
No commits in common. "31ae1e0d8f0af8a95527c805e97f561f5914cded" and "fd2d8cb17c11e1e2df3ba6bac964fc3e902a9daa" have entirely different histories.
31ae1e0d8f
...
fd2d8cb17c
16
backup.sh
16
backup.sh
@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# List of volume names
|
|
||||||
volumes=("selfhosted-owncloud_certs" "selfhosted-owncloud_ocis-config" "selfhosted-owncloud_ocis-data" "selfhosted-owncloud_wopi-recovery")
|
|
||||||
|
|
||||||
# Destination directory for backup
|
|
||||||
backup_dir=$(pwd)
|
|
||||||
|
|
||||||
# Loop through the volumes and create backups
|
|
||||||
for volume in "${volumes[@]}"; do
|
|
||||||
echo "Backing up volume: $volume"
|
|
||||||
docker run --rm -v "$volume":/volume -v "$backup_dir":/backup alpine:latest tar -czvf "/backup/$volume-backup.tar.gz" -C /volume .
|
|
||||||
echo "Backup of volume $volume completed."
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "All backups completed."
|
|
||||||
@ -30,6 +30,17 @@ services:
|
|||||||
- "--accessLog=true"
|
- "--accessLog=true"
|
||||||
- "--accessLog.format=json"
|
- "--accessLog.format=json"
|
||||||
- "--accessLog.fields.headers.names.X-Request-Id=keep"
|
- "--accessLog.fields.headers.names.X-Request-Id=keep"
|
||||||
|
# - --log.level=INFO
|
||||||
|
# - --api.dashboard=true
|
||||||
|
# - --api.insecure=false
|
||||||
|
# - --providers.docker=true
|
||||||
|
# - --providers.docker.swarmMode=true
|
||||||
|
# - --providers.docker.exposedByDefault=false
|
||||||
|
# - --entrypoints.web.address=:80
|
||||||
|
# - --entrypoints.websecure.address=:443
|
||||||
|
# - --certificatesresolvers.mytlschallenge.acme.tlschallenge=true
|
||||||
|
# - --certificatesresolvers.mytlschallenge.acme.email=${TRAEFIK_ACME_MAIL}
|
||||||
|
# - --certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
|
|||||||
39
restore.sh
39
restore.sh
@ -1,39 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# List of volume names (corresponding to the backup files)
|
|
||||||
volumes=("selfhosted-owncloud_certs" "selfhosted-owncloud_ocis-config" "selfhosted-owncloud_ocis-data" "selfhosted-owncloud_wopi-recovery")
|
|
||||||
|
|
||||||
# Directory where the backup files are located on the new machine
|
|
||||||
backup_dir="/var/www/owncloud"
|
|
||||||
|
|
||||||
# Loop through the volumes and restore backups
|
|
||||||
for volume in "${volumes[@]}"; do
|
|
||||||
backup_file="${volume}-backup.tar.gz"
|
|
||||||
|
|
||||||
# Check if the backup file exists
|
|
||||||
if [ -f "$backup_dir/$backup_file" ]; then
|
|
||||||
echo "Restoring backup for volume: $volume"
|
|
||||||
|
|
||||||
# Use docker inspect to get the host directory path for the volume
|
|
||||||
host_dir=$(docker volume inspect "$volume" --format '{{ .Mountpoint }}')
|
|
||||||
echo $host_dir
|
|
||||||
chmod -R 755 $host_dir
|
|
||||||
|
|
||||||
if [ -n "$host_dir" ]; then
|
|
||||||
# Create the volume if it doesn't exist
|
|
||||||
docker volume create "$volume"
|
|
||||||
|
|
||||||
# Extract the backup file to the volume's host directory
|
|
||||||
# docker run --rm -v "$volume":/volume -v "$backup_dir":/backup alpine:latest tar -xzvf "/backup/$backup_file" -C "$host_dir"
|
|
||||||
tar -xzvf "$backup_dir/$backup_file" -C "$host_dir"
|
|
||||||
|
|
||||||
echo "Backup for volume $volume restored."
|
|
||||||
else
|
|
||||||
echo "Failed to determine host directory for volume $volume. Skipping."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Backup file for volume $volume not found in $backup_dir. Skipping."
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "All backups restored."
|
|
||||||
Loading…
x
Reference in New Issue
Block a user