Skip to content

Commit 68dba98

Browse files
committed
docker-scripts
1 parent cd602f9 commit 68dba98

File tree

6 files changed

+68
-0
lines changed

6 files changed

+68
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
3rdparty/busybox.exe filter=lfs diff=lfs merge=lfs -text
2+
3rdparty/busybox64.exe filter=lfs diff=lfs merge=lfs -text

3rdparty/busybox.exe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:dd6b2fc4d4809ff39f0e738c0dcb85624187abf3e3239043bdd4e64bb4ba8ec3
3+
size 614926

3rdparty/busybox64.exe

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:6d2dfd1c1412c3550a89071a1b36a6f6073844320e687343d1dfc72719ecb8d9
3+
size 659968

tools/docker-volume-snapshot.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
4+
programname=`basename "$0"`
5+
6+
display_usage() {
7+
echo "usage: $programname (create|restore) source destination"
8+
echo " create create snapshot file from docker volume"
9+
echo " restore restore snapshot file to docker volume"
10+
echo " source source path"
11+
echo " destination destination path"
12+
echo
13+
echo "Tip: Supports tar's compression algorithms automatically"
14+
echo " based on the file extention, for example .tar.gz"
15+
echo
16+
echo "Examples:"
17+
echo "docker-volume-snapshot create xyz_volume xyz_volume.tar"
18+
echo "docker-volume-snapshot create xyz_volume xyz_volume.tar.gz"
19+
echo "docker-volume-snapshot restore xyz_volume.tar xyz_volume"
20+
echo "docker-volume-snapshot restore xyz_volume.tar.gz xyz_volume"
21+
}
22+
23+
case "$1" in
24+
"create")
25+
if [[ -z "$2" || -z "$3" ]]; then display_usage; exit 1; fi
26+
directory=`dirname "$3"`
27+
if [ "$directory" == "." ]; then directory=$(pwd); fi
28+
filename=`basename "$3"`
29+
docker run --rm -v "$2:/source" -v "$directory:/dest" busybox tar cvaf "/dest/$filename" -C /source .
30+
;;
31+
"restore")
32+
if [[ -z "$2" || -z "$3" ]]; then display_usage; exit 1; fi
33+
directory=`dirname "$2"`
34+
if [ "$directory" == "." ]; then directory=$(pwd); fi
35+
filename=`basename "$2"`
36+
docker run --rm -v "$3:/dest" -v "$directory:/source" busybox tar xvf "/source/$filename" -C /dest
37+
;;
38+
*)
39+
display_usage
40+
exit 1 # Command to come out of the program with status 1
41+
;;
42+
esac

tools/docker_backup.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-builds appwrite_appwrite-builds.tar
2+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-cache appwrite_appwrite-cache.tar
3+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-certificates appwrite_appwrite-certificates.tar
4+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-config appwrite_appwrite-config.tar
5+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-functions appwrite_appwrite-functions.tar
6+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-influxdb appwrite_appwrite-influxdb.tar
7+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-mariadb appwrite_appwrite-mariadb.tar
8+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-redis appwrite_appwrite-redis.tar
9+
call .\busybox.exe bash .\docker-volume-snapshot.sh create appwrite_appwrite-uploads appwrite_appwrite-uploads.tar

tools/docker_restore.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-builds.tar appwrite_appwrite-builds
2+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-cache.tar appwrite_appwrite-cache
3+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-certificates.tar appwrite_appwrite-certificates
4+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-config.tar appwrite_appwrite-config
5+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-functions.tar appwrite_appwrite-functions
6+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-influxdb.tar appwrite_appwrite-influxdb
7+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-mariadb.tar appwrite_appwrite-mariadb
8+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-redis.tar appwrite_appwrite-redis
9+
call .\busybox.exe bash .\docker-volume-snapshot.sh restore appwrite_appwrite-uploads.tar appwrite_appwrite-uploads

0 commit comments

Comments
 (0)