adds multi update channels
This commit is contained in:
parent
cc00cdba05
commit
8ee988a534
@ -158,6 +158,6 @@ $ docker-deploy --uninstall
|
|||||||
# Free Software License
|
# Free Software License
|
||||||
```txt
|
```txt
|
||||||
@copyright Copyright (C) 2021 Llewellyn van der Merwe. All rights reserved.
|
@copyright Copyright (C) 2021 Llewellyn van der Merwe. All rights reserved.
|
||||||
@license GNU General Public License version 2; see LICENSE
|
@license GNU General Public License version 3; see LICENSE
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -641,35 +641,40 @@ function openssh__TRuST__setup() {
|
|||||||
VDM_PUBLIC_KEY_U_DIR=$(getSelectedDirectory "Select the containers ssh public keys folder." \
|
VDM_PUBLIC_KEY_U_DIR=$(getSelectedDirectory "Select the containers ssh public keys folder." \
|
||||||
"${VDM_PUBLIC_KEY_GLOBAL_DIR}" "${VDM_KEY,,}" 'Select Folder')
|
"${VDM_PUBLIC_KEY_GLOBAL_DIR}" "${VDM_KEY,,}" 'Select Folder')
|
||||||
# keep asking if empty or does exist
|
# keep asking if empty or does exist
|
||||||
if [ ${#VDM_PUBLIC_KEY_U_DIR} -ge 1 ] && [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ] &&
|
if [ ${#VDM_PUBLIC_KEY_U_DIR} -ge 1 ]; then
|
||||||
|
# add the parent dir back
|
||||||
|
VDM_PUBLIC_KEY_U_DIR="${VDM_PUBLIC_KEY_GLOBAL_DIR}/${VDM_PUBLIC_KEY_U_DIR}"
|
||||||
|
# check if this directory exist
|
||||||
|
if [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ] &&
|
||||||
(whiptail --yesno "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers ssh public keys folder" --title "Create the Path" 8 112); then
|
(whiptail --yesno "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers ssh public keys folder" --title "Create the Path" 8 112); then
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m 700 "${VDM_PUBLIC_KEY_U_DIR}"
|
mkdir -p -m 700 "${VDM_PUBLIC_KEY_U_DIR}"
|
||||||
# TODO add option to add keys?
|
# TODO add option to add keys?
|
||||||
elif [ ${#VDM_PUBLIC_KEY_U_DIR} -le 1 ]; then
|
fi
|
||||||
|
else
|
||||||
showError "You must set a containers ssh public keys folder."
|
showError "You must set a containers ssh public keys folder."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# we must get the project path
|
# we must get the project path
|
||||||
VDM_ENV_PROJECT_PATH="VDM_${VDM_ENV_KEY^^}_PROJECT_PATH"
|
VDM_ENV_PROJECT_DIR="VDM_${VDM_ENV_KEY^^}_PROJECT_DIR"
|
||||||
VDM_PROJECT_U_PATH=${!VDM_ENV_PROJECT_PATH}
|
VDM_PROJECT_U_DIR=${!VDM_ENV_PROJECT_DIR}
|
||||||
# get the directory of the ssh public keys if not set
|
# get the directory of the ssh public keys if not set
|
||||||
while [ ${#VDM_PROJECT_U_PATH} -le 1 ] || [ ! -d "${VDM_PROJECT_U_PATH}" ]; do
|
while [ ${#VDM_PROJECT_U_DIR} -le 1 ] || [ ! -d "${VDM_PROJECT_U_DIR}" ]; do
|
||||||
# creat the path if it exist
|
# creat the path if it exist
|
||||||
if [ ${#VDM_PROJECT_U_PATH} -ge 1 ] &&
|
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] &&
|
||||||
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_PATH} parent mounting directory" --title "Create the Path" 8 112); then
|
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" --title "Create the Path" 8 112); then
|
||||||
mkdir -p "${VDM_PROJECT_U_PATH}"
|
mkdir -p "${VDM_PROJECT_U_DIR}"
|
||||||
else
|
else
|
||||||
# get the value
|
# get the value
|
||||||
VDM_PROJECT_U_PATH=$(getInput "Enter the parent path where we can select the folders to mount to this container." \
|
VDM_PROJECT_U_DIR=$(getInput "Enter the parent path where we can select the folders to mount to this container." \
|
||||||
"${VDM_PROJECT_PATH}" 'Enter Path')
|
"${VDM_PROJECT_PATH}" 'Enter Path')
|
||||||
# keep asking if empty or does exist
|
# keep asking if empty or does exist
|
||||||
if [ ${#VDM_PROJECT_U_PATH} -ge 1 ] && [ ! -d "${VDM_PROJECT_U_PATH}" ] &&
|
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] && [ ! -d "${VDM_PROJECT_U_DIR}" ] &&
|
||||||
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_PATH} parent mounting directory" --title "Create the Path" 8 112); then
|
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" --title "Create the Path" 8 112); then
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m 700 "${VDM_PROJECT_U_PATH}"
|
mkdir -p -m 700 "${VDM_PROJECT_U_DIR}"
|
||||||
elif [ ${#VDM_PROJECT_U_PATH} -le 1 ]; then
|
elif [ ${#VDM_PROJECT_U_DIR} -le 1 ]; then
|
||||||
showError "You must set a parent mounting directory path where we can select the folders to mount to this container."
|
showError "You must set a parent mounting directory path where we can select the folders to mount to this container."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -678,7 +683,7 @@ function openssh__TRuST__setup() {
|
|||||||
while [ ${#VDM_MOUNT_DIRS} -le 1 ]; do
|
while [ ${#VDM_MOUNT_DIRS} -le 1 ]; do
|
||||||
# get the value
|
# get the value
|
||||||
VDM_MOUNT_DIRS=$(getSelectedDirectories "Select the directories to mount to this container." \
|
VDM_MOUNT_DIRS=$(getSelectedDirectories "Select the directories to mount to this container." \
|
||||||
"${VDM_PROJECT_U_PATH}" 'Select Folders')
|
"${VDM_PROJECT_U_DIR}" 'Select Folders')
|
||||||
# keep asking if empty or does exist
|
# keep asking if empty or does exist
|
||||||
if [ ${#VDM_MOUNT_DIRS} -le 1 ]; then
|
if [ ${#VDM_MOUNT_DIRS} -le 1 ]; then
|
||||||
showError "You must set the directories to mount to this container."
|
showError "You must set the directories to mount to this container."
|
||||||
@ -693,7 +698,7 @@ function openssh__TRuST__setup() {
|
|||||||
# set the full path
|
# set the full path
|
||||||
mDir="${mDir//\"/}"
|
mDir="${mDir//\"/}"
|
||||||
# when we mount a joomla volume we may not want to mount the database
|
# when we mount a joomla volume we may not want to mount the database
|
||||||
mFull="${VDM_PROJECT_U_PATH}/${mDir}/joomla"
|
mFull="${VDM_PROJECT_U_DIR}/${mDir}/joomla"
|
||||||
# add to mount projects
|
# add to mount projects
|
||||||
if [ -d "${mFull}" ] && (whiptail --yesno "Should we ONLY mount the (joomla website files) ${mDir}/joomla directory" --title "Mount Joomla" 8 112); then
|
if [ -d "${mFull}" ] && (whiptail --yesno "Should we ONLY mount the (joomla website files) ${mDir}/joomla directory" --title "Mount Joomla" 8 112); then
|
||||||
VDM_MOUNT_PROJECTS+=$(getYMLDashLine "\${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}/joomla:/app/${mDir}")
|
VDM_MOUNT_PROJECTS+=$(getYMLDashLine "\${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}/joomla:/app/${mDir}")
|
||||||
@ -704,7 +709,7 @@ function openssh__TRuST__setup() {
|
|||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
setEnvVariable "VDM_DOMAIN=\"${VDM_DOMAIN}\""
|
setEnvVariable "VDM_DOMAIN=\"${VDM_DOMAIN}\""
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
setContainerEnvVariable "${VDM_ENV_PROJECT_PATH}=\"${VDM_PROJECT_U_PATH}\""
|
setContainerEnvVariable "${VDM_ENV_PROJECT_DIR}=\"${VDM_PROJECT_U_DIR}\""
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
setContainerEnvVariable "VDM_PUBLIC_KEY_GLOBAL_DIR=\"${VDM_PUBLIC_KEY_GLOBAL_DIR}\""
|
setContainerEnvVariable "VDM_PUBLIC_KEY_GLOBAL_DIR=\"${VDM_PUBLIC_KEY_GLOBAL_DIR}\""
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
@ -723,7 +728,7 @@ function openssh__TRuST__setup() {
|
|||||||
export VDM_ENV_KEY
|
export VDM_ENV_KEY
|
||||||
export VDM_PUBLIC_KEY_GLOBAL_DIR
|
export VDM_PUBLIC_KEY_GLOBAL_DIR
|
||||||
export VDM_PUBLIC_KEY_U_DIR
|
export VDM_PUBLIC_KEY_U_DIR
|
||||||
export VDM_PROJECT_U_PATH
|
export VDM_PROJECT_U_DIR
|
||||||
# create the directory if it does not yet already exist
|
# create the directory if it does not yet already exist
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m 700 "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_USER_NAME}.${VDM_DOMAIN}"
|
mkdir -p -m 700 "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_USER_NAME}.${VDM_DOMAIN}"
|
||||||
@ -749,7 +754,7 @@ function openssh__TRuST__setup() {
|
|||||||
unset VDM_ENV_KEY
|
unset VDM_ENV_KEY
|
||||||
unset VDM_PUBLIC_KEY_GLOBAL_DIR
|
unset VDM_PUBLIC_KEY_GLOBAL_DIR
|
||||||
unset VDM_PUBLIC_KEY_U_DIR
|
unset VDM_PUBLIC_KEY_U_DIR
|
||||||
unset VDM_PROJECT_U_PATH
|
unset VDM_PROJECT_U_DIR
|
||||||
# return a success
|
# return a success
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -1469,8 +1474,12 @@ function runUpdate() {
|
|||||||
# just backup in case of failure
|
# just backup in case of failure
|
||||||
sudo mv /usr/local/bin/docker-deploy /usr/local/bin/docker-deploy.bak
|
sudo mv /usr/local/bin/docker-deploy /usr/local/bin/docker-deploy.bak
|
||||||
fi
|
fi
|
||||||
|
# some local values
|
||||||
|
local branch
|
||||||
|
# get the target branch to use in our update
|
||||||
|
branch=$( getTargetBranch )
|
||||||
# pull the latest version. Master is always the latest
|
# pull the latest version. Master is always the latest
|
||||||
if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/docker-deploy/raw/src/docker-deploy?ref=master&access_token=${VDM_ACCESS_TOKEN}" -o /usr/local/bin/docker-deploy 2>/dev/null; then
|
if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/docker-deploy/raw/src/docker-deploy?ref=${branch:-master}&access_token=${VDM_ACCESS_TOKEN}" -o /usr/local/bin/docker-deploy 2>/dev/null; then
|
||||||
# give success message
|
# give success message
|
||||||
echo "SUCCESS: Update was successful."
|
echo "SUCCESS: Update was successful."
|
||||||
# do we have a backup
|
# do we have a backup
|
||||||
@ -2011,6 +2020,18 @@ function getAccessToken(){
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get the target branch to use in update
|
||||||
|
function getTargetBranch() {
|
||||||
|
# now make the selection
|
||||||
|
answer=$(whiptail --title "Select Update Channel" --radiolist --nocancel --notags \
|
||||||
|
"You can select the update channel you would like to use." 10 80 2 \
|
||||||
|
"master" "Stable Version" "ON" \
|
||||||
|
"staging" "Developer Version" "OFF" \
|
||||||
|
3>&1 1>&2 2>&3)
|
||||||
|
# return the answer (default master)
|
||||||
|
echo "${answer:-master}"
|
||||||
|
}
|
||||||
|
|
||||||
# set the networks in place
|
# set the networks in place
|
||||||
function setNetworks() {
|
function setNetworks() {
|
||||||
# we create the networks
|
# we create the networks
|
||||||
|
Loading…
Reference in New Issue
Block a user