Depreciate and remove dokku backup plugin, replace with documentation
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
APPS="$(< "$4" )"
|
||||
|
||||
ret=0
|
||||
|
||||
for app in $APPS; do
|
||||
if [[ -d $TARGET_DIR/$app ]]; then
|
||||
ret=1
|
||||
echo "Trying to import application $app which already exists." 2>&1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $ret
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat;
|
||||
[[ -f $BASE_DIR/.sshcommand ]] && echo "$BASE_DIR/.sshcommand"
|
||||
[[ -f $BASE_DIR/.ssh/authorized_keys ]] && echo "$BASE_DIR/.ssh/authorized_keys"
|
||||
[[ -f $BASE_DIR/HOSTNAME ]] && echo "$BASE_DIR/HOSTNAME"
|
||||
[[ -f $BASE_DIR/VHOST ]] && echo "$BASE_DIR/VHOST"
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
[[ -f $IMPORT_DIR/.sshcommand ]] && mv "$IMPORT_DIR/.sshcommand" "$TARGET_DIR/.sshcommand"
|
||||
if [[ -f $IMPORT_DIR/.ssh/authorized_keys ]]; then
|
||||
mkdir -p "$TARGET_DIR/.ssh"
|
||||
cat "$IMPORT_DIR/.ssh/authorized_keys" "$TARGET_DIR/.ssh/authorized_keys" | uniq > tmpfile && mv tmpfile "$TARGET_DIR/.ssh/authorized_keys"
|
||||
chmod 0700 "$TARGET_DIR/.ssh"
|
||||
chmod 0600 "$TARGET_DIR"/.ssh/*
|
||||
fi
|
||||
[[ -f $IMPORT_DIR/HOSTNAME ]] && mv "$IMPORT_DIR/HOSTNAME" "$TARGET_DIR/HOSTNAME"
|
||||
[[ -f $IMPORT_DIR/VHOST ]] && mv "$IMPORT_DIR/VHOST" "$TARGET_DIR/VHOST"
|
||||
@@ -1 +0,0 @@
|
||||
hook
|
||||
@@ -1 +0,0 @@
|
||||
hook
|
||||
@@ -1 +0,0 @@
|
||||
hook
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " backup:export backup:import help backup:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
backup:export)
|
||||
CURRENT_BACKUP_VERSION=1
|
||||
OUTPUT_FILE="$2"
|
||||
BACKUP_DIR="$DOKKU_ROOT"
|
||||
|
||||
BACKUP_TMP_DIR=$(mktemp -d)
|
||||
BACKUP_TMP_FILE="$BACKUP_TMP_DIR/backup.tar"
|
||||
|
||||
: | plugn trigger backup-export 1 "$BACKUP_DIR" | tar -cf "$BACKUP_TMP_FILE" --files-from -
|
||||
|
||||
pushd "$BACKUP_DIR" > /dev/null
|
||||
find . -maxdepth 1 -type d -not -name . | sed 's:./::g' > "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
popd > /dev/null
|
||||
|
||||
# we want to insert the files in the root of the tar
|
||||
pushd "$BACKUP_TMP_DIR" > /dev/null
|
||||
echo $CURRENT_BACKUP_VERSION > .dokku_backup_version
|
||||
tar --append -f "$BACKUP_TMP_FILE" .dokku_backup_version
|
||||
tar --append -f "$BACKUP_TMP_FILE" .dokku_backup_apps
|
||||
popd > /dev/null
|
||||
|
||||
# if no file specified, output to stdout
|
||||
if [[ -z $OUTPUT_FILE ]]; then
|
||||
cat "$BACKUP_TMP_FILE"
|
||||
else
|
||||
mv "$BACKUP_TMP_FILE" "$OUTPUT_FILE"
|
||||
fi
|
||||
|
||||
rm -rf "$BACKUP_TMP_DIR"
|
||||
;;
|
||||
|
||||
backup:import)
|
||||
if [[ $2 == "-f" ]]; then
|
||||
force=true
|
||||
shift
|
||||
else
|
||||
force=false
|
||||
fi
|
||||
|
||||
INPUT_FILE="$2"
|
||||
[[ -z $INPUT_FILE ]] && INPUT_FILE="-"
|
||||
|
||||
BACKUP_TMP_DIR=$(mktemp -d)
|
||||
|
||||
tar xf $INPUT_FILE --directory="$BACKUP_TMP_DIR"
|
||||
|
||||
if [[ ! -f $BACKUP_TMP_DIR/.dokku_backup_version ]]; then
|
||||
dokku_log_fail "Unable to determine backup version"
|
||||
fi
|
||||
|
||||
VERSION=$(< "$BACKUP_TMP_DIR/.dokku_backup_version")
|
||||
if [[ $VERSION -ne 1 ]]; then
|
||||
dokku_log_fail "Unknown format version $VERSION"
|
||||
fi
|
||||
|
||||
echo "Importing a version $VERSION backup..."
|
||||
|
||||
BACKUP_ROOT="$BACKUP_TMP_DIR""$DOKKU_ROOT"
|
||||
TARGET_DIR="$DOKKU_ROOT"
|
||||
|
||||
if ! plugn trigger backup-check "$VERSION" "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"; then
|
||||
if $force; then
|
||||
echo "-f used. Ignoring warnings."
|
||||
else
|
||||
dokku_log_fail "Archive did not pass sanity checks. Use -f to import anyway"
|
||||
fi
|
||||
fi
|
||||
|
||||
# create all the app directories
|
||||
while read -r app; do mkdir "$TARGET_DIR/$app"; echo "Imported $app"; done < "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
|
||||
# have the plugins import their stuff
|
||||
plugn trigger backup-import "$VERSION" "$BACKUP_ROOT" "$TARGET_DIR" "$BACKUP_TMP_DIR/.dokku_backup_apps"
|
||||
|
||||
rm -rf "$BACKUP_TMP_DIR"
|
||||
|
||||
echo "Import complete."
|
||||
;;
|
||||
|
||||
help | backup:help)
|
||||
cat<<EOF
|
||||
backup:export [file], Export dokku configuration files
|
||||
backup:import [file], Import dokku configuration files
|
||||
EOF
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
|
||||
esac
|
||||
@@ -1,4 +0,0 @@
|
||||
[plugin]
|
||||
description = "dokku core backup plugin"
|
||||
version = "0.4.0"
|
||||
[plugin.config]
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat; for i in $BASE_DIR/*/ENV; do echo "$i"; done
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
cd "$IMPORT_DIR"
|
||||
for file in */ENV; do
|
||||
cp "$file" "$TARGET_DIR/$file"
|
||||
done
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat; for i in $BASE_DIR/*/VHOST; do echo "$i"; done
|
||||
cat; for i in $BASE_DIR/*/nginx.conf.template; do echo "$i"; done
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
cd "$IMPORT_DIR"
|
||||
for file in */VHOST; do
|
||||
cp "$file" "$TARGET_DIR/$file"
|
||||
done
|
||||
for file in */nginx.conf.template; do
|
||||
cp "$file" "$TARGET_DIR/$file"
|
||||
done
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
APPS="$4"
|
||||
|
||||
while read -r APP; do
|
||||
APP_PATH="$TARGET_DIR/$APP";
|
||||
git init --bare "$APP_PATH" > /dev/null
|
||||
PRERECEIVE_HOOK="$APP_PATH/hooks/pre-receive"
|
||||
cat > "$PRERECEIVE_HOOK" <<EOF
|
||||
#!/usr/bin/env bash
|
||||
set -e; set -o pipefail;
|
||||
|
||||
cat | DOKKU_ROOT="$DOKKU_ROOT" dokku git-hook "$APP"
|
||||
EOF
|
||||
chmod +x "$PRERECEIVE_HOOK"
|
||||
done < "$APPS" > /dev/null
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
BASE_DIR="$2"
|
||||
|
||||
cat; for i in $BASE_DIR/*/tls/server.*; do echo "$i"; done
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
VERSION="$1"
|
||||
IMPORT_DIR="$2"
|
||||
TARGET_DIR="$3"
|
||||
|
||||
cd "$IMPORT_DIR"
|
||||
|
||||
for file in */tls/server.*; do
|
||||
mkdir -p "$(dirname "$TARGET_DIR$file")"
|
||||
cp "$file" "$TARGET_DIR$file"
|
||||
done
|
||||
Reference in New Issue
Block a user