From 3564f8b93fdac0efb3e44d385431bae8d3e10f6b Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Tue, 29 Jun 2021 03:02:33 +0200 Subject: [PATCH] adds docker-deploy --- .gitignore | 1 + src/docker-deploy.sh | 466 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 467 insertions(+) create mode 100755 src/docker-deploy.sh diff --git a/.gitignore b/.gitignore index f8e38c8..8866042 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea joomla +openssh traefik portainer diff --git a/src/docker-deploy.sh b/src/docker-deploy.sh new file mode 100755 index 0000000..b20cbec --- /dev/null +++ b/src/docker-deploy.sh @@ -0,0 +1,466 @@ +#!/bin/bash + +# BOT name +BOT_NAME="docker-deploy v1.0" + +# the src folder path (where all the script are found) +export VDM_SRC_PATH="/home/update/this/path/to/src" + +# we load global environment values +# shellcheck disable=SC2015 +[ -f "${VDM_SRC_PATH}/.env" ] && source "${VDM_SRC_PATH}/.env" || { + echo "${VDM_SRC_PATH}/.env file not found, please run install." + exit 1 +} + +# check that our repository path is correct +[ -e "${VDM_REPO_PATH}" ] || { + echo "Repository path (${VDM_REPO_PATH}) does not exist." + exit 1 +} +# check that our projects path is correct +[ -e "${VDM_PROJECT_PATH}" ] || { + echo "Projects path (${VDM_PROJECT_PATH}) does not exist." + exit 1 +} + +# help message ʕ•ᴥ•ʔ +function show_help() { + cat < + set type you would like to work with + example: ${0##*/:-} --type joomla + ====================================================== + --task + set type of task you would like to perform + example: ${0##*/:-} --task setup + ====================================================== + --update + to update your install + example: ${0##*/:-} --update + ====================================================== + --uninstall + to uninstall this script + example: ${0##*/:-} --uninstall + ====================================================== + AVAILABLE FOR TO ANY CONTAINER + ====================================================== + -k|--key + set key for the docker compose container naming + !! no spaces allowed in the key !! + example: ${0##*/:-} -k="vdm" + example: ${0##*/:-} --key="vdm" + ====================================================== + -e|--env-key + set key for the environment variable naming + !! no spaces allowed in the key & must be UPPERCASE !! + example: ${0##*/:-} -e="VDM" + example: ${0##*/:-} --env-key="VDM" + ====================================================== + -d|--domain + set key website domain + !! must be domain.tld !! + example: ${0##*/:-} -d="vdm.dev" + example: ${0##*/:-} --domain="vdm.dev" + ====================================================== + AVAILABLE FOR JOOMLA CONTAINER + ====================================================== + -j|--joomla-version + set Joomla version number + !! only number allowed !! + example: ${0##*/:-} -j=3.10 + example: ${0##*/:-} --joomla-version=3.10 + ====================================================== + -s|--sub-domain + set key website sub domain + !! no spaces allowed in the sub domain !! + example: ${0##*/:-} -s="jcb" + example: ${0##*/:-} --sub-domain="jcb" + ====================================================== + AVAILABLE FOR OPENSSH CONTAINER + ====================================================== + -u|--username + set username of the container + example: ${0##*/:-} -u="ubuntu" + example: ${0##*/:-} --username="ubuntu" + ====================================================== + --uid + set container user id + example: ${0##*/:-} --uid=1000 + ====================================================== + --gid + set container user group id + example: ${0##*/:-} --gid=1000 + ====================================================== + -p|--port + set ssh port to use + !! do not use 22 !! + example: ${0##*/:-} -p=2239 + example: ${0##*/:-} --port=2239 + ====================================================== + --ssh-dir + set ssh directory name found in the .ssh dir + of this repo for the container keys + This directory has separate files for + each public key allowed to access + the container + example: ${0##*/:-} --ssh-dir="teamname" + ====================================================== + --sudo + switch to add the container user to the + sudo group of the container + example: ${0##*/:-} --sudo + ====================================================== + -t|--time-zone