Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
eb3bb297b9
|
|||
05660f568c
|
|||
5ceddb1c71
|
|||
1cc718832a
|
|||
7837d8ecd4
|
|||
593ae84c89
|
|||
962b1628c2
|
|||
b666db9f33
|
@ -20,7 +20,7 @@ Linted by [#ShellCheck](https://github.com/koalaman/shellcheck)
|
|||||||
---
|
---
|
||||||
# Install
|
# Install
|
||||||
```shell
|
```shell
|
||||||
$ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octojoom/raw/src/octojoom" -o /usr/local/bin/octojoom
|
$ sudo curl -L "https://raw.githubusercontent.com/octoleo/octojoom/refs/heads/master/src/octojoom" -o /usr/local/bin/octojoom
|
||||||
$ sudo chmod +x /usr/local/bin/octojoom
|
$ sudo chmod +x /usr/local/bin/octojoom
|
||||||
```
|
```
|
||||||
|
|
||||||
|
433
src/octojoom
433
src/octojoom
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# The most recent program version.
|
# The most recent program version.
|
||||||
_VERSION="3.6.2"
|
_VERSION="3.7.1"
|
||||||
_V="3.6"
|
_V="3.7"
|
||||||
|
|
||||||
# Bash version required
|
# Bash version required
|
||||||
_bash_v=4
|
_bash_v=4
|
||||||
@ -296,8 +296,8 @@ function traefik__TRuST__setup() {
|
|||||||
# saved the file
|
# saved the file
|
||||||
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
||||||
# ask if we should continue to enable
|
# ask if we should continue to enable
|
||||||
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" --defaultno \
|
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
||||||
--title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Container" 8 112 "defaultno"; then
|
||||||
enableContainer "${VDM_CONTAINER_TYPE}"
|
enableContainer "${VDM_CONTAINER_TYPE}"
|
||||||
fi
|
fi
|
||||||
##########################
|
##########################
|
||||||
@ -408,8 +408,8 @@ function portainer__TRuST__setup() {
|
|||||||
# saved the file
|
# saved the file
|
||||||
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
||||||
# ask if we should continue to enable
|
# ask if we should continue to enable
|
||||||
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
||||||
--defaultno --title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Container" 8 112 "defaultno"; then
|
||||||
enableContainer "${VDM_CONTAINER_TYPE}"
|
enableContainer "${VDM_CONTAINER_TYPE}"
|
||||||
fi
|
fi
|
||||||
##########################
|
##########################
|
||||||
@ -606,8 +606,8 @@ function joomla__TRuST__setup() {
|
|||||||
# only if in expert mode set the container user detail id needed
|
# only if in expert mode set the container user detail id needed
|
||||||
if isExpert; then
|
if isExpert; then
|
||||||
# ask if we should add mailcatcher
|
# ask if we should add mailcatcher
|
||||||
if (whiptail --yesno "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
|
if getInputYesNo "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
|
||||||
--defaultno --title "Enable Mailcatcher" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Mailcatcher" 8 112 "defaultno"; then
|
||||||
VDM_EXTRA_CONTAINER_STUFF=$(getYMLine1 "mailcatcher${VDM_KEY}:")
|
VDM_EXTRA_CONTAINER_STUFF=$(getYMLine1 "mailcatcher${VDM_KEY}:")
|
||||||
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine2 "image: schickling/mailcatcher")
|
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine2 "image: schickling/mailcatcher")
|
||||||
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine2 "container_name: mailcatcher${VDM_KEY}")
|
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine2 "container_name: mailcatcher${VDM_KEY}")
|
||||||
@ -628,7 +628,7 @@ function joomla__TRuST__setup() {
|
|||||||
fi
|
fi
|
||||||
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.routers.mailcatcher${VDM_KEY}.service=mailcatcher${VDM_KEY}\"")
|
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.routers.mailcatcher${VDM_KEY}.service=mailcatcher${VDM_KEY}\"")
|
||||||
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.services.mailcatcher${VDM_KEY}.loadbalancer.server.port=1080\"")
|
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.services.mailcatcher${VDM_KEY}.loadbalancer.server.port=1080\"")
|
||||||
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1080")
|
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1025")
|
||||||
fi
|
fi
|
||||||
# if this is our octoleo images we can also set the user ID and user-group ID
|
# if this is our octoleo images we can also set the user ID and user-group ID
|
||||||
setContainerUser "$(id -u)"
|
setContainerUser "$(id -u)"
|
||||||
@ -723,8 +723,8 @@ function joomla__TRuST__setup() {
|
|||||||
# saved the file
|
# saved the file
|
||||||
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
||||||
# ask if we should continue to enable
|
# ask if we should continue to enable
|
||||||
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
||||||
--defaultno --title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Container" 8 112 "defaultno"; then
|
||||||
# we set the container details
|
# we set the container details
|
||||||
export VDM_CONTAINER="${VDM_SUBDOMAIN}.${VDM_DOMAIN}"
|
export VDM_CONTAINER="${VDM_SUBDOMAIN}.${VDM_DOMAIN}"
|
||||||
# then we enable it
|
# then we enable it
|
||||||
@ -936,8 +936,8 @@ function joomla__TRuST__bulk() {
|
|||||||
fi
|
fi
|
||||||
# ask if we should add mailcatcher
|
# ask if we should add mailcatcher
|
||||||
enable_mailcatcher=false
|
enable_mailcatcher=false
|
||||||
if (whiptail --yesno "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
|
if getInputYesNo "Would you also like to enable mailcatcher for these ${VDM_CONTAINER_TYPE^} containers" \
|
||||||
--defaultno --title "Enable Mailcatcher" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Mailcatcher" 8 112 "defaultno"; then
|
||||||
enable_mailcatcher=true
|
enable_mailcatcher=true
|
||||||
fi
|
fi
|
||||||
# we only do autodeploy for Joomla 4.3 and above
|
# we only do autodeploy for Joomla 4.3 and above
|
||||||
@ -971,8 +971,8 @@ function joomla__TRuST__bulk() {
|
|||||||
setNumberContainers
|
setNumberContainers
|
||||||
# ask if we should continue to enable
|
# ask if we should continue to enable
|
||||||
enable_containers=false
|
enable_containers=false
|
||||||
if (whiptail --yesno "Would you also like to enable all these ${VDM_CONTAINER_TYPE^} containers" \
|
if getInputYesNo "Would you also like to enable all these ${VDM_CONTAINER_TYPE^} containers" \
|
||||||
--defaultno --title "Enable Containers" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Containers" 8 112 "defaultno"; then
|
||||||
enable_containers=true
|
enable_containers=true
|
||||||
fi
|
fi
|
||||||
# loop the number of containers
|
# loop the number of containers
|
||||||
@ -1072,7 +1072,7 @@ function joomla__TRuST__bulk() {
|
|||||||
fi
|
fi
|
||||||
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.routers.mailcatcher${VDM_KEY}.service=mailcatcher${VDM_KEY}\"")
|
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.routers.mailcatcher${VDM_KEY}.service=mailcatcher${VDM_KEY}\"")
|
||||||
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.services.mailcatcher${VDM_KEY}.loadbalancer.server.port=1080\"")
|
VDM_EXTRA_CONTAINER_STUFF+=$(getYMLine3 "- \"traefik.http.services.mailcatcher${VDM_KEY}.loadbalancer.server.port=1080\"")
|
||||||
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1080")
|
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1025")
|
||||||
fi
|
fi
|
||||||
# setup letsencrypt stuff
|
# setup letsencrypt stuff
|
||||||
VDM_JOOMLA_SECURE_LABELS=''
|
VDM_JOOMLA_SECURE_LABELS=''
|
||||||
@ -1206,18 +1206,18 @@ function openssh__TRuST__setup() {
|
|||||||
# get the global directory of the ssh public keys if not set
|
# get the global directory of the ssh public keys if not set
|
||||||
while [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -le 1 ] || [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ]; do
|
while [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -le 1 ] || [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ]; do
|
||||||
# creat the path if it exist
|
# creat the path if it exist
|
||||||
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] &&
|
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] && \
|
||||||
(whiptail --yesno "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
|
getInputYesNo "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
|
||||||
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
|
"Create the Path" 8 112; then
|
||||||
mkdir -p "${VDM_PUBLIC_KEY_GLOBAL_DIR}"
|
mkdir -p "${VDM_PUBLIC_KEY_GLOBAL_DIR}"
|
||||||
else
|
else
|
||||||
# get the value
|
# get the value
|
||||||
VDM_PUBLIC_KEY_GLOBAL_DIR=$(getInput "Enter the ssh path where we can select the ssh key folders from." \
|
VDM_PUBLIC_KEY_GLOBAL_DIR=$(getInput "Enter the ssh path where we can select the ssh key folders from." \
|
||||||
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.ssh" 'Enter SSH Path')
|
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.ssh" 'Enter SSH Path')
|
||||||
# keep asking if empty or does exist
|
# keep asking if empty or does exist
|
||||||
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] && [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ] &&
|
if [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -ge 1 ] && [ ! -d "${VDM_PUBLIC_KEY_GLOBAL_DIR}" ] && \
|
||||||
(whiptail --yesno "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
|
getInputYesNo "Can we create the ${VDM_PUBLIC_KEY_GLOBAL_DIR} ssh folder" \
|
||||||
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
|
"Create the Path" 8 112; then
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m 700 "${VDM_PUBLIC_KEY_GLOBAL_DIR}"
|
mkdir -p -m 700 "${VDM_PUBLIC_KEY_GLOBAL_DIR}"
|
||||||
elif [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -le 1 ]; then
|
elif [ ${#VDM_PUBLIC_KEY_GLOBAL_DIR} -le 1 ]; then
|
||||||
@ -1231,9 +1231,9 @@ function openssh__TRuST__setup() {
|
|||||||
# get the directory of this containers public keys if not set
|
# get the directory of this containers public keys if not set
|
||||||
while [ ${#VDM_PUBLIC_KEY_U_DIR} -le 1 ] || [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ]; do
|
while [ ${#VDM_PUBLIC_KEY_U_DIR} -le 1 ] || [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ]; do
|
||||||
# creat the path if it exist
|
# creat the path if it exist
|
||||||
if [ ${#VDM_PUBLIC_KEY_U_DIR} -ge 1 ] &&
|
if [ ${#VDM_PUBLIC_KEY_U_DIR} -ge 1 ] && \
|
||||||
(whiptail --yesno "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
|
getInputYesNo "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
|
||||||
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
|
"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}"
|
||||||
else
|
else
|
||||||
@ -1245,9 +1245,9 @@ function openssh__TRuST__setup() {
|
|||||||
# add the parent dir back
|
# add the parent dir back
|
||||||
VDM_PUBLIC_KEY_U_DIR="${VDM_PUBLIC_KEY_GLOBAL_DIR}/${VDM_PUBLIC_KEY_U_DIR}"
|
VDM_PUBLIC_KEY_U_DIR="${VDM_PUBLIC_KEY_GLOBAL_DIR}/${VDM_PUBLIC_KEY_U_DIR}"
|
||||||
# check if this directory exist
|
# check if this directory exist
|
||||||
if [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ] &&
|
if [ ! -d "${VDM_PUBLIC_KEY_U_DIR}" ] && \
|
||||||
(whiptail --yesno "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
|
getInputYesNo "Can we create this (${VDM_PUBLIC_KEY_U_DIR}) containers' ssh public keys folder" \
|
||||||
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
|
"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?
|
||||||
@ -1263,18 +1263,18 @@ function openssh__TRuST__setup() {
|
|||||||
# 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_DIR} -le 1 ] || [ ! -d "${VDM_PROJECT_U_DIR}" ]; 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_DIR} -ge 1 ] &&
|
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] && \
|
||||||
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
|
getInputYesNo "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
|
||||||
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
|
"Create the Path" 8 112; then
|
||||||
mkdir -p "${VDM_PROJECT_U_DIR}"
|
mkdir -p "${VDM_PROJECT_U_DIR}"
|
||||||
else
|
else
|
||||||
# get the value
|
# get the value
|
||||||
VDM_PROJECT_U_DIR=$(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_DIR} -ge 1 ] && [ ! -d "${VDM_PROJECT_U_DIR}" ] &&
|
if [ ${#VDM_PROJECT_U_DIR} -ge 1 ] && [ ! -d "${VDM_PROJECT_U_DIR}" ] && \
|
||||||
(whiptail --yesno "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
|
getInputYesNo "Can we create the ${VDM_PROJECT_U_DIR} parent mounting directory" \
|
||||||
--title "Create the Path" --backtitle "${BACK_TITLE}" 8 112); then
|
"Create the Path" 8 112; then
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m 700 "${VDM_PROJECT_U_DIR}"
|
mkdir -p -m 700 "${VDM_PROJECT_U_DIR}"
|
||||||
elif [ ${#VDM_PROJECT_U_DIR} -le 1 ]; then
|
elif [ ${#VDM_PROJECT_U_DIR} -le 1 ]; then
|
||||||
@ -1303,8 +1303,9 @@ function openssh__TRuST__setup() {
|
|||||||
# 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_DIR}/${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" \
|
if [ -d "${mFull}" ] && \
|
||||||
--title "Mount Joomla" --backtitle "${BACK_TITLE}" 8 112); then
|
getInputYesNo "Should we ONLY mount the (joomla website files) ${mDir}/joomla directory" \
|
||||||
|
"Mount Joomla" 8 112; then
|
||||||
VDM_VOLUMES_MOUNT+=$(getYMLine3 "- \${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}/joomla:/app/${mDir}")
|
VDM_VOLUMES_MOUNT+=$(getYMLine3 "- \${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}/joomla:/app/${mDir}")
|
||||||
else
|
else
|
||||||
VDM_VOLUMES_MOUNT+=$(getYMLine3 "- \${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}:/app/${mDir}")
|
VDM_VOLUMES_MOUNT+=$(getYMLine3 "- \${VDM_${VDM_ENV_KEY^^}_PROJECT_DIR}/${mDir}:/app/${mDir}")
|
||||||
@ -1339,8 +1340,8 @@ function openssh__TRuST__setup() {
|
|||||||
# saved the file
|
# saved the file
|
||||||
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
showNotice "Saved ${VDM_CONTAINER_TYPE}:docker-compose.yml file.\nSetup of this container is complete!"
|
||||||
# ask if we should continue to enable
|
# ask if we should continue to enable
|
||||||
if (whiptail --yesno "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
if getInputYesNo "Would you also like to enable this ${VDM_CONTAINER_TYPE^} container" \
|
||||||
--defaultno --title "Enable Container" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Container" 8 112 "defaultno"; then
|
||||||
# we set the container details
|
# we set the container details
|
||||||
export VDM_CONTAINER="${VDM_USER_NAME}.${VDM_DOMAIN}"
|
export VDM_CONTAINER="${VDM_USER_NAME}.${VDM_DOMAIN}"
|
||||||
# then we enable it
|
# then we enable it
|
||||||
@ -1534,6 +1535,8 @@ function joomla__TRuST__enable() {
|
|||||||
[ -e "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ] || {
|
[ -e "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ] || {
|
||||||
ln -s "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
ln -s "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
||||||
}
|
}
|
||||||
|
# set some local variables
|
||||||
|
local evn_file
|
||||||
# check if image has its own env file also
|
# check if image has its own env file also
|
||||||
evn_file=''
|
evn_file=''
|
||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
@ -1555,6 +1558,7 @@ function joomla__TRuST__enable() {
|
|||||||
# set some local variables
|
# set some local variables
|
||||||
local vdm_enable_me
|
local vdm_enable_me
|
||||||
local container
|
local container
|
||||||
|
local evn_file
|
||||||
# create the folder as needed
|
# create the folder as needed
|
||||||
mkdir -p "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"
|
mkdir -p "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"
|
||||||
# get containers to enable
|
# get containers to enable
|
||||||
@ -1603,6 +1607,8 @@ function openssh__TRuST__enable() {
|
|||||||
[ -e "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ] || {
|
[ -e "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ] || {
|
||||||
ln -s "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
ln -s "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
||||||
}
|
}
|
||||||
|
# set some local variables
|
||||||
|
local evn_file
|
||||||
# check if image has its own env file also
|
# check if image has its own env file also
|
||||||
evn_file=''
|
evn_file=''
|
||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
@ -1713,10 +1719,21 @@ function joomla__TRuST__disable() {
|
|||||||
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
||||||
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
|
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
|
||||||
elif [ ${#VDM_CONTAINER} -ge 1 ]; then
|
elif [ ${#VDM_CONTAINER} -ge 1 ]; then
|
||||||
# this means we have a single already selected container to enable if it exists
|
# this means we have a single already selected container to disable if it exists
|
||||||
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ]; then
|
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ]; then
|
||||||
|
# set some local variables
|
||||||
|
local evn_file
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" || {
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
|
||||||
|
}
|
||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans || {
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
|
||||||
|
}
|
||||||
# then remove soft link
|
# then remove soft link
|
||||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
||||||
else
|
else
|
||||||
@ -1729,6 +1746,7 @@ function joomla__TRuST__disable() {
|
|||||||
# set some local variables
|
# set some local variables
|
||||||
local vdm_disable_me
|
local vdm_disable_me
|
||||||
local container
|
local container
|
||||||
|
local evn_file
|
||||||
# get containers to enable
|
# get containers to enable
|
||||||
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
|
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
|
||||||
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
|
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
|
||||||
@ -1740,8 +1758,17 @@ function joomla__TRuST__disable() {
|
|||||||
for containered in "${vdm_disable_me_array[@]}"; do
|
for containered in "${vdm_disable_me_array[@]}"; do
|
||||||
# remove the " from the string
|
# remove the " from the string
|
||||||
container="${containered//\"/}"
|
container="${containered//\"/}"
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" || {
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
|
||||||
|
}
|
||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans || {
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
|
||||||
|
}
|
||||||
# then remove soft link
|
# then remove soft link
|
||||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
||||||
done
|
done
|
||||||
@ -1756,10 +1783,21 @@ function openssh__TRuST__disable() {
|
|||||||
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
||||||
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
|
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
|
||||||
elif [ ${#VDM_CONTAINER} -ge 1 ]; then
|
elif [ ${#VDM_CONTAINER} -ge 1 ]; then
|
||||||
# this means we have a single already selected container to enable if it exists
|
# this means we have a single already selected container to disable if it exists
|
||||||
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ]; then
|
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}" ]; then
|
||||||
|
# set some local variables
|
||||||
|
local evn_file
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/.env" || {
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
|
||||||
|
}
|
||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans || {
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
|
||||||
|
}
|
||||||
# then remove soft link
|
# then remove soft link
|
||||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
||||||
else
|
else
|
||||||
@ -1772,6 +1810,7 @@ function openssh__TRuST__disable() {
|
|||||||
# set some local variables
|
# set some local variables
|
||||||
local vdm_disable_me
|
local vdm_disable_me
|
||||||
local container
|
local container
|
||||||
|
local evn_file
|
||||||
# get containers to enable
|
# get containers to enable
|
||||||
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
|
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
|
||||||
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
|
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
|
||||||
@ -1783,8 +1822,17 @@ function openssh__TRuST__disable() {
|
|||||||
for containered in "${vdm_disable_me_array[@]}"; do
|
for containered in "${vdm_disable_me_array[@]}"; do
|
||||||
# remove the " from the string
|
# remove the " from the string
|
||||||
container="${containered//\"/}"
|
container="${containered//\"/}"
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/.env" || {
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
|
||||||
|
}
|
||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans || {
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
|
||||||
|
}
|
||||||
# then remove soft link
|
# then remove soft link
|
||||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
||||||
done
|
done
|
||||||
@ -1799,8 +1847,19 @@ function traefik__TRuST__disable() {
|
|||||||
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
|
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
|
||||||
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
|
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
|
||||||
else
|
else
|
||||||
|
# set some local variables
|
||||||
|
local evn_file
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" || {
|
||||||
|
[ -f "${VDM_SRC_PATH}/.env" ] && evn_file="${VDM_SRC_PATH}/.env"
|
||||||
|
}
|
||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down || {
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1811,8 +1870,19 @@ function portainer__TRuST__disable() {
|
|||||||
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
|
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
|
||||||
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
|
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
|
||||||
else
|
else
|
||||||
|
# set some local variables
|
||||||
|
local evn_file
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" || {
|
||||||
|
[ -f "${VDM_SRC_PATH}/.env" ] && evn_file="${VDM_SRC_PATH}/.env"
|
||||||
|
}
|
||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down || {
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
||||||
|
}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1885,11 +1955,24 @@ function joomla__TRuST__down() {
|
|||||||
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
||||||
showError "There are no ${VDM_CONTAINER_TYPE^} containers to take down.\n\
|
showError "There are no ${VDM_CONTAINER_TYPE^} containers to take down.\n\
|
||||||
(UP and DOWN targets only enabled containers)"
|
(UP and DOWN targets only enabled containers)"
|
||||||
elif (whiptail --yesno "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
|
elif getInputYesNo "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
|
||||||
--title "Take Down Containers" --backtitle "${BACK_TITLE}" 8 112); then
|
"Take Down Containers" 8 112; then
|
||||||
# get all zip files
|
# get all zip files
|
||||||
for yml in "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"*/*.yml; do
|
for yml in "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"*/*.yml; do
|
||||||
|
# get the vdm_container value
|
||||||
|
vdm_container="${yml%/docker-compose.yml}"
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# check if image has its own env file also
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${vdm_container}/.env" ] && evn_file="${vdm_container}/.env" || {
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
|
||||||
|
}
|
||||||
|
# make sure the docker image is started
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${yml}" down || {
|
||||||
docker-compose --file "${yml}" down
|
docker-compose --file "${yml}" down
|
||||||
|
}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -1900,15 +1983,64 @@ function openssh__TRuST__down() {
|
|||||||
# check if this type has enabled containers
|
# check if this type has enabled containers
|
||||||
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
||||||
showError "There are no ${VDM_CONTAINER_TYPE^} containers to take down."
|
showError "There are no ${VDM_CONTAINER_TYPE^} containers to take down."
|
||||||
elif (whiptail --yesno "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
|
elif getInputYesNo "Are you absolutely sure you want to take down all the ${VDM_CONTAINER_TYPE^} containers?" \
|
||||||
--title "Take Down Containers" --backtitle "${BACK_TITLE}" 8 112); then
|
"Take Down Containers" 8 112; then
|
||||||
# get all zip files
|
# get all zip files
|
||||||
for yml in "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"*/*.yml; do
|
for yml in "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"*/*.yml; do
|
||||||
|
# get the vdm_container value
|
||||||
|
vdm_container="${yml%/docker-compose.yml}"
|
||||||
|
# check if image has its own env file also
|
||||||
|
evn_file=''
|
||||||
|
# check if image has its own env file also
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ -f "${vdm_container}/.env" ] && evn_file="${vdm_container}/.env" || {
|
||||||
|
[ -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env" ] && evn_file="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/.env"
|
||||||
|
}
|
||||||
|
# make sure the docker image is started
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
[ ${#evn_file} -ge 1 ] && docker-compose --env-file "${evn_file}" --file "${yml}" down || {
|
||||||
docker-compose --file "${yml}" down
|
docker-compose --file "${yml}" down
|
||||||
|
}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################################################################################################VDM
|
||||||
|
######################################## CLONE JOOMLA
|
||||||
|
function joomla__TRuST__clone() {
|
||||||
|
# check if this type have available containers
|
||||||
|
if ! hasDirectories "${VDM_CONTAINER_TYPE}/available/"; then
|
||||||
|
showError "The path ${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/ does not exist or is empty, first run a ${VDM_CONTAINER_TYPE^} setup."
|
||||||
|
else
|
||||||
|
# ask if they want to clone a volume
|
||||||
|
if getInputYesNo "Would you like to clone a persistent volume found in (${VDM_PROJECT_PATH})?" \
|
||||||
|
"Continue To Clone Persistent Volume" 12 112; then
|
||||||
|
# trigger the volumes clone script
|
||||||
|
clonePersistentVolume
|
||||||
|
fi
|
||||||
|
# ask if they want to clone a container
|
||||||
|
if getInputYesNo "Would you like to clone a ${VDM_CONTAINER_TYPE^} container?" \
|
||||||
|
"Continue To Clone Container (feature not ready)" 12 112 "defaultno"; then
|
||||||
|
# set some local variables
|
||||||
|
local vdm_clone_me
|
||||||
|
local container
|
||||||
|
# list containers... and allow selection to edit
|
||||||
|
container=$(getSelectedDirectory "Select a container you would like to clone." \
|
||||||
|
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/" '' "Clone ${VDM_CONTAINER_TYPE^} Container (feature not ready)")
|
||||||
|
# check that we have something, else return to main menu
|
||||||
|
if [ ${#container} -ge 1 ]; then
|
||||||
|
# add the parent dir back
|
||||||
|
vdm_clone_me="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}/docker-compose.yml"
|
||||||
|
# check if this docker-composer.yml exist
|
||||||
|
if [ -f "${vdm_clone_me}" ]; then
|
||||||
|
# give little heads-up
|
||||||
|
showNotice "Feature not ready!!\nYou have selected: ${vdm_clone_me}" 13
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#####################################################################################################################VDM
|
#####################################################################################################################VDM
|
||||||
######################################## DELETE JOOMLA
|
######################################## DELETE JOOMLA
|
||||||
function joomla__TRuST__delete() {
|
function joomla__TRuST__delete() {
|
||||||
@ -1940,17 +2072,17 @@ function joomla__TRuST__delete() {
|
|||||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
||||||
fi
|
fi
|
||||||
# before deleting the config we ask to make sure
|
# before deleting the config we ask to make sure
|
||||||
if (whiptail --yesno "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
|
if getInputYesNo "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
|
||||||
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
|
"Delete Docker Compose Yaml" 8 112; then
|
||||||
# then remove docker-compose.yml file
|
# then remove docker-compose.yml file
|
||||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}"
|
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# ask if there are volumes to delete
|
# ask if there are volumes to delete
|
||||||
if hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
if hasDirectories '' "${VDM_PROJECT_PATH}" && \
|
||||||
(whiptail --yesno "Would you like to delete persistent volumes found in (${VDM_PROJECT_PATH})?" \
|
getInputYesNo "Would you like to delete persistent volumes found in (${VDM_PROJECT_PATH})?" \
|
||||||
--title "Continue To Delete Persistent Volumes" --backtitle "${BACK_TITLE}" 12 112); then
|
"Continue To Delete Persistent Volumes" 12 112; then
|
||||||
# trigger the volumes removal script
|
# trigger the volumes removal script
|
||||||
deletePersistentVolumes
|
deletePersistentVolumes
|
||||||
fi
|
fi
|
||||||
@ -1988,8 +2120,8 @@ function openssh__TRuST__delete() {
|
|||||||
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
||||||
fi
|
fi
|
||||||
# before deleting the config we ask to make sure
|
# before deleting the config we ask to make sure
|
||||||
if (whiptail --yesno "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
|
if getInputYesNo "Would you like to delete the (${container}) container's folder that holds the docker-compose.yml file?" \
|
||||||
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
|
"Delete Docker Compose Yaml" 8 112; then
|
||||||
# then remove docker-compose.yml file
|
# then remove docker-compose.yml file
|
||||||
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}"
|
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}"
|
||||||
fi
|
fi
|
||||||
@ -2008,8 +2140,8 @@ function traefik__TRuST__delete() {
|
|||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
||||||
# before deleting the config we ask to make sure
|
# before deleting the config we ask to make sure
|
||||||
if (whiptail --yesno "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
|
if getInputYesNo "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
|
||||||
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
|
"Delete Docker Compose Yaml" 8 112; then
|
||||||
# then remove docker-compose.yml file
|
# then remove docker-compose.yml file
|
||||||
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
|
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
|
||||||
fi
|
fi
|
||||||
@ -2026,8 +2158,8 @@ function portainer__TRuST__delete() {
|
|||||||
# make sure the docker image is stopped
|
# make sure the docker image is stopped
|
||||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
||||||
# before deleting the config we ask to make sure
|
# before deleting the config we ask to make sure
|
||||||
if (whiptail --yesno "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
|
if getInputYesNo "Would you like to delete the ${VDM_CONTAINER_TYPE^} container's docker-compose.yml file?" \
|
||||||
--title "Delete Docker Compose Yaml" --backtitle "${BACK_TITLE}" 8 112); then
|
"Delete Docker Compose Yaml" 8 112; then
|
||||||
# then remove docker-compose.yml file
|
# then remove docker-compose.yml file
|
||||||
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
|
rm -fr "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
|
||||||
fi
|
fi
|
||||||
@ -2038,9 +2170,9 @@ function portainer__TRuST__delete() {
|
|||||||
######################################## RESET JOOMLA
|
######################################## RESET JOOMLA
|
||||||
function joomla__TRuST__reset() {
|
function joomla__TRuST__reset() {
|
||||||
# ask if there are volumes to delete
|
# ask if there are volumes to delete
|
||||||
if hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
if hasDirectories '' "${VDM_PROJECT_PATH}" && \
|
||||||
(whiptail --yesno "Would you like to reset persistent volumes found in (${VDM_PROJECT_PATH})?" \
|
getInputYesNo "Would you like to reset persistent volumes found in (${VDM_PROJECT_PATH})?" \
|
||||||
--title "Continue To Reset Persistent Volumes" --backtitle "${BACK_TITLE}" 12 112); then
|
"Continue To Reset Persistent Volumes" 12 112; then
|
||||||
# trigger the volumes reset script
|
# trigger the volumes reset script
|
||||||
resetPersistentJoomlaVolumes
|
resetPersistentJoomlaVolumes
|
||||||
fi
|
fi
|
||||||
@ -2232,6 +2364,15 @@ function upContainers() {
|
|||||||
main
|
main
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# clone a container
|
||||||
|
function cloneContainer() {
|
||||||
|
# make sure of our container type
|
||||||
|
VDM_CONTAINER_TYPE="${1}"
|
||||||
|
VDM_TASK="clone"
|
||||||
|
# execute the task
|
||||||
|
main
|
||||||
|
}
|
||||||
|
|
||||||
# delete a container
|
# delete a container
|
||||||
function deleteContainer() {
|
function deleteContainer() {
|
||||||
# make sure of our container type
|
# make sure of our container type
|
||||||
@ -2447,6 +2588,44 @@ function deletePersistentVolumes() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# clone persistent volume
|
||||||
|
function clonePersistentVolume() {
|
||||||
|
# we first check if we have some volumes
|
||||||
|
if hasDirectories '' "${VDM_PROJECT_PATH}"; then
|
||||||
|
# set some local variables
|
||||||
|
local vdm_clone_volume
|
||||||
|
local persistent
|
||||||
|
local new_persistent
|
||||||
|
# get containers to enable
|
||||||
|
vdm_clone_volume=$(getSelectedDirectory "Select persistent volume\s to delete." \
|
||||||
|
"${VDM_PROJECT_PATH}" "Select Persistent Volume to Clone")
|
||||||
|
# check that we have something, else return to main menu
|
||||||
|
if [ ${#vdm_clone_volume} -ge 1 ]; then
|
||||||
|
# remove the " from the string
|
||||||
|
persistent="${vdm_clone_volume//\"/}"
|
||||||
|
# last serious check and then its gone
|
||||||
|
if [ -d "${VDM_PROJECT_PATH}/${persistent}" ]; then
|
||||||
|
# set the new persistent volume name
|
||||||
|
new_persistent="${persistent}"
|
||||||
|
while [ -d "${VDM_PROJECT_PATH}/${new_persistent}" ]; do
|
||||||
|
# get the value
|
||||||
|
new_persistent=$(getInput "Enter a new persistent volume name\n[do not use (${persistent}) or any other existing volume names]" '' 'Enter Persistent Name')
|
||||||
|
# keep asking
|
||||||
|
if [ -d "${VDM_PROJECT_PATH}/${new_persistent}" ]; then
|
||||||
|
showError "You must enter a persistent volume name that does not already exist.\n\n${new_persistent} already exist."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# create this new folder
|
||||||
|
mkdir -p "${VDM_PROJECT_PATH}/${new_persistent}"
|
||||||
|
# clone or (copy) the files to a new directory.
|
||||||
|
sudo cp -af "${VDM_PROJECT_PATH}/${persistent}/"* "${VDM_PROJECT_PATH}/${new_persistent}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
showError "There are no persistent volumes found in ${VDM_PROJECT_PATH}."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# reset persistent Joomla volume
|
# reset persistent Joomla volume
|
||||||
function resetPersistentJoomlaVolumes() {
|
function resetPersistentJoomlaVolumes() {
|
||||||
# we first check if we have some volumes
|
# we first check if we have some volumes
|
||||||
@ -2491,8 +2670,8 @@ function resetPersistentJoomlaVolumes() {
|
|||||||
# make an update
|
# make an update
|
||||||
function runUpdate() {
|
function runUpdate() {
|
||||||
# we need sudo permissions
|
# we need sudo permissions
|
||||||
if (whiptail --yesno "${USER^}, to update ${PROGRAM_NAME} we need sudo privileges." \
|
if getInputYesNo "${USER^}, to update ${PROGRAM_NAME} we need sudo privileges." \
|
||||||
--title "Give sudo Privileges" --backtitle "${BACK_TITLE}" 8 112); then
|
"Give sudo Privileges" 8 112; then
|
||||||
# remove the current version
|
# remove the current version
|
||||||
if [ -f /usr/local/bin/octojoom ]; then
|
if [ -f /usr/local/bin/octojoom ]; then
|
||||||
# just backup in case of failure
|
# just backup in case of failure
|
||||||
@ -2503,7 +2682,7 @@ function runUpdate() {
|
|||||||
# get the target branch to use in our update
|
# get the target branch to use in our update
|
||||||
isExpert && branch=$(getTargetBranch)
|
isExpert && 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/octojoom/raw/src/octojoom?ref=${branch:-master}" -o /usr/local/bin/octojoom 2>/dev/null; then
|
if sudo curl --fail -L "https://raw.githubusercontent.com/octoleo/octojoom/refs/heads/${branch:-master}/src/octojoom" -o /usr/local/bin/octojoom 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
|
||||||
@ -2761,6 +2940,9 @@ function showJoomla() {
|
|||||||
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
||||||
menu_options+=("fix" "Fix permissions of folders and files of a container") &&
|
menu_options+=("fix" "Fix permissions of folders and files of a container") &&
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
|
# clone a container & volume
|
||||||
|
hasDirectories 'joomla/available' &&
|
||||||
|
menu_options+=("clone" "Clone a container") && i=$((i + 1))
|
||||||
# delete a container
|
# delete a container
|
||||||
hasDirectories 'joomla/available' &&
|
hasDirectories 'joomla/available' &&
|
||||||
menu_options+=("delete" "Delete a container") && i=$((i + 1))
|
menu_options+=("delete" "Delete a container") && i=$((i + 1))
|
||||||
@ -2805,6 +2987,9 @@ function showJoomla() {
|
|||||||
"fix")
|
"fix")
|
||||||
fixContainersPermissions
|
fixContainersPermissions
|
||||||
;;
|
;;
|
||||||
|
"clone")
|
||||||
|
cloneContainer 'joomla'
|
||||||
|
;;
|
||||||
"delete")
|
"delete")
|
||||||
deleteContainer 'joomla'
|
deleteContainer 'joomla'
|
||||||
;;
|
;;
|
||||||
@ -2822,7 +3007,7 @@ function showJoomla() {
|
|||||||
|
|
||||||
# menu loop
|
# menu loop
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
"setup" | "edit" | "enable" | "disable" | "down" | "up" | "fix" | "delete" | "reset" | "joomla_env" | "bulk")
|
"setup" | "edit" | "enable" | "disable" | "down" | "up" | "fix" | "clone" | "delete" | "reset" | "joomla_env" | "bulk")
|
||||||
showJoomla
|
showJoomla
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -2927,6 +3112,8 @@ function showTraefik() {
|
|||||||
# delete traefik container
|
# delete traefik container
|
||||||
[ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
|
[ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
|
||||||
menu_options+=("delete" "Delete Traefik") && i=$((i + 1))
|
menu_options+=("delete" "Delete Traefik") && i=$((i + 1))
|
||||||
|
# set network if not set
|
||||||
|
isExpert && menu_options+=("network" "Set Network") && i=$((i + 1))
|
||||||
# Quit Octoleo Program
|
# Quit Octoleo Program
|
||||||
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
@ -2954,12 +3141,15 @@ function showTraefik() {
|
|||||||
"delete")
|
"delete")
|
||||||
deleteContainer 'traefik'
|
deleteContainer 'traefik'
|
||||||
;;
|
;;
|
||||||
|
"network")
|
||||||
|
setNetworks
|
||||||
|
;;
|
||||||
"quit") quitProgram ;;
|
"quit") quitProgram ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# menu loop
|
# menu loop
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
"setup" | "edit" | "enable" | "disable" | "delete")
|
"setup" | "edit" | "enable" | "disable" | "delete" | "network")
|
||||||
showTraefik
|
showTraefik
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -3450,6 +3640,42 @@ function getInput() {
|
|||||||
echo "${answer}"
|
echo "${answer}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Display a yes/no prompt using the whiptail utility.
|
||||||
|
# If "defaultno" is passed as the fifth parameter, it defaults to "No" when VDM_FORCE is set to "true".
|
||||||
|
# $1: Prompt message
|
||||||
|
# $2 (optional): Title for the dialog (default: "Confirmation Required")
|
||||||
|
# $3 (optional): Height of the dialog (default: 8)
|
||||||
|
# $4 (optional): Width of the dialog (default: 50)
|
||||||
|
# $5 (optional): Set to "defaultno" to make "No" the default choice.
|
||||||
|
# Returns 0 (yes) if the user selects "Yes".
|
||||||
|
# Returns 1 (no) if the user selects "No" or if "defaultno" is set and VDM_FORCE is "true".
|
||||||
|
function getInputYesNo() {
|
||||||
|
# set local vars
|
||||||
|
local question="$1"
|
||||||
|
local title="${2:-Confirmation Required}"
|
||||||
|
local height="${3:-8}"
|
||||||
|
local width="${4:-50}"
|
||||||
|
local defaultno="${5:-}"
|
||||||
|
|
||||||
|
# Handle VDM_FORCE behavior based on the 'defaultno' parameter
|
||||||
|
if [ "$VDM_FORCE" = "true" ]; then
|
||||||
|
if [ "$defaultno" = "defaultno" ]; then
|
||||||
|
return 1 # Default to No if "defaultno" is set and VDM_FORCE is true
|
||||||
|
else
|
||||||
|
return 0 # Default to Yes if "defaultno" is not set and VDM_FORCE is true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Display the whiptail prompt with the provided parameters
|
||||||
|
if [ "$defaultno" = "defaultno" ]; then
|
||||||
|
whiptail --defaultno --yesno "$question" "$height" "$width" --title "$title" \
|
||||||
|
--backtitle "${BACK_TITLE}" 3>&1 1>&2 2>&3
|
||||||
|
else
|
||||||
|
whiptail --yesno "$question" "$height" "$width" --title "$title" \
|
||||||
|
--backtitle "${BACK_TITLE}" 3>&1 1>&2 2>&3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# get the input until is gotten
|
# get the input until is gotten
|
||||||
function getInputNow() {
|
function getInputNow() {
|
||||||
local message
|
local message
|
||||||
@ -3623,7 +3849,7 @@ function getImageSource() {
|
|||||||
local i=2
|
local i=2
|
||||||
# set the defaults
|
# set the defaults
|
||||||
default="joomla|https://hub.docker.com/_/joomla?tab=tags;https://raw.githubusercontent.com/joomla-docker/docker-joomla/master/docker-entrypoint.sh"
|
default="joomla|https://hub.docker.com/_/joomla?tab=tags;https://raw.githubusercontent.com/joomla-docker/docker-joomla/master/docker-entrypoint.sh"
|
||||||
default_octojoom="llewellyn/joomla|https://hub.docker.com/r/llewellyn/joomla/tags;https://git.vdm.dev/octoleo/docker-joomla/raw/branch/octoleo/docker-entrypoint.sh"
|
default_octojoom="llewellyn/joomla|https://hub.docker.com/r/llewellyn/joomla/tags;https://raw.githubusercontent.com/octoleo/docker-joomla/refs/heads/octoleo/docker-entrypoint.sh"
|
||||||
# we only ask if we are in expert mode
|
# we only ask if we are in expert mode
|
||||||
if isExpert; then
|
if isExpert; then
|
||||||
# set the base images source
|
# set the base images source
|
||||||
@ -3772,9 +3998,9 @@ function getMainDomain() {
|
|||||||
# set the container user
|
# set the container user
|
||||||
function setContainerUser() {
|
function setContainerUser() {
|
||||||
# ask if a new User ID should be set if one is set
|
# ask if a new User ID should be set if one is set
|
||||||
if [ -n "${VDM_PUID}" ] && [[ "${VDM_PUID}" =~ ^[0-9]+$ ]] &&
|
if [ -n "${VDM_PUID}" ] && [[ "${VDM_PUID}" =~ ^[0-9]+$ ]] && \
|
||||||
(whiptail --yesno "The user ID in ${PROGRAM_NAME} memory is ${VDM_PUID}, would you like to change this user ID?" \
|
getInputYesNo "The user ID in ${PROGRAM_NAME} memory is ${VDM_PUID}, would you like to change this user ID?" \
|
||||||
--defaultno --title "Set User ID" --backtitle "${BACK_TITLE}" 8 112); then
|
"Set User ID" 8 112 "defaultno"; then
|
||||||
# always first reset
|
# always first reset
|
||||||
unset VDM_PUID
|
unset VDM_PUID
|
||||||
fi
|
fi
|
||||||
@ -3789,10 +4015,11 @@ function setContainerUser() {
|
|||||||
showError "You must enter a user ID like: ${1:-1000} (only the number)"
|
showError "You must enter a user ID like: ${1:-1000} (only the number)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# ask if a new Group ID should be set if one is set
|
# ask if a new Group ID should be set if one is set
|
||||||
if [ -n "${VDM_PGID}" ] && [[ "${VDM_PGID}" =~ ^[0-9]+$ ]] &&
|
if [ -n "${VDM_PGID}" ] && [[ "${VDM_PGID}" =~ ^[0-9]+$ ]] && \
|
||||||
(whiptail --yesno "The user-group ID in ${PROGRAM_NAME} memory is ${VDM_PGID}, would you like to change this user-group ID?" \
|
getInputYesNo "The user-group ID in ${PROGRAM_NAME} memory is ${VDM_PGID}, would you like to change this user-group ID?" \
|
||||||
--defaultno --title "Set User-Group ID" --backtitle "${BACK_TITLE}"8 112); then
|
"Set User-Group ID" 8 112 "defaultno"; then
|
||||||
# always first reset
|
# always first reset
|
||||||
unset VDM_PGID
|
unset VDM_PGID
|
||||||
fi
|
fi
|
||||||
@ -3962,8 +4189,8 @@ function setUniqueKey() {
|
|||||||
# set the Joomla website details
|
# set the Joomla website details
|
||||||
function setJoomlaWebsiteDetails() {
|
function setJoomlaWebsiteDetails() {
|
||||||
# ask if we should add auto deployment
|
# ask if we should add auto deployment
|
||||||
if (whiptail --yesno "Would you like to enable website autodeploy for ${VDM_CONTAINER_TYPE,}:${VDM_JV}" \
|
if getInputYesNo "Would you like to enable website auto deploy for ${VDM_CONTAINER_TYPE,}:${VDM_JV}" \
|
||||||
--defaultno --title "Enable Autodeploy" --backtitle "${BACK_TITLE}" 8 112); then
|
"Enable Auto deploy" 8 112; then
|
||||||
|
|
||||||
# ask for website name
|
# ask for website name
|
||||||
setJoomlaSiteName
|
setJoomlaSiteName
|
||||||
@ -4233,8 +4460,8 @@ function isVersionAbove() {
|
|||||||
# set persistence volumes
|
# set persistence volumes
|
||||||
function setPersistence() {
|
function setPersistence() {
|
||||||
# ask the question
|
# ask the question
|
||||||
if (whiptail --yesno "Would you like to enable persistence on this $1." \
|
if getInputYesNo "Would you like to enable persistence on this $1." \
|
||||||
--title "Persist Volume" --backtitle "${BACK_TITLE}" 8 112); then
|
"Persist Volume" 8 112; then
|
||||||
# yes persistence
|
# yes persistence
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -4245,8 +4472,8 @@ function setPersistence() {
|
|||||||
# set the PHP settings
|
# set the PHP settings
|
||||||
function setPHPSettings() {
|
function setPHPSettings() {
|
||||||
# ask the question
|
# ask the question
|
||||||
if (whiptail --yesno "Would you like to set some PHP overrides for the Joomla container.\n\nTo make these changes we need sudo privileges." \
|
if getInputYesNo "Would you like to set some PHP overrides for the Joomla container.\n\nTo make these changes we need sudo privileges." \
|
||||||
--defaultno --title "PHP.ini values" --backtitle "${BACK_TITLE}" 9 112); then
|
"PHP.ini values" 9 112; then
|
||||||
|
|
||||||
# max_execution_time
|
# max_execution_time
|
||||||
VDM_max_execution_time=$(getInputNow "Enter max execution time" \
|
VDM_max_execution_time=$(getInputNow "Enter max execution time" \
|
||||||
@ -4306,8 +4533,8 @@ function setPHPSettings() {
|
|||||||
} > "${VDM_PROJECT_PATH}/${VDM_PHP_PROJECT_PATH}/php.ini"
|
} > "${VDM_PROJECT_PATH}/${VDM_PHP_PROJECT_PATH}/php.ini"
|
||||||
|
|
||||||
# allow custom edit
|
# allow custom edit
|
||||||
if isExpert && (whiptail --yesno "Would you like to set some more custom PHP overrides for this Joomla container" \
|
if isExpert && getInputYesNo "Would you like to set some more custom PHP overrides for this Joomla container" \
|
||||||
--defaultno --title "Edit PHP.ini" --backtitle "${BACK_TITLE}" 8 112); then
|
"Edit PHP.ini" 8 112 "defaultno"; then
|
||||||
# give little heads-up
|
# give little heads-up
|
||||||
showNotice "${USER^}, to save the changes you've made or to just close the file again press:\n\n[ctrl+x] with nano on ubuntu." 13
|
showNotice "${USER^}, to save the changes you've made or to just close the file again press:\n\n[ctrl+x] with nano on ubuntu." 13
|
||||||
# lets open the file with nano for now
|
# lets open the file with nano for now
|
||||||
@ -4332,8 +4559,8 @@ function setPHPSettings() {
|
|||||||
# set the docker entrypoint
|
# set the docker entrypoint
|
||||||
function setDockerEntrypoint() {
|
function setDockerEntrypoint() {
|
||||||
# ask the question
|
# ask the question
|
||||||
if (whiptail --yesno "Would you like to customize the entrypoint script for this Joomla container" \
|
if getInputYesNo "Would you like to customize the entrypoint script for this Joomla container" \
|
||||||
--defaultno --title "entrypoint.sh values" --backtitle "${BACK_TITLE}" 8 112); then
|
"entrypoint.sh values" 8 112 "defaultno"; then
|
||||||
# make sure the directory exist
|
# make sure the directory exist
|
||||||
mkdir -p "${VDM_PROJECT_PATH}/${VDM_ENTRY_PROJECT_PATH}"
|
mkdir -p "${VDM_PROJECT_PATH}/${VDM_ENTRY_PROJECT_PATH}"
|
||||||
# unattended deploy
|
# unattended deploy
|
||||||
@ -4365,8 +4592,8 @@ function setDockerEntrypoint() {
|
|||||||
# set the secure state
|
# set the secure state
|
||||||
function setSecureCloudflareState() {
|
function setSecureCloudflareState() {
|
||||||
# check the security switch
|
# check the security switch
|
||||||
if (whiptail --yesno "Will this container be proxied by Cloudflare [ONLY for server proxied in none-strict mode via Cloudflare]" \
|
if getInputYesNo "Will this container be proxied by Cloudflare [ONLY for server proxied in none-strict mode via Cloudflare]" \
|
||||||
--defaultno --title "Cloudflare" --backtitle "${BACK_TITLE}" 8 112); then
|
"Cloudflare" 8 112 "defaultno"; then
|
||||||
# we set the secure switch
|
# we set the secure switch
|
||||||
VDM_SECURE_CLOUDFLARE=true
|
VDM_SECURE_CLOUDFLARE=true
|
||||||
else
|
else
|
||||||
@ -4380,8 +4607,8 @@ function setSecureCloudflareState() {
|
|||||||
function setSecureState() {
|
function setSecureState() {
|
||||||
if [ "${VDM_SECURE:-not}" = 'not' ]; then
|
if [ "${VDM_SECURE:-not}" = 'not' ]; then
|
||||||
# check the security switch
|
# check the security switch
|
||||||
if (whiptail --yesno "Would you like to use Letsencrypt auto setup for your containers [ONLY for server with public static IP]" \
|
if getInputYesNo "Would you like to use Letsencrypt auto setup for your containers [ONLY for server with public static IP]" \
|
||||||
--defaultno --title "Letsencrypt" --backtitle "${BACK_TITLE}" 8 112); then
|
"Letsencrypt" 8 112 "defaultno"; then
|
||||||
# we set the secure switch
|
# we set the secure switch
|
||||||
VDM_SECURE=true
|
VDM_SECURE=true
|
||||||
else
|
else
|
||||||
@ -4841,24 +5068,27 @@ function getMigrationType() {
|
|||||||
echo "${answer:-push}"
|
echo "${answer:-push}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if the remote .env file exists
|
# Check if the remote .env file exists using the remote user's home directory
|
||||||
function remoteEnvFileExists() {
|
function remoteEnvFileExists() {
|
||||||
local remote_system="$1"
|
local remote_system="$1"
|
||||||
|
|
||||||
# Check if the file exists on the remote system
|
# The tilde (~) expands to the home directory of the logged-in remote user.
|
||||||
# shellcheck disable=SC2029
|
# Using single quotes ensures that the command is passed literally to the remote shell,
|
||||||
ssh "${remote_system}" "[ -f \"${VDM_HOME_PATH}/.config/octojoom/.env\" ]"
|
# allowing the tilde expansion to occur remotely.
|
||||||
|
ssh "${remote_system}" '[ -f ~/.config/octojoom/.env ]'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get a specific value from the remote .env file
|
# Get a specific value from the remote .env file using the remote user's home directory
|
||||||
function getRemoteEnvValue() {
|
function getRemoteEnvValue() {
|
||||||
local remote_system="$1"
|
local remote_system="$1"
|
||||||
local env_key="$2"
|
local env_key="$2"
|
||||||
local remote_env_value
|
local remote_env_value
|
||||||
|
|
||||||
if remoteEnvFileExists "${remote_system}"; then
|
if remoteEnvFileExists "${remote_system}"; then
|
||||||
# shellcheck disable=SC2029
|
# Execute the grep command on the remote system.
|
||||||
remote_env_value=$(ssh "${remote_system}" "grep '^${env_key}=' \"${VDM_HOME_PATH}/.config/octojoom/.env\"" | cut -d '=' -f 2-)
|
# The command uses \$HOME so that the remote shell expands it to the logged-in user's home directory.
|
||||||
|
# The env_key variable is expanded locally, while the file path remains intact for the remote shell.
|
||||||
|
remote_env_value=$(ssh "${remote_system}" "grep '^${env_key}=' \"\$HOME/.config/octojoom/.env\"" | cut -d '=' -f 2-)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove any double quotes from the returned value
|
# Remove any double quotes from the returned value
|
||||||
@ -4895,11 +5125,13 @@ function pushContainerMigration() {
|
|||||||
remote_repo_path=$(getRemoteEnvValue "${remote}" "VDM_REPO_PATH")
|
remote_repo_path=$(getRemoteEnvValue "${remote}" "VDM_REPO_PATH")
|
||||||
if [ ! "${remote_repo_path}" = 'none_found' ]; then
|
if [ ! "${remote_repo_path}" = 'none_found' ]; then
|
||||||
local remote_path="${remote_repo_path}/${container_path}"
|
local remote_path="${remote_repo_path}/${container_path}"
|
||||||
# check how we must do this
|
# check if we must backup remote folder
|
||||||
if remoteFolderExists "${remote_path}" "${remote}" && (whiptail --yesno "${USER^}, would you like to backup the remote container?" \
|
if remoteFolderExists "${remote_path}" "${remote}" && (whiptail --yesno "${USER^}, would you like to backup the remote container?" \
|
||||||
--backtitle "${BACK_TITLE}" --title "Backup Remote" 15 112); then
|
--backtitle "${BACK_TITLE}" --title "Backup Remote" 15 112); then
|
||||||
backupRemoteFolder "${remote_path}" "${remote}"
|
backupRemoteFolder "${remote_path}" "${remote}"
|
||||||
fi
|
fi
|
||||||
|
# if folder still exist remove remote folder
|
||||||
|
removeRemoteFolder "${remote_path}" "${remote}"
|
||||||
# sync folder
|
# sync folder
|
||||||
syncWithRemote "${local_path}" "${remote_path}" "${remote}"
|
syncWithRemote "${local_path}" "${remote_path}" "${remote}"
|
||||||
# check if it was done successfully
|
# check if it was done successfully
|
||||||
@ -4966,6 +5198,8 @@ function pushDirectoryMigration() {
|
|||||||
then
|
then
|
||||||
backupRemoteFolder "${remote_path}" "${remote}"
|
backupRemoteFolder "${remote_path}" "${remote}"
|
||||||
fi
|
fi
|
||||||
|
# if folder still exist remove remote folder
|
||||||
|
removeRemoteFolder "${remote_path}" "${remote}"
|
||||||
# un-tar the remote file
|
# un-tar the remote file
|
||||||
remoteUntarGz "${remote_path}.tar.gz" "${remote_path}" "${remote}"
|
remoteUntarGz "${remote_path}.tar.gz" "${remote_path}" "${remote}"
|
||||||
# we are done
|
# we are done
|
||||||
@ -5095,6 +5329,17 @@ function backupRemoteFolder() {
|
|||||||
ssh "${remote}" "if [ -d '${remote_path}' ]; then mv '${remote_path}' '${backup_name}'; fi"
|
ssh "${remote}" "if [ -d '${remote_path}' ]; then mv '${remote_path}' '${backup_name}'; fi"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# remove the remote folder
|
||||||
|
function removeRemoteFolder() {
|
||||||
|
local remote_path="$1"
|
||||||
|
local remote="$2"
|
||||||
|
# always confirm that the path exist
|
||||||
|
if remoteFolderExists "${remote_path}" "${remote}"; then
|
||||||
|
# shellcheck disable=SC2029
|
||||||
|
ssh "${remote}" "if [ -d '${remote_path}' ]; then sudo rm -Irf '${remote_path}'; fi"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Prep remote folder
|
# Prep remote folder
|
||||||
function prepRemoteFolder() {
|
function prepRemoteFolder() {
|
||||||
local remote_path="$1"
|
local remote_path="$1"
|
||||||
@ -5323,6 +5568,7 @@ EOF
|
|||||||
|
|
||||||
# defaults
|
# defaults
|
||||||
VDM_ARG_DOMAIN=false
|
VDM_ARG_DOMAIN=false
|
||||||
|
VDM_FORCE=false
|
||||||
|
|
||||||
# check if we have options
|
# check if we have options
|
||||||
while :; do
|
while :; do
|
||||||
@ -5335,6 +5581,9 @@ while :; do
|
|||||||
runUpdate
|
runUpdate
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-y | --yes)
|
||||||
|
VDM_FORCE=true
|
||||||
|
;;
|
||||||
--access-token) # Takes an option argument; ensure it has been specified.
|
--access-token) # Takes an option argument; ensure it has been specified.
|
||||||
if [ "$2" ]; then
|
if [ "$2" ]; then
|
||||||
VDM_ACCESS_TOKEN=$2
|
VDM_ACCESS_TOKEN=$2
|
||||||
|
Reference in New Issue
Block a user