Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
593ae84c89
|
|||
962b1628c2
|
|||
b666db9f33
|
182
src/octojoom
182
src/octojoom
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# The most recent program version.
|
||||
_VERSION="3.6.2"
|
||||
_VERSION="3.6.4"
|
||||
_V="3.6"
|
||||
|
||||
# Bash version required
|
||||
@ -628,7 +628,7 @@ function joomla__TRuST__setup() {
|
||||
fi
|
||||
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_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1080")
|
||||
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1025")
|
||||
fi
|
||||
# if this is our octoleo images we can also set the user ID and user-group ID
|
||||
setContainerUser "$(id -u)"
|
||||
@ -1072,7 +1072,7 @@ function joomla__TRuST__bulk() {
|
||||
fi
|
||||
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_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1080")
|
||||
VDM_EXTRA_JOOMLA_ENV+=$(getYMLine3 "- JOOMLA_SMTP_HOST=mailcatcher${VDM_KEY}:1025")
|
||||
fi
|
||||
# setup letsencrypt stuff
|
||||
VDM_JOOMLA_SECURE_LABELS=''
|
||||
@ -1534,6 +1534,8 @@ function joomla__TRuST__enable() {
|
||||
[ -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}"
|
||||
}
|
||||
# set some local variables
|
||||
local evn_file
|
||||
# check if image has its own env file also
|
||||
evn_file=''
|
||||
# shellcheck disable=SC2015
|
||||
@ -1555,6 +1557,7 @@ function joomla__TRuST__enable() {
|
||||
# set some local variables
|
||||
local vdm_enable_me
|
||||
local container
|
||||
local evn_file
|
||||
# create the folder as needed
|
||||
mkdir -p "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/"
|
||||
# get containers to enable
|
||||
@ -1603,6 +1606,8 @@ function openssh__TRuST__enable() {
|
||||
[ -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}"
|
||||
}
|
||||
# set some local variables
|
||||
local evn_file
|
||||
# check if image has its own env file also
|
||||
evn_file=''
|
||||
# shellcheck disable=SC2015
|
||||
@ -1713,10 +1718,21 @@ function joomla__TRuST__disable() {
|
||||
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
||||
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
|
||||
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
|
||||
# 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
|
||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
|
||||
# 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
|
||||
}
|
||||
# then remove soft link
|
||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
||||
else
|
||||
@ -1729,6 +1745,7 @@ function joomla__TRuST__disable() {
|
||||
# set some local variables
|
||||
local vdm_disable_me
|
||||
local container
|
||||
local evn_file
|
||||
# get containers to enable
|
||||
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
|
||||
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
|
||||
@ -1740,8 +1757,17 @@ function joomla__TRuST__disable() {
|
||||
for containered in "${vdm_disable_me_array[@]}"; do
|
||||
# remove the " from the string
|
||||
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
|
||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
|
||||
# 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
|
||||
}
|
||||
# then remove soft link
|
||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
||||
done
|
||||
@ -1756,10 +1782,21 @@ function openssh__TRuST__disable() {
|
||||
if ! hasDirectories "${VDM_CONTAINER_TYPE}/enabled/"; then
|
||||
showError "There are no ${VDM_CONTAINER_TYPE^} containers to disable."
|
||||
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
|
||||
# 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
|
||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}/docker-compose.yml" down --remove-orphans
|
||||
# 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
|
||||
}
|
||||
# then remove soft link
|
||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${VDM_CONTAINER}"
|
||||
else
|
||||
@ -1772,6 +1809,7 @@ function openssh__TRuST__disable() {
|
||||
# set some local variables
|
||||
local vdm_disable_me
|
||||
local container
|
||||
local evn_file
|
||||
# get containers to enable
|
||||
vdm_disable_me=$(getSelectedDirectories "Select container/s to disable." \
|
||||
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/" "Disable ${VDM_CONTAINER_TYPE^} Containers")
|
||||
@ -1783,8 +1821,17 @@ function openssh__TRuST__disable() {
|
||||
for containered in "${vdm_disable_me_array[@]}"; do
|
||||
# remove the " from the string
|
||||
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
|
||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}/docker-compose.yml" down --remove-orphans
|
||||
# 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
|
||||
}
|
||||
# then remove soft link
|
||||
rm -rf "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/enabled/${container}"
|
||||
done
|
||||
@ -1799,8 +1846,19 @@ function traefik__TRuST__disable() {
|
||||
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
|
||||
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
|
||||
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
|
||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
||||
# 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
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1811,8 +1869,19 @@ function portainer__TRuST__disable() {
|
||||
if [ ! -f "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" ]; then
|
||||
showError "There is no ${VDM_CONTAINER_TYPE^} container to disable."
|
||||
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
|
||||
docker-compose --file "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" down
|
||||
# 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
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1909,6 +1978,42 @@ function openssh__TRuST__down() {
|
||||
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 (whiptail --yesno "Would you like to clone a persistent volume found in (${VDM_PROJECT_PATH})?" \
|
||||
--title "Continue To Clone Persistent Volume" --backtitle "${BACK_TITLE}" 12 112); then
|
||||
# trigger the volumes clone script
|
||||
clonePersistentVolume
|
||||
fi
|
||||
# ask if they want to clone a container
|
||||
if (whiptail --yesno "Would you like to clone a ${VDM_CONTAINER_TYPE^} container?" \
|
||||
--title "Continue To Clone Container (feature not ready)" --defaultno --backtitle "${BACK_TITLE}" 12 112); 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
|
||||
######################################## DELETE JOOMLA
|
||||
function joomla__TRuST__delete() {
|
||||
@ -2232,6 +2337,15 @@ function upContainers() {
|
||||
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
|
||||
function deleteContainer() {
|
||||
# make sure of our container type
|
||||
@ -2447,6 +2561,44 @@ function deletePersistentVolumes() {
|
||||
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
|
||||
function resetPersistentJoomlaVolumes() {
|
||||
# we first check if we have some volumes
|
||||
@ -2761,6 +2913,9 @@ function showJoomla() {
|
||||
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
||||
menu_options+=("fix" "Fix permissions of folders and files of a container") &&
|
||||
i=$((i + 1))
|
||||
# clone a container & volume
|
||||
hasDirectories 'joomla/available' &&
|
||||
menu_options+=("clone" "Clone a container") && i=$((i + 1))
|
||||
# delete a container
|
||||
hasDirectories 'joomla/available' &&
|
||||
menu_options+=("delete" "Delete a container") && i=$((i + 1))
|
||||
@ -2805,6 +2960,9 @@ function showJoomla() {
|
||||
"fix")
|
||||
fixContainersPermissions
|
||||
;;
|
||||
"clone")
|
||||
cloneContainer 'joomla'
|
||||
;;
|
||||
"delete")
|
||||
deleteContainer 'joomla'
|
||||
;;
|
||||
@ -2822,7 +2980,7 @@ function showJoomla() {
|
||||
|
||||
# menu loop
|
||||
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
|
||||
;;
|
||||
esac
|
||||
|
Reference in New Issue
Block a user