Initial commit
This commit is contained in:
Коммит
2295aefe1f
|
@ -0,0 +1,10 @@
|
|||
FROM fish/docker-backup
|
||||
MAINTAINER Johannes 'fish' Ziemke <fish@docker.com>
|
||||
|
||||
RUN apt-get update && apt-get -y -q install python-setuptools python-dateutil python-magic
|
||||
RUN git clone https://github.com/s3tools/s3cmd.git /s3cmd
|
||||
RUN cd /s3cmd && python setup.py install
|
||||
|
||||
ADD run /docker-backup/
|
||||
ADD s3cfg /.s3cfg
|
||||
ENTRYPOINT [ "./run" ]
|
|
@ -0,0 +1,20 @@
|
|||
# docker-lloyd
|
||||
*[Lloyd's Coffee House](http://en.wikipedia.org/wiki/Lloyd%27s_Coffee_House)
|
||||
was the first marine insurance company.*
|
||||
|
||||
This tools backups Docker [volume containers](http://docs.docker.io/en/latest/use/working_with_volumes/#creating-and-mounting-a-data-volume-container)
|
||||
and stores them on s3.
|
||||
|
||||
To use it, run:
|
||||
|
||||
$ docker run -v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v /var/lib/docker/vfs/dir:/var/lib/docker/vfs/dir \
|
||||
-e ACCESS_KEY=... -e SECRET_KEY=... docker-backup-daemon \
|
||||
s3://<BUCKET> container-a container-b container-c...
|
||||
|
||||
This will run [docker-backup](https://github.com/discordianfish/docker-backup),
|
||||
gzip and upload a tarball named after the container to S3.
|
||||
|
||||
|
||||
See [docker-backup](https://github.com/discordianfish/docker-backup) on
|
||||
how to restore a backup.
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
TIMEOUT=86400 # 24 hours
|
||||
BACKUPS=/backups
|
||||
|
||||
BUCKET=$1
|
||||
if [ -z "$BUCKET" ]
|
||||
then
|
||||
echo "$0 bucket container [container...]"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
|
||||
if [ -z "$ACCESS_KEY" -o -z "$SECRET_KEY" ]
|
||||
then
|
||||
echo "Please set ACCESS_KEY and SECRET_KEY environment variables"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
[ -d "$BACKUPS" ] || mkdir "$BACKUPS"
|
||||
|
||||
backup() {
|
||||
echo "[=] $1"
|
||||
while true
|
||||
do
|
||||
echo "$1: Backup"
|
||||
/docker-backup/docker-backup store "$BACKUPS/$1.tar" "$1"
|
||||
gzip "$BACKUPS/$1.tar"
|
||||
|
||||
echo "$1: Upload"
|
||||
s3cmd --access_key="$ACCESS_KEY" --secret_key="$SECRET_KEY" \
|
||||
-c /dev/null $S3CMD_OPTS put "$BACKUPS/$1.tar.gz" $BUCKET
|
||||
rm "$BACKUPS/$1.tar.gz"
|
||||
|
||||
echo "$1: Sleep"
|
||||
sleep $TIMEOUT
|
||||
done
|
||||
}
|
||||
|
||||
for c in $@
|
||||
do
|
||||
backup $c &
|
||||
done
|
||||
|
||||
wait
|
|
@ -0,0 +1,63 @@
|
|||
[default]
|
||||
access_key =
|
||||
access_token =
|
||||
add_encoding_exts =
|
||||
add_headers =
|
||||
bucket_location = US
|
||||
cache_file =
|
||||
cloudfront_host = cloudfront.amazonaws.com
|
||||
default_mime_type = binary/octet-stream
|
||||
delay_updates = False
|
||||
delete_after = False
|
||||
delete_after_fetch = False
|
||||
delete_removed = False
|
||||
dry_run = False
|
||||
enable_multipart = True
|
||||
encoding = ANSI_X3.4-1968
|
||||
encrypt = False
|
||||
expiry_date =
|
||||
expiry_days =
|
||||
expiry_prefix =
|
||||
follow_symlinks = False
|
||||
force = False
|
||||
get_continue = False
|
||||
gpg_command = /usr/bin/gpg
|
||||
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
||||
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
|
||||
gpg_passphrase =
|
||||
guess_mime_type = True
|
||||
host_base = s3.amazonaws.com
|
||||
host_bucket = %(bucket)s.s3.amazonaws.com
|
||||
human_readable_sizes = False
|
||||
ignore_failed_copy = False
|
||||
invalidate_default_index_on_cf = False
|
||||
invalidate_default_index_root_on_cf = True
|
||||
invalidate_on_cf = False
|
||||
list_md5 = False
|
||||
log_target_prefix =
|
||||
max_delete = -1
|
||||
mime_type =
|
||||
multipart_chunk_size_mb = 15
|
||||
preserve_attrs = True
|
||||
progress_meter = True
|
||||
proxy_host =
|
||||
proxy_port = 0
|
||||
put_continue = False
|
||||
recursive = False
|
||||
recv_chunk = 4096
|
||||
reduced_redundancy = False
|
||||
restore_days = 1
|
||||
secret_key =
|
||||
send_chunk = 4096
|
||||
server_side_encryption = False
|
||||
simpledb_host = sdb.amazonaws.com
|
||||
skip_existing = False
|
||||
socket_timeout = 300
|
||||
urlencoding_mode = normal
|
||||
use_https = True
|
||||
use_mime_magic = True
|
||||
verbosity = WARNING
|
||||
website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/
|
||||
website_error =
|
||||
website_index = index.html
|
||||
|
Загрузка…
Ссылка в новой задаче