From: Radosław Korzeniewski Date: Wed, 15 Jan 2020 08:25:40 +0000 (+0100) Subject: Docker: add baculatar docker image. X-Git-Tag: Release-9.6.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d4846a65420ae9567bb197b38adff3eca0741bd;p=thirdparty%2Fbacula.git Docker: add baculatar docker image. --- diff --git a/bacula/src/plugins/fd/docker/baculatar/Dockerfile b/bacula/src/plugins/fd/docker/baculatar/Dockerfile new file mode 100644 index 000000000..9852a03a1 --- /dev/null +++ b/bacula/src/plugins/fd/docker/baculatar/Dockerfile @@ -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 " +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 index 000000000..0954b24d7 --- /dev/null +++ b/bacula/src/plugins/fd/docker/baculatar/README @@ -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 index 000000000..c7699dd46 --- /dev/null +++ b/bacula/src/plugins/fd/docker/baculatar/baculatar @@ -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 index 000000000..840bf5b92 --- /dev/null +++ b/bacula/src/plugins/fd/docker/baculatar/createimage.sh @@ -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 index 000000000..e6ad7d666 Binary files /dev/null and b/bacula/src/plugins/fd/docker/baculatar/tar differ