Ditch s3cmd for aws cli
This commit is contained in:
parent
024b5751da
commit
1ddcb07126
11
Dockerfile
11
Dockerfile
|
@ -1,13 +1,10 @@
|
|||
FROM ubuntu:14.04
|
||||
MAINTAINER Dave Newman <dave@assembly.com>
|
||||
|
||||
RUN apt-get update && apt-get -y -q install git python-setuptools python-dateutil python-magic
|
||||
RUN git clone https://github.com/s3tools/s3cmd.git /s3cmd
|
||||
RUN cd /s3cmd && python setup.py install
|
||||
|
||||
ADD s3cfg /.s3cfg
|
||||
ADD run.sh run.sh
|
||||
RUN apt-get update && apt-get install -y awscli
|
||||
ADD watch /watch
|
||||
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT [ "./run.sh", "/data" ]
|
||||
ENTRYPOINT [ "./watch" ]
|
||||
CMD ["/data"]
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
Vagrant.configure('2') do |config|
|
||||
config.vm.box = "phusion/ubuntu-14.04-amd64"
|
||||
|
||||
config.vm.provision :shell, inline: <<SCRIPT
|
||||
apt-get update
|
||||
apt-get -y install docker.io
|
||||
ln -sf /usr/bin/docker.io /usr/local/bin/docker
|
||||
chmod 777 /var/run/docker.sock
|
||||
sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io
|
||||
SCRIPT
|
||||
|
||||
|
||||
# for speeds
|
||||
config.vm.network :private_network, ip: "192.168.50.9"
|
||||
config.vm.synced_folder ".", "/vagrant", type: "nfs"
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
||||
end
|
||||
end
|
|
@ -42,13 +42,6 @@ PROGNAME=$0
|
|||
LOCAL=$1
|
||||
REMOTE=$2
|
||||
|
||||
echo "$# $LOCAL $REMOTE $FORCE_RESTORE"
|
||||
|
||||
if [ $# != "2" ]; then
|
||||
usage
|
||||
error_exit "not enough arguments"
|
||||
fi
|
||||
|
||||
function restore {
|
||||
if [ "$(ls -A $LOCAL)" ]; then
|
||||
if [[ ${FORCE_RESTORE:false} == 'true' ]]; then
|
||||
|
@ -57,14 +50,14 @@ function restore {
|
|||
fi
|
||||
|
||||
echo "restoring $REMOTE => $LOCAL"
|
||||
if ! s3cmd --access_key="$ACCESS_KEY" --secret_key="$SECRET_KEY" sync "$REMOTE/" "$LOCAL/"; then
|
||||
if ! aws s3 sync "$REMOTE" "$LOCAL"; then
|
||||
error_exit "restore failed"
|
||||
fi
|
||||
}
|
||||
|
||||
function backup {
|
||||
echo "backup $LOCAL => $REMOTE"
|
||||
if ! s3cmd --access_key="$ACCESS_KEY" --secret_key="$SECRET_KEY" sync --delete-removed "$LOCAL/" "$REMOTE/"; then
|
||||
if ! aws s3 sync "$LOCAL" "$REMOTE"; then
|
||||
echo "backup failed" 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
@ -72,7 +65,7 @@ function backup {
|
|||
|
||||
function final_backup {
|
||||
echo "backup $LOCAL => $REMOTE"
|
||||
while ! s3cmd --access_key="$ACCESS_KEY" --secret_key="$SECRET_KEY" sync --delete-removed "$LOCAL/" "$REMOTE/"; do
|
||||
while ! aws s3 sync "$LOCAL" "$REMOTE"; do
|
||||
echo "backup failed" 1>&2
|
||||
sleep 1
|
||||
done
|
Loading…
Reference in New Issue