summaryrefslogtreecommitdiff
path: root/deploy.sh
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-07 16:47:47 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-07 16:54:08 +0200
commit2f41b9e4418def9b69cf237312bc592364585025 (patch)
tree64291839896a796526d4118311f37faf67888a39 /deploy.sh
parent235266ec53f620d94a080ed7ae8e77eaef6dbb3c (diff)
Moved deploy.sh to bin folder
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh72
1 files changed, 0 insertions, 72 deletions
diff --git a/deploy.sh b/deploy.sh
deleted file mode 100755
index f1569a61..00000000
--- a/deploy.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-remote_host=
-remote_path=
-deploy_id=
-
-show_help(){
- echo "Usage: $0 [OPTION]..." >&2
- echo "Deploys a software with rsync over ssh" >&2
- echo "The options -i, -p and -r are required" >&2
- echo "" >&2
- echo " -h Display this help screen" >&2
- echo " -i <id> Sets the id, a unique name for the deployment" >&2
- echo " -p <path> Define the base path on the server" >&2
- echo " -r <host> The remote server name and user" >&2
-}
-
-while getopts ":hi:p:r:" opt; do
- case ${opt} in
- h)
- show_help
- exit 1
- ;;
- r)
- remote_host="$OPTARG"
- ;;
- p)
- remote_path="$OPTARG"
- ;;
- i)
- deploy_id="$OPTARG"
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- exit 1
- ;;
- :)
- echo "The option -$OPTARG requires an argument" >&2
- exit 1
- ;;
- esac
-done
-
-if [ -z "${remote_host}" ] || [ -z "${remote_path}" ] || [ -z "${deploy_id}" ]; then
- show_help
- exit 1
-fi
-
-echo "syncing ${PWD}/ to ${remote_host}:${remote_path}/${deploy_id}/"
-
-rsync -vAax --exclude '.git*' --exclude .composer/ \
- -e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
- ./ "${remote_host}:${remote_path}/${deploy_id}/"
-
-ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${remote_host}" "
- set -e
-
- if [[ -f \"${remote_path}/current/config/config.php\" ]]; then
- echo \"Config backup\"
- cp \"${remote_path}/current/config/config.php\" \"${deploy_id}-config.php\"
- fi
-
- echo \"Changing symlink\"
- unlink \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\"
-
- if [[ -f \"${deploy_id}-config.php\" ]]; then
- echo \"Restoring config\"
- cp \"${deploy_id}-config.php\" \"${remote_path}/current/config/config.php\"
- fi
-"