]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Docker: add baculatar docker image.
authorRadosław Korzeniewski <radekk@inteos.pl>
Wed, 15 Jan 2020 08:25:40 +0000 (09:25 +0100)
committerRadosław Korzeniewski <radekk@inteos.pl>
Wed, 15 Jan 2020 08:25:40 +0000 (09:25 +0100)
bacula/src/plugins/fd/docker/baculatar/Dockerfile [new file with mode: 0644]
bacula/src/plugins/fd/docker/baculatar/README [new file with mode: 0644]
bacula/src/plugins/fd/docker/baculatar/baculatar [new file with mode: 0755]
bacula/src/plugins/fd/docker/baculatar/createimage.sh [new file with mode: 0755]
bacula/src/plugins/fd/docker/baculatar/tar [new file with mode: 0755]

diff --git a/bacula/src/plugins/fd/docker/baculatar/Dockerfile b/bacula/src/plugins/fd/docker/baculatar/Dockerfile
new file mode 100644 (file)
index 0000000..9852a03
--- /dev/null
@@ -0,0 +1,33 @@
+#
+#   Bacula® - The Network Backup Solution
+#
+#   Copyright (C) 2007-2017 Bacula Systems SA
+#   All rights reserved.
+#
+#   The main author of Bacula is Kern Sibbald, with contributions from many
+#   others, a complete list can be found in the file AUTHORS.
+#
+#   Licensees holding a valid Bacula Systems SA license may use this file
+#   and others of this release in accordance with the proprietary license
+#   agreement provided in the LICENSE file.  Redistribution of any part of
+#   this release is not permitted.
+#
+#   Bacula® is a registered trademark of Kern Sibbald.
+#
+#
+# Copyright (c) 2019 by Inteos sp. z o.o.
+# All rights reserved. IP transfered to Bacula Systems according to agreement.
+#
+# This is a Bacula container for backup/restore Docker volumes using archive tools.
+# Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+#
+FROM busybox:latest
+LABEL maintainer="Radosław Korzeniewski <radekk@inteos.pl>"
+LABEL org.label-schema.schema-version="1.0"
+LABEL org.label-schema.description="This is a Bacula container for backup/restore Docker volumes using archive tools."
+LABEL org.label-schema.vendor="Bacula Systems S.A."
+LABEL org.label-schema.version="1.2"
+COPY baculatar /baculatar
+COPY tar /tar
+CMD ["/baculatar", "backup"]
+ENTRYPOINT ["/baculatar"]
diff --git a/bacula/src/plugins/fd/docker/baculatar/README b/bacula/src/plugins/fd/docker/baculatar/README
new file mode 100644 (file)
index 0000000..0954b24
--- /dev/null
@@ -0,0 +1,10 @@
+The Docker Plugin uses a static version of tar to backup/restore
+Docker external volumes.
+
+To doing so it needs 
+ - a full C building toolchain 
+ - the upx executable compression library
+
+A full Internet access for downloading required source code and dependencies.
+
+You should provide them for a successful build.
diff --git a/bacula/src/plugins/fd/docker/baculatar/baculatar b/bacula/src/plugins/fd/docker/baculatar/baculatar
new file mode 100755 (executable)
index 0000000..c7699dd
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2020 Kern Sibbald
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
+# This is a Bacula archive tool for backup/restore files on Docker volumes.
+# Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+#
+#echo "EXEC:" $0
+#echo "ARGV:" $*
+
+if [ "x$0" == "x$1" ]
+then
+   shift 1
+fi
+ARGV="backup"
+if [ "x$1" != "x" ]
+then
+   ARGV=$1
+fi
+#echo "params:" $ARGV
+if [ $ARGV == "gimmetheshell" ]
+then
+   exec /bin/sh
+fi
+
+rm -f /logs/docker.err /logs/docker.log
+RC=0
+
+# this is an ack to plugin to confirm proper execution
+echo "200:OK"
+
+case $ARGV in
+   "backup")
+      /tar -cvvf /logs/fout -C /backup . 2> /logs/docker.err > /logs/docker.log
+      RC=$?
+      ;;
+   "restore")
+      /tar -xvvf /logs/fin -C /restore 2> /logs/docker.err > /logs/docker.log
+      RC=$?
+      ;;
+   "*")
+      echo "404:Invalid option!" > /logs/docker.err
+esac
+if [ $RC -ne 0 ]
+then
+   echo "500:exit status: $RC" >> /logs/docker.err
+fi
+exit 0
diff --git a/bacula/src/plugins/fd/docker/baculatar/createimage.sh b/bacula/src/plugins/fd/docker/baculatar/createimage.sh
new file mode 100755 (executable)
index 0000000..840bf5b
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+#   Bacula(R) - The Network Backup Solution
+#
+#   Copyright (C) 2000-2020 Kern Sibbald
+#
+#   The original author of Bacula is Kern Sibbald, with contributions
+#   from many others, a complete list can be found in the file AUTHORS.
+#
+#   You may use this file and others of this release according to the
+#   license defined in the LICENSE file, which includes the Affero General
+#   Public License, v3.0 ("AGPLv3") and some additional permissions and
+#   terms pursuant to its AGPLv3 Section 7.
+#
+#   This notice must be preserved when any source code is
+#   conveyed and/or propagated.
+#
+#   Bacula(R) is a registered trademark of Kern Sibbald.
+#
+# This is a Bacula archive tool for backup/restore files on Docker volumes.
+# Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o.
+#
+echo "This script will build a custom static BaculaTar archive!"
+echo
+echo "To doing so it needs a full C building toolchain, upx executable compression library"
+echo "and full Internet access for downloading required source code and dependencies."
+echo "You should provide it for successful build."
+echo
+echo "When ready - hit enter -"
+if [ "x$1" != "xyes" ]
+then
+   read a
+fi
+rm -rf archbuild
+git clone https://github.com/ebl/tar-static.git archbuild
+cd archbuild
+./build.sh
+cd ..
+cp archbuild/releases/tar .
+rm -rf archbuild
+#D=`date +%d%b%y`
+D=`grep DOCKER_TAR_IMAGE ../../../../version.h | awk '{print $3}' | sed 's/"//g'`
+docker build -t baculatar:$D .
+docker tag baculatar:$D baculatar:latest
+docker save -o baculatar-$D.docker.tar baculatar:latest
diff --git a/bacula/src/plugins/fd/docker/baculatar/tar b/bacula/src/plugins/fd/docker/baculatar/tar
new file mode 100755 (executable)
index 0000000..e6ad7d6
Binary files /dev/null and b/bacula/src/plugins/fd/docker/baculatar/tar differ