Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
9535c3b74d
|
|||
a1f7c8fa39
|
|||
e4a4714b0a
|
|||
66d20ef68d
|
@ -8,6 +8,8 @@ There are more than one .env file and the script will set those up for you whene
|
|||||||
the script will check if those values exist, and if they don't it will ask for them, and store them automatically for future use.
|
the script will check if those values exist, and if they don't it will ask for them, and store them automatically for future use.
|
||||||
That same time the output message to the terminal will show you where the specific .env file can be found.
|
That same time the output message to the terminal will show you where the specific .env file can be found.
|
||||||
|
|
||||||
|
> program only for ubuntu/debian systems at this time (should you like to use it on other OS's please open and issue...)
|
||||||
|
|
||||||
---
|
---
|
||||||
# Install
|
# Install
|
||||||
```shell
|
```shell
|
||||||
|
553
src/octojoom
553
src/octojoom
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The most recent program version.
|
# The most recent program version.
|
||||||
_VERSION="3.0.0"
|
_VERSION="3.1.0"
|
||||||
_V="3.0"
|
_V="3.1"
|
||||||
|
|
||||||
# The program full name
|
# The program full name
|
||||||
PROGRAM_NAME="Octojoom"
|
PROGRAM_NAME="Octojoom"
|
||||||
@ -259,13 +259,22 @@ function joomla__TRuST__setup() {
|
|||||||
local vdm_env_pass
|
local vdm_env_pass
|
||||||
local vdm_key_root
|
local vdm_key_root
|
||||||
local vdm_env_root
|
local vdm_env_root
|
||||||
|
# get the Joomla image source
|
||||||
|
VDM_J_REPO='joomla'
|
||||||
|
isExpert && VDM_J_REPO=$(getImageSource)
|
||||||
|
# build the URL
|
||||||
|
if [ "${VDM_J_REPO}" = 'joomla' ]; then
|
||||||
|
vdm_image_repo_url="https://hub.docker.com/_/${VDM_J_REPO}?tab=tags"
|
||||||
|
else
|
||||||
|
vdm_image_repo_url="https://hub.docker.com/r/${VDM_J_REPO}/tags"
|
||||||
|
fi
|
||||||
# get the Joomla version if not set
|
# get the Joomla version if not set
|
||||||
while [ ${#VDM_JV} -le 1 ]; do
|
while [ ${#VDM_JV} -le 1 ]; do
|
||||||
# get the value
|
# get the value
|
||||||
VDM_JV=$(getInput 'Enter Joomla version tag for this container.\n[See available tags here https://hub.docker.com/_/joomla]' '3.10' 'Enter Version Tag')
|
VDM_JV=$(getInput "Enter Joomla version tag for this container.\n[See available tags here ${vdm_image_repo_url}]" '3.10' 'Enter Version Tag')
|
||||||
# keep asking
|
# keep asking
|
||||||
[ ${#VDM_JV} -ge 1 ] || {
|
[ ${#VDM_JV} -ge 1 ] || {
|
||||||
showError "You must enter a version tag. See available tags here https://hub.docker.com/_/joomla"
|
showError "You must enter a version tag. See available tags here ${vdm_image_repo_url}"
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
# get the key if not set
|
# get the key if not set
|
||||||
@ -348,8 +357,32 @@ function joomla__TRuST__setup() {
|
|||||||
}
|
}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
# set persistence
|
||||||
|
# only if in expert mode
|
||||||
|
if isExpert; then
|
||||||
|
if setPersistence; then
|
||||||
|
VDM_PERSISTENCE=''
|
||||||
|
VDM_NOT_PERSISTENCE='#'
|
||||||
|
else
|
||||||
|
VDM_PERSISTENCE='#'
|
||||||
|
VDM_NOT_PERSISTENCE=''
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
VDM_PERSISTENCE=''
|
||||||
|
VDM_NOT_PERSISTENCE='#'
|
||||||
|
fi
|
||||||
# add the projects path
|
# add the projects path
|
||||||
setContainerEnvVariable "VDM_PROJECT_PATH=\"${VDM_PROJECT_PATH}\""
|
setContainerEnvVariable "VDM_PROJECT_PATH=\"${VDM_PROJECT_PATH}\""
|
||||||
|
# set the container user detail id needed
|
||||||
|
if [ "${VDM_J_REPO}" = 'llewellyn/joomla' ]; then
|
||||||
|
# if this is our octoleo images we can also set the user ID and user-group ID
|
||||||
|
setContainerUser "$(id -u)"
|
||||||
|
# check that we got the details
|
||||||
|
if [ -n "${VDM_PUID}" ] && [ -n "${VDM_PGID}" ]; then
|
||||||
|
setContainerEnvVariable "VDM_${VDM_ENV_KEY^^}_PUID=\"#${VDM_PUID}\""
|
||||||
|
setContainerEnvVariable "VDM_${VDM_ENV_KEY^^}_PGID=\"#${VDM_PGID}\""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
[ ${#vdm_database_name} -ge 1 ] && setContainerEnvVariable "VDM_${VDM_ENV_KEY^^}_DB=\"${vdm_database_name}\""
|
[ ${#vdm_database_name} -ge 1 ] && setContainerEnvVariable "VDM_${VDM_ENV_KEY^^}_DB=\"${vdm_database_name}\""
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
@ -365,10 +398,13 @@ function joomla__TRuST__setup() {
|
|||||||
export VDM_REPO_PATH
|
export VDM_REPO_PATH
|
||||||
export VDM_PROJECT_PATH
|
export VDM_PROJECT_PATH
|
||||||
# container
|
# container
|
||||||
|
export VDM_J_REPO
|
||||||
export VDM_JV
|
export VDM_JV
|
||||||
export VDM_REMOVE_SECURE
|
export VDM_REMOVE_SECURE
|
||||||
export VDM_ENTRY_POINT
|
export VDM_ENTRY_POINT
|
||||||
export VDM_HTTP_SCHEME
|
export VDM_HTTP_SCHEME
|
||||||
|
export VDM_PERSISTENCE
|
||||||
|
export VDM_NOT_PERSISTENCE
|
||||||
# container lower
|
# container lower
|
||||||
export vdm_database_name
|
export vdm_database_name
|
||||||
export vdm_database_user
|
export vdm_database_user
|
||||||
@ -400,12 +436,15 @@ function joomla__TRuST__setup() {
|
|||||||
### unset all no longer needed
|
### unset all no longer needed
|
||||||
# container
|
# container
|
||||||
unset VDM_SUBDOMAIN
|
unset VDM_SUBDOMAIN
|
||||||
|
unset VDM_J_REPO
|
||||||
unset VDM_JV
|
unset VDM_JV
|
||||||
unset VDM_KEY
|
unset VDM_KEY
|
||||||
unset VDM_ENV_KEY
|
unset VDM_ENV_KEY
|
||||||
unset VDM_REMOVE_SECURE
|
unset VDM_REMOVE_SECURE
|
||||||
unset VDM_ENTRY_POINT
|
unset VDM_ENTRY_POINT
|
||||||
unset VDM_HTTP_SCHEME
|
unset VDM_HTTP_SCHEME
|
||||||
|
unset VDM_PERSISTENCE
|
||||||
|
unset VDM_NOT_PERSISTENCE
|
||||||
# container lower
|
# container lower
|
||||||
unset vdm_database_name
|
unset vdm_database_name
|
||||||
unset vdm_database_user
|
unset vdm_database_user
|
||||||
@ -417,6 +456,13 @@ function joomla__TRuST__setup() {
|
|||||||
|
|
||||||
# return the Joomla Container setup yml
|
# return the Joomla Container setup yml
|
||||||
function joomlaContainer() {
|
function joomlaContainer() {
|
||||||
|
# set the USER if set
|
||||||
|
vdm_container_user=''
|
||||||
|
if [ -n "${VDM_PUID}" ] && [ -n "${VDM_PGID}" ]; then
|
||||||
|
vdm_container_user="
|
||||||
|
- APACHE_RUN_USER=\${VDM_${VDM_ENV_KEY^^}_PUID}
|
||||||
|
- APACHE_RUN_GROUP=\${VDM_${VDM_ENV_KEY^^}_PGID}"
|
||||||
|
fi
|
||||||
# we build the yml file
|
# we build the yml file
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
version: '2'
|
version: '2'
|
||||||
@ -431,14 +477,15 @@ services:
|
|||||||
- MARIADB_PASSWORD=\${VDM_${VDM_ENV_KEY^^}_DB_PASS}
|
- MARIADB_PASSWORD=\${VDM_${VDM_ENV_KEY^^}_DB_PASS}
|
||||||
- MARIADB_ROOT_PASSWORD=\${VDM_${VDM_ENV_KEY^^}_DB_ROOT}
|
- MARIADB_ROOT_PASSWORD=\${VDM_${VDM_ENV_KEY^^}_DB_ROOT}
|
||||||
volumes:
|
volumes:
|
||||||
- "\${VDM_PROJECT_PATH}/${VDM_KEY}/db:/var/lib/mysql"
|
${VDM_PERSISTENCE} - "\${VDM_PROJECT_PATH}/${VDM_KEY}/db:/var/lib/mysql"
|
||||||
|
${VDM_NOT_PERSISTENCE} - ${VDM_KEY,,}_db:/var/lib/mysql
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
joomla_${VDM_KEY}:
|
joomla_${VDM_KEY}:
|
||||||
image: joomla:${VDM_JV}
|
image: ${VDM_J_REPO}:${VDM_JV}
|
||||||
container_name: joomla_${VDM_KEY}
|
container_name: joomla_${VDM_KEY}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:${vdm_container_user}
|
||||||
- JOOMLA_DB_HOST=mariadb_${VDM_KEY}:3306
|
- JOOMLA_DB_HOST=mariadb_${VDM_KEY}:3306
|
||||||
- JOOMLA_DB_NAME=\${VDM_${VDM_ENV_KEY^^}_DB}
|
- JOOMLA_DB_NAME=\${VDM_${VDM_ENV_KEY^^}_DB}
|
||||||
- JOOMLA_DB_USER=\${VDM_${VDM_ENV_KEY^^}_DB_USER}
|
- JOOMLA_DB_USER=\${VDM_${VDM_ENV_KEY^^}_DB_USER}
|
||||||
@ -446,7 +493,8 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- mariadb_${VDM_KEY}
|
- mariadb_${VDM_KEY}
|
||||||
volumes:
|
volumes:
|
||||||
- "\${VDM_PROJECT_PATH}/${VDM_KEY}/joomla:/var/www/html"
|
${VDM_PERSISTENCE} - "\${VDM_PROJECT_PATH}/${VDM_KEY}/joomla:/var/www/html"
|
||||||
|
${VDM_NOT_PERSISTENCE} - ${VDM_KEY,,}_web:/var/www/html
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
@ -482,6 +530,10 @@ networks:
|
|||||||
traefik:
|
traefik:
|
||||||
external:
|
external:
|
||||||
name: traefik_webgateway
|
name: traefik_webgateway
|
||||||
|
|
||||||
|
${VDM_NOT_PERSISTENCE}volumes:
|
||||||
|
${VDM_NOT_PERSISTENCE} ${VDM_KEY,,}_web:
|
||||||
|
${VDM_NOT_PERSISTENCE} ${VDM_KEY,,}_db:
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,6 +565,8 @@ function openssh__TRuST__setup() {
|
|||||||
showError "You must enter a username for the container"
|
showError "You must enter a username for the container"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# be sure to set the container USER ID
|
||||||
|
setContainerUser 33
|
||||||
# get the key if not set
|
# get the key if not set
|
||||||
setUniqueKey "Enter key used for container naming."
|
setUniqueKey "Enter key used for container naming."
|
||||||
# get the env key if not set
|
# get the env key if not set
|
||||||
@ -682,8 +736,8 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
hostname: ${VDM_DOMAIN:-vdm.dev}
|
hostname: ${VDM_DOMAIN:-vdm.dev}
|
||||||
environment:
|
environment:
|
||||||
- PUID=${VDM_PUID:-33}
|
- PUID=${VDM_PUID}
|
||||||
- PGID=${VDM_PGID:-33}
|
- PGID=${VDM_PGID}
|
||||||
- TZ=${VDM_TZ:-Africa/Windhoek}
|
- TZ=${VDM_TZ:-Africa/Windhoek}
|
||||||
- PUBLIC_KEY_DIR=/config/ssh_public_keys
|
- PUBLIC_KEY_DIR=/config/ssh_public_keys
|
||||||
- SUDO_ACCESS=${VDM_SUDO_ACCESS:-false}
|
- SUDO_ACCESS=${VDM_SUDO_ACCESS:-false}
|
||||||
@ -1400,7 +1454,7 @@ function deleteContainer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# To fix the permissions of Joomla containers
|
# To fix the permissions of Joomla containers
|
||||||
function fixContainerPermissions() {
|
function fixContainersPermissions() {
|
||||||
# check if we have persistent volumes
|
# check if we have persistent volumes
|
||||||
if [ ! -d "${VDM_PROJECT_PATH}" ]; then
|
if [ ! -d "${VDM_PROJECT_PATH}" ]; then
|
||||||
showError "The ${VDM_PROJECT_PATH} does not exist."
|
showError "The ${VDM_PROJECT_PATH} does not exist."
|
||||||
@ -1423,54 +1477,95 @@ function fixContainerPermissions() {
|
|||||||
persistent="${volume//\"/}"
|
persistent="${volume//\"/}"
|
||||||
# make sure this is a joomla system
|
# make sure this is a joomla system
|
||||||
if [ -d "${VDM_PROJECT_PATH}/${persistent}/joomla" ]; then
|
if [ -d "${VDM_PROJECT_PATH}/${persistent}/joomla" ]; then
|
||||||
|
# show the notice of the volume being fixed
|
||||||
|
showNotice "Fixing ${persistent}/joomla permissions now."
|
||||||
|
# if this is our octoleo images we can also set the user ID and user-group ID
|
||||||
|
setContainerUser "$(id -u)"
|
||||||
### Fix the folder ownership of Joomla folders
|
### Fix the folder ownership of Joomla folders
|
||||||
# id -u www-data
|
# id -u www-data
|
||||||
# getent group www-data | awk -F: '{printf "Group %s with GID=%d\n", $1, $3}'
|
# id -g www-data
|
||||||
echo "Fixing the folder ownership of ${persistent} Joomla folders to belong to 33:www-data"
|
|
||||||
#
|
#
|
||||||
sudo chown -R 33:33 "${VDM_PROJECT_PATH}/${persistent}/joomla"
|
sudo chown -R "$VDM_PUID":"$VDM_PGID" "${VDM_PROJECT_PATH}/${persistent}/joomla" &
|
||||||
|
showProgress "chown" "Setting the ownership of ${persistent} Joomla directory/files.\n(c h o w n -R $VDM_PUID:$VDM_PGID ${persistent}/joomla)"
|
||||||
### Fix the folder permissions for the Joomla websites
|
### Fix the folder permissions for the Joomla websites
|
||||||
#
|
#
|
||||||
echo "Fixing the file and folder permissions for the ${persistent} Joomla website"
|
|
||||||
#
|
|
||||||
# Change the file permissions
|
# Change the file permissions
|
||||||
sudo find "${VDM_PROJECT_PATH}/${persistent}/joomla" -type f -exec chmod 644 {} \;
|
sudo find "${VDM_PROJECT_PATH}/${persistent}/joomla" -type f -exec chmod 644 {} \; &
|
||||||
sudo find "${VDM_PROJECT_PATH}/${persistent}/joomla/configuration.php" -type f -exec chmod 444 {} \;
|
showProgress "find" "Setting the files permissions for the ${persistent} Joomla website.\n(f i n d ${persistent}/joomla -type f -exec chmod 644 {} \;)"
|
||||||
|
[ -f "${VDM_PROJECT_PATH}/${persistent}/joomla/configuration.php" ] &&
|
||||||
|
sudo chmod 444 "${VDM_PROJECT_PATH}/${persistent}/joomla/configuration.php"
|
||||||
[ -f "${VDM_PROJECT_PATH}/${persistent}/joomla/.htaccess" ] &&
|
[ -f "${VDM_PROJECT_PATH}/${persistent}/joomla/.htaccess" ] &&
|
||||||
sudo find "${VDM_PROJECT_PATH}/${persistent}/joomla/.htaccess" -type f -exec chmod 400 {} \;
|
sudo chmod 400 "${VDM_PROJECT_PATH}/${persistent}/joomla/.htaccess"
|
||||||
[ -f "${VDM_PROJECT_PATH}/${persistent}/joomla/php.ini" ] &&
|
[ -f "${VDM_PROJECT_PATH}/${persistent}/joomla/php.ini" ] &&
|
||||||
sudo find "${VDM_PROJECT_PATH}/${persistent}/joomla/php.ini" -type f -exec chmod 400 {} \;
|
sudo chmod 400 "${VDM_PROJECT_PATH}/${persistent}/joomla/php.ini"
|
||||||
# Change the folder permissions
|
# Change the folder permissions
|
||||||
sudo find /"home/${USER}/Projects/${persistent}/joomla" -type d -exec chmod 755 {} \;
|
sudo find /"home/${USER}/Projects/${persistent}/joomla" -type d -exec chmod 755 {} \; &
|
||||||
|
showProgress "chown" "Setting the directory permissions for the ${persistent} Joomla website.\n(f i n d ${persistent}/joomla -type d -exec chmod 755 {} \;)"
|
||||||
|
# lock jetbrains folder
|
||||||
|
[ -e "${VDM_PROJECT_PATH}/${persistent}/joomla/.idea" ] && {
|
||||||
|
sudo chmod -R 700 "${VDM_PROJECT_PATH}/${persistent}/joomla/.idea"
|
||||||
|
# add a locking .htaccess file and set its access
|
||||||
|
lockFolder >"${VDM_PROJECT_PATH}/${persistent}/joomla/.idea/.htaccess"
|
||||||
|
sudo chmod 400 "${VDM_PROJECT_PATH}/${persistent}/joomla/.idea/.htaccess"
|
||||||
|
}
|
||||||
|
# lock hidden folder
|
||||||
|
[ -e "${VDM_PROJECT_PATH}/${persistent}/joomla/.hidden" ] && {
|
||||||
|
sudo chmod -R 700 "${VDM_PROJECT_PATH}/${persistent}/joomla/.hidden"
|
||||||
|
# add a locking .htaccess file and set its access
|
||||||
|
lockFolder >"${VDM_PROJECT_PATH}/${persistent}/joomla/.hidden/.htaccess"
|
||||||
|
sudo chmod 400 "${VDM_PROJECT_PATH}/${persistent}/joomla/.hidden/.htaccess"
|
||||||
|
}
|
||||||
|
# lock git folder
|
||||||
|
[ -e "${VDM_PROJECT_PATH}/${persistent}/joomla/.git" ] && {
|
||||||
|
sudo chmod -R 700 "${VDM_PROJECT_PATH}/${persistent}/joomla/.git"
|
||||||
|
# add a locking .htaccess file and set its access
|
||||||
|
lockFolder >"${VDM_PROJECT_PATH}/${persistent}/joomla/.git/.htaccess"
|
||||||
|
sudo chmod 400 "${VDM_PROJECT_PATH}/${persistent}/joomla/.git/.htaccess"
|
||||||
|
}
|
||||||
|
# lock the tmp folder
|
||||||
|
[ -e "${VDM_PROJECT_PATH}/${persistent}/joomla/tmp" ] && {
|
||||||
|
sudo chmod -R 700 "${VDM_PROJECT_PATH}/${persistent}/joomla/tmp"
|
||||||
|
# add a locking .htaccess file and set its access
|
||||||
|
# lockFolder > "${VDM_PROJECT_PATH}/${persistent}/joomla/tmp/.htaccess"
|
||||||
|
# sudo chmod 400 "${VDM_PROJECT_PATH}/${persistent}/joomla/tmp/.htaccess"
|
||||||
|
}
|
||||||
# Change the image folder permissions
|
# Change the image folder permissions
|
||||||
# chmod 707 "${VDM_PROJECT_PATH}/${persistent}/joomla/images"
|
# chmod 707 "${VDM_PROJECT_PATH}/${persistent}/joomla/images"
|
||||||
# chmod 707 "${VDM_PROJECT_PATH}/${persistent}/joomla/images/stories"
|
# chmod 707 "${VDM_PROJECT_PATH}/${persistent}/joomla/images/stories"
|
||||||
#
|
#
|
||||||
|
# get current user ID
|
||||||
|
user_id="$(id -u)"
|
||||||
|
# check if the current user mismatch
|
||||||
|
if [ "$user_id" != "$VDM_PUID" ]; then
|
||||||
# Check if the setfacl command is installed
|
# Check if the setfacl command is installed
|
||||||
# shellcheck disable=SC2015
|
# shellcheck disable=SC2015
|
||||||
if command -v setfacl >/dev/null 2>&1; then
|
if command -v setfacl >/dev/null 2>&1; then
|
||||||
### Fix the folder permissions so the active user (1000) can access the files
|
### Fix the folder permissions so the active user (1000) can access the files
|
||||||
echo "Fixing the folder permissions of ${persistent} Joomla so user:$USER can access them"
|
sudo setfacl -R -m u:"$USER":rwx "${VDM_PROJECT_PATH}/${persistent}/joomla" &
|
||||||
sudo setfacl -R -m u:"$USER":rwx "${VDM_PROJECT_PATH}/${persistent}/joomla"
|
showProgress "setfacl" "Setting the permissions of ${persistent} Joomla so user:$USER can access and edit them both the files and folders."
|
||||||
else
|
else
|
||||||
echo "[ERROR] Could not fix the permissions of the ${persistent} Joomla so user:$USER can access them."
|
showError "[ERROR] Could not fix the permissions of the ${persistent} Joomla so user:$USER can access them.\n\n\
|
||||||
echo "[ERROR] You will need to install: setfacl for this option to work, then run this fix again."
|
You will need to install: setfacl for this option to work, then run this fix again."
|
||||||
|
fi
|
||||||
|
elif command -v setfacl >/dev/null 2>&1; then
|
||||||
|
# we remove the acl map if it was set before
|
||||||
|
sudo setfacl -R -b "${VDM_PROJECT_PATH}/${persistent}/joomla"
|
||||||
fi
|
fi
|
||||||
### Fix the folder ownership of database folders
|
### Fix the folder ownership of database folders
|
||||||
# id -u systemd-coredump
|
# id -u systemd-coredump
|
||||||
# getent group systemd-coredump | awk -F: '{printf "Group %s with GID=%d\n", $1, $3}'
|
# id -g systemd-coredump
|
||||||
echo "Fixing the folder ownership of ${persistent} database folders to belong to 999:systemd-coredump"
|
|
||||||
#
|
#
|
||||||
sudo chown -R 999:999 "${VDM_PROJECT_PATH}/${persistent}/db"
|
sudo chown -R 999:999 "${VDM_PROJECT_PATH}/${persistent}/db" &
|
||||||
|
showProgress "chown" "Setting the ownership of ${persistent} database directory/files.\n(c h o w n -R 999:999 ${persistent}/db)"
|
||||||
### Fix the folder permissions for the database files
|
### Fix the folder permissions for the database files
|
||||||
#
|
#
|
||||||
echo "Fixing the file and folder permissions for the ${persistent} database files"
|
|
||||||
#
|
|
||||||
# Change the file permissions
|
# Change the file permissions
|
||||||
sudo find "${VDM_PROJECT_PATH}/${persistent}/db" -type f -exec chmod 660 {} \;
|
sudo find "${VDM_PROJECT_PATH}/${persistent}/db" -type f -exec chmod 660 {} \; &
|
||||||
sudo find "${VDM_PROJECT_PATH}/${persistent}/db" -type d -exec chmod 700 {} \;
|
showProgress "find" "Setting the file permissions for the ${persistent} database.\n(f i n d ${persistent}/db -type f -exec chmod 660 {} \;)"
|
||||||
|
sudo find "${VDM_PROJECT_PATH}/${persistent}/db" -type d -exec chmod 700 {} \; &
|
||||||
|
showProgress "find" "Setting the directory permissions for the ${persistent} database.\n(f i n d ${persistent}/db -type d -exec chmod 700 {} \;)"
|
||||||
# show the completion of this permission fix
|
# show the completion of this permission fix
|
||||||
showNotice "Permissions fix completed on (${persistent})."
|
showNotice "Permissions update completed!"
|
||||||
else
|
else
|
||||||
showError "${VDM_PROJECT_PATH}/${persistent} is not a joomla persistent volume and was skipped."
|
showError "${VDM_PROJECT_PATH}/${persistent} is not a joomla persistent volume and was skipped."
|
||||||
fi
|
fi
|
||||||
@ -1524,7 +1619,7 @@ function runUpdate() {
|
|||||||
# some local values
|
# some local values
|
||||||
local branch
|
local branch
|
||||||
# get the target branch to use in our update
|
# get the target branch to use in our update
|
||||||
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://git.vdm.dev/api/v1/repos/octoleo/octojoom/raw/src/octojoom?ref=${branch:-master}" -o /usr/local/bin/octojoom 2>/dev/null; then
|
||||||
# give success message
|
# give success message
|
||||||
@ -1549,7 +1644,7 @@ function runUpdate() {
|
|||||||
sudo chmod +x /usr/local/bin/octojoom
|
sudo chmod +x /usr/local/bin/octojoom
|
||||||
fi
|
fi
|
||||||
# always exit so the new script can load
|
# always exit so the new script can load
|
||||||
exit 0
|
quitProgram
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1612,7 +1707,7 @@ function runUninstall() {
|
|||||||
VOLUMES: ${VDM_PROJECT_PATH} \n\
|
VOLUMES: ${VDM_PROJECT_PATH} \n\
|
||||||
CONFIG: ${VDM_SRC_PATH}" 20 112
|
CONFIG: ${VDM_SRC_PATH}" 20 112
|
||||||
# we exit here... where done!
|
# we exit here... where done!
|
||||||
exit 0
|
quitProgram
|
||||||
else
|
else
|
||||||
# little notice
|
# little notice
|
||||||
showNotice "This option lets you choose what you keep, so read the questions carefully! IT CAN'T BE UNDONE!"
|
showNotice "This option lets you choose what you keep, so read the questions carefully! IT CAN'T BE UNDONE!"
|
||||||
@ -1698,7 +1793,7 @@ function runUninstall() {
|
|||||||
whiptail --title "${PROGRAM_NAME} v${_VERSION} is UNINSTALLED" --msgbox "\n\n\
|
whiptail --title "${PROGRAM_NAME} v${_VERSION} is UNINSTALLED" --msgbox "\n\n\
|
||||||
${PROGRAM_NAME} v${_V} has been uninstalled." 10 112
|
${PROGRAM_NAME} v${_V} has been uninstalled." 10 112
|
||||||
# exit the program right now
|
# exit the program right now
|
||||||
exit 0
|
quitProgram
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1747,7 +1842,7 @@ function showJoomla() {
|
|||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
local menu_options=()
|
local menu_options=()
|
||||||
# our counter
|
# our counter
|
||||||
local i=2
|
local i=3
|
||||||
# load the back menu
|
# load the back menu
|
||||||
menu_options+=("back" "<-- Return to the main menu.")
|
menu_options+=("back" "<-- Return to the main menu.")
|
||||||
# setup new container
|
# setup new container
|
||||||
@ -1765,7 +1860,7 @@ function showJoomla() {
|
|||||||
hasDirectories 'joomla/enabled' &&
|
hasDirectories 'joomla/enabled' &&
|
||||||
menu_options+=("up" "Pull up all enabled containers") && i=$((i + 1))
|
menu_options+=("up" "Pull up all enabled containers") && i=$((i + 1))
|
||||||
# edit available container
|
# edit available container
|
||||||
hasDirectories 'joomla/available' &&
|
isExpert && hasDirectories 'joomla/available' &&
|
||||||
menu_options+=("edit" "Edit available container") && i=$((i + 1))
|
menu_options+=("edit" "Edit available container") && i=$((i + 1))
|
||||||
# fix permissions
|
# fix permissions
|
||||||
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
||||||
@ -1774,6 +1869,8 @@ function showJoomla() {
|
|||||||
# 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))
|
||||||
|
# Quit Octoleo Program
|
||||||
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
whiptail --menu "Make your selection" 20 112 $i \
|
whiptail --menu "Make your selection" 20 112 $i \
|
||||||
@ -1782,6 +1879,7 @@ function showJoomla() {
|
|||||||
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# menu actions
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
"setup")
|
"setup")
|
||||||
setupContainer 'joomla'
|
setupContainer 'joomla'
|
||||||
@ -1802,11 +1900,19 @@ function showJoomla() {
|
|||||||
upContainers 'joomla'
|
upContainers 'joomla'
|
||||||
;;
|
;;
|
||||||
"fix")
|
"fix")
|
||||||
fixContainerPermissions
|
fixContainersPermissions
|
||||||
;;
|
;;
|
||||||
"delete")
|
"delete")
|
||||||
deleteContainer 'joomla'
|
deleteContainer 'joomla'
|
||||||
;;
|
;;
|
||||||
|
"quit") quitProgram ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# menu loop
|
||||||
|
case $CHOICE in
|
||||||
|
"setup" | "edit" | "enable" | "disable" | "down" | "up" | "fix" | "delete")
|
||||||
|
showJoomla
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1815,7 +1921,7 @@ function showOpenssh() {
|
|||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
local menu_options=()
|
local menu_options=()
|
||||||
# our counter
|
# our counter
|
||||||
local i=2
|
local i=3
|
||||||
# load the back menu
|
# load the back menu
|
||||||
menu_options+=("back" "<-- Return to the main menu.")
|
menu_options+=("back" "<-- Return to the main menu.")
|
||||||
# setup new container
|
# setup new container
|
||||||
@ -1833,11 +1939,13 @@ function showOpenssh() {
|
|||||||
hasDirectories 'openssh/enabled' &&
|
hasDirectories 'openssh/enabled' &&
|
||||||
menu_options+=("up" "Pull up all enabled containers") && i=$((i + 1))
|
menu_options+=("up" "Pull up all enabled containers") && i=$((i + 1))
|
||||||
# edit available container
|
# edit available container
|
||||||
hasDirectories 'openssh/available' &&
|
isExpert && hasDirectories 'openssh/available' &&
|
||||||
menu_options+=("edit" "Edit available container") && i=$((i + 1))
|
menu_options+=("edit" "Edit available container") && i=$((i + 1))
|
||||||
# delete a container
|
# delete a container
|
||||||
hasDirectories 'openssh/available' &&
|
hasDirectories 'openssh/available' &&
|
||||||
menu_options+=("delete" "Delete a container") && i=$((i + 1))
|
menu_options+=("delete" "Delete a container") && i=$((i + 1))
|
||||||
|
# Quit Octoleo Program
|
||||||
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
whiptail --menu "Make your selection" 20 112 $i \
|
whiptail --menu "Make your selection" 20 112 $i \
|
||||||
@ -1868,6 +1976,14 @@ function showOpenssh() {
|
|||||||
"delete")
|
"delete")
|
||||||
deleteContainer 'openssh'
|
deleteContainer 'openssh'
|
||||||
;;
|
;;
|
||||||
|
"quit") quitProgram ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# menu loop
|
||||||
|
case $CHOICE in
|
||||||
|
"setup" | "edit" | "enable" | "disable" | "down" | "up" | "delete")
|
||||||
|
showOpenssh
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1876,9 +1992,9 @@ function showTraefik() {
|
|||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
local menu_options=()
|
local menu_options=()
|
||||||
# our counter
|
# our counter
|
||||||
local i=2
|
local i=3
|
||||||
# load the back menu
|
# load the back menu
|
||||||
menu_options+=("back" "<-- Return to the main menu.")
|
menu_options+=("back" "<-- Return to the main menu.") && i=$((i + 1))
|
||||||
# setup new container
|
# setup new container
|
||||||
menu_options+=("setup" "Setup or rebuild Traefik")
|
menu_options+=("setup" "Setup or rebuild Traefik")
|
||||||
# enable existing container
|
# enable existing container
|
||||||
@ -1888,11 +2004,13 @@ function showTraefik() {
|
|||||||
[ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
|
[ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
|
||||||
menu_options+=("disable" "Disable Traefik") && i=$((i + 1))
|
menu_options+=("disable" "Disable Traefik") && i=$((i + 1))
|
||||||
# edit available container
|
# edit available container
|
||||||
[ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
|
isExpert && [ -f "${VDM_REPO_PATH}/traefik/docker-compose.yml" ] &&
|
||||||
menu_options+=("edit" "Edit Traefik") && i=$((i + 1))
|
menu_options+=("edit" "Edit Traefik") && i=$((i + 1))
|
||||||
# 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))
|
||||||
|
# Quit Octoleo Program
|
||||||
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
whiptail --menu "Make your selection" 20 112 $i \
|
whiptail --menu "Make your selection" 20 112 $i \
|
||||||
@ -1901,6 +2019,7 @@ function showTraefik() {
|
|||||||
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# menu actions
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
"setup")
|
"setup")
|
||||||
setupContainer 'traefik'
|
setupContainer 'traefik'
|
||||||
@ -1917,6 +2036,14 @@ function showTraefik() {
|
|||||||
"delete")
|
"delete")
|
||||||
deleteContainer 'traefik'
|
deleteContainer 'traefik'
|
||||||
;;
|
;;
|
||||||
|
"quit") quitProgram ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# menu loop
|
||||||
|
case $CHOICE in
|
||||||
|
"setup" | "edit" | "enable" | "disable" | "delete")
|
||||||
|
showTraefik
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1925,7 +2052,7 @@ function showPortainer() {
|
|||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
local menu_options=()
|
local menu_options=()
|
||||||
# our counter
|
# our counter
|
||||||
local i=2
|
local i=3
|
||||||
# load the back menu
|
# load the back menu
|
||||||
menu_options+=("back" "<-- Return to the main menu.")
|
menu_options+=("back" "<-- Return to the main menu.")
|
||||||
# setup new container
|
# setup new container
|
||||||
@ -1937,11 +2064,13 @@ function showPortainer() {
|
|||||||
[ -f "${VDM_REPO_PATH}/portainer/docker-compose.yml" ] &&
|
[ -f "${VDM_REPO_PATH}/portainer/docker-compose.yml" ] &&
|
||||||
menu_options+=("disable" "Disable Portainer") && i=$((i + 1))
|
menu_options+=("disable" "Disable Portainer") && i=$((i + 1))
|
||||||
# edit available container
|
# edit available container
|
||||||
[ -f "${VDM_REPO_PATH}/portainer/docker-compose.yml" ] &&
|
isExpert && [ -f "${VDM_REPO_PATH}/portainer/docker-compose.yml" ] &&
|
||||||
menu_options+=("edit" "Edit Portainer") && i=$((i + 1))
|
menu_options+=("edit" "Edit Portainer") && i=$((i + 1))
|
||||||
# delete traefik container
|
# delete traefik container
|
||||||
[ -f "${VDM_REPO_PATH}/portainer/docker-compose.yml" ] &&
|
[ -f "${VDM_REPO_PATH}/portainer/docker-compose.yml" ] &&
|
||||||
menu_options+=("delete" "Delete Portainer") && i=$((i + 1))
|
menu_options+=("delete" "Delete Portainer") && i=$((i + 1))
|
||||||
|
# Quit Octoleo Program
|
||||||
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
whiptail --menu "Make your selection" 20 112 $i \
|
whiptail --menu "Make your selection" 20 112 $i \
|
||||||
@ -1950,6 +2079,7 @@ function showPortainer() {
|
|||||||
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# menu actions
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
"setup")
|
"setup")
|
||||||
setupContainer 'portainer'
|
setupContainer 'portainer'
|
||||||
@ -1966,23 +2096,35 @@ function showPortainer() {
|
|||||||
"delete")
|
"delete")
|
||||||
deleteContainer 'portainer'
|
deleteContainer 'portainer'
|
||||||
;;
|
;;
|
||||||
|
"quit") quitProgram ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# menu loop
|
||||||
|
case $CHOICE in
|
||||||
|
"setup" | "edit" | "enable" | "disable" | "delete")
|
||||||
|
showPortainer
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# show systems help menu
|
# show systems help menu
|
||||||
function showHelpMenu() {
|
function showSettings() {
|
||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
local menu_options=()
|
local menu_options=()
|
||||||
# our counter
|
# our counter
|
||||||
local i=7
|
local i=8
|
||||||
# load the back menu
|
# load the back menu
|
||||||
menu_options+=("back" "<-- Return to the main menu.")
|
menu_options+=("back" "<-- Return to the main menu.")
|
||||||
|
# the mode switch
|
||||||
|
isExpert && menu_options+=("basic-mode" "Switch to basic mode")
|
||||||
|
! isExpert && menu_options+=("expert-mode" "Switch to expert mode")
|
||||||
|
i=$((i + 1))
|
||||||
# Show command help
|
# Show command help
|
||||||
menu_options+=("command-help" "Help with commands")
|
menu_options+=("command-help" "Help with commands")
|
||||||
# Show folder paths
|
# Show folder paths
|
||||||
menu_options+=("important-paths" "Important paths")
|
menu_options+=("important-paths" "Important paths")
|
||||||
# Edit the global config
|
# Edit the global config
|
||||||
[ -f "${VDM_SRC_PATH}/.env" ] &&
|
isExpert && [ -f "${VDM_SRC_PATH}/.env" ] &&
|
||||||
menu_options+=("edit-config" "Edit Config") && i=$((i + 1))
|
menu_options+=("edit-config" "Edit Config") && i=$((i + 1))
|
||||||
# Report an Issue
|
# Report an Issue
|
||||||
menu_options+=("report-issue" "Report an issue")
|
menu_options+=("report-issue" "Report an issue")
|
||||||
@ -1992,15 +2134,24 @@ function showHelpMenu() {
|
|||||||
menu_options+=("uninstall" "Uninstall ${PROGRAM_NAME,,}")
|
menu_options+=("uninstall" "Uninstall ${PROGRAM_NAME,,}")
|
||||||
# Octoleo details
|
# Octoleo details
|
||||||
menu_options+=("octojoom" "Octojoom")
|
menu_options+=("octojoom" "Octojoom")
|
||||||
|
# Quit Octoleo Program
|
||||||
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
whiptail --menu "Make your selection" 20 112 $i \
|
whiptail --menu "Make your selection" 20 112 $i \
|
||||||
--title "Help Menu | ${PROGRAM_NAME} v${_V}" --fb \
|
--title "Settings Menu | ${PROGRAM_NAME} v${_V}" --fb \
|
||||||
--backtitle " Octoleo" --nocancel --notags \
|
--backtitle " Octoleo" --nocancel --notags \
|
||||||
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# menu actions
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
|
"basic-mode")
|
||||||
|
setMode 'basic'
|
||||||
|
;;
|
||||||
|
"expert-mode")
|
||||||
|
setMode 'expert'
|
||||||
|
;;
|
||||||
"command-help")
|
"command-help")
|
||||||
showCommandsHelpMenu
|
showCommandsHelpMenu
|
||||||
;;
|
;;
|
||||||
@ -2022,6 +2173,14 @@ function showHelpMenu() {
|
|||||||
"octojoom")
|
"octojoom")
|
||||||
octojoomQuietly
|
octojoomQuietly
|
||||||
;;
|
;;
|
||||||
|
"quit") quitProgram ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# menu loop
|
||||||
|
case $CHOICE in
|
||||||
|
"basic-mode" | "expert-mode" | "command-help" | "important-paths" | "edit-config" | "report-issue" | "octojoom")
|
||||||
|
showSettings
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2030,7 +2189,7 @@ function domainsMenu() {
|
|||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
local menu_options=()
|
local menu_options=()
|
||||||
# our counter
|
# our counter
|
||||||
local i=2
|
local i=3
|
||||||
# load the back menu
|
# load the back menu
|
||||||
menu_options+=("back" "<-- Return to the main menu.")
|
menu_options+=("back" "<-- Return to the main menu.")
|
||||||
# add more domains
|
# add more domains
|
||||||
@ -2040,8 +2199,10 @@ function domainsMenu() {
|
|||||||
[ -f "${VDM_SRC_PATH}/.domains" ] &&
|
[ -f "${VDM_SRC_PATH}/.domains" ] &&
|
||||||
menu_options+=("delete" "Delete Domain") && i=$((i + 1))
|
menu_options+=("delete" "Delete Domain") && i=$((i + 1))
|
||||||
# edit available container
|
# edit available container
|
||||||
allowEditHostFile &&
|
isExpert && allowEditHostFile &&
|
||||||
menu_options+=("edit" "Edit Host File") && i=$((i + 1))
|
menu_options+=("edit" "Edit Host File") && i=$((i + 1))
|
||||||
|
# Quit Octoleo Program
|
||||||
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
whiptail --menu "Make your selection" 20 112 $i \
|
whiptail --menu "Make your selection" 20 112 $i \
|
||||||
@ -2050,6 +2211,7 @@ function domainsMenu() {
|
|||||||
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
"${menu_options[@]}" 3>&2 2>&1 1>&3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# menu actions
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
"add")
|
"add")
|
||||||
setMultiDomains
|
setMultiDomains
|
||||||
@ -2060,6 +2222,14 @@ function domainsMenu() {
|
|||||||
"edit")
|
"edit")
|
||||||
editHostFile
|
editHostFile
|
||||||
;;
|
;;
|
||||||
|
"quit") quitProgram ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# menu loop
|
||||||
|
case $CHOICE in
|
||||||
|
"add" | "delete" | "edit")
|
||||||
|
domainsMenu
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2085,10 +2255,10 @@ function mainMenu() {
|
|||||||
# Delete Persistent Volumes
|
# Delete Persistent Volumes
|
||||||
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
hasDirectories '' "${VDM_PROJECT_PATH}" &&
|
||||||
menu_options+=("delete" "Delete Persistent Volumes") && i=$((i + 1))
|
menu_options+=("delete" "Delete Persistent Volumes") && i=$((i + 1))
|
||||||
# Show help
|
# Octoleo settings
|
||||||
menu_options+=("help" "Main Help Menu")
|
menu_options+=("settings" "${PROGRAM_NAME} Settings")
|
||||||
# Octoleo details
|
# Quit Octoleo Program
|
||||||
menu_options+=("quit" "Quit Program")
|
menu_options+=("quit" "Quit ${PROGRAM_NAME}")
|
||||||
# get the selection
|
# get the selection
|
||||||
while true; do
|
while true; do
|
||||||
CHOICE=$(
|
CHOICE=$(
|
||||||
@ -2117,10 +2287,10 @@ function mainMenu() {
|
|||||||
"delete")
|
"delete")
|
||||||
deletePersistentVolumes
|
deletePersistentVolumes
|
||||||
;;
|
;;
|
||||||
"help")
|
"settings")
|
||||||
showHelpMenu
|
showSettings
|
||||||
;;
|
;;
|
||||||
"quit") exit ;;
|
"quit") quitProgram ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -2148,6 +2318,51 @@ function showLink() {
|
|||||||
whiptail --title "${3:-Open Link} | ${PROGRAM_NAME} v${_V}" --msgbox "${2:-To open the link click here:} ${1}" 8 112
|
whiptail --title "${3:-Open Link} | ${PROGRAM_NAME} v${_V}" --msgbox "${2:-To open the link click here:} ${1}" 8 112
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# show progress bar
|
||||||
|
function showProgress() {
|
||||||
|
# some locals
|
||||||
|
local searching_for
|
||||||
|
local title
|
||||||
|
local message
|
||||||
|
local per
|
||||||
|
local program
|
||||||
|
# get input
|
||||||
|
searching_for="$1"
|
||||||
|
message="$2"
|
||||||
|
title="${3:-Please wait!}"
|
||||||
|
# our little loop progress
|
||||||
|
{
|
||||||
|
per=1
|
||||||
|
while (true); do
|
||||||
|
# shellcheck disable=SC2009
|
||||||
|
program=$(ps aux | grep -v grep | grep -e "${searching_for}")
|
||||||
|
if [[ "$program" == "" ]] && [[ "$per" -eq "0" ]]; then
|
||||||
|
# searching_for did not start
|
||||||
|
break
|
||||||
|
elif [[ "$program" == "" ]] && [[ "$per" -gt "0" ]]; then
|
||||||
|
# we are finished, so we slow down to 100%
|
||||||
|
sleep .5
|
||||||
|
echo 88
|
||||||
|
sleep .5
|
||||||
|
echo 90
|
||||||
|
sleep 1
|
||||||
|
echo 98
|
||||||
|
sleep .5
|
||||||
|
echo 100
|
||||||
|
sleep 1
|
||||||
|
break
|
||||||
|
elif [[ "87" -eq "$per" ]]; then
|
||||||
|
# if it takes longer we loop
|
||||||
|
per="33"
|
||||||
|
fi
|
||||||
|
# sleep a little moment
|
||||||
|
sleep .5
|
||||||
|
echo $per
|
||||||
|
per=$((per + 1))
|
||||||
|
done
|
||||||
|
} | whiptail --title "${title}" --gauge "${message}" 8 112 0
|
||||||
|
}
|
||||||
|
|
||||||
# show important paths
|
# show important paths
|
||||||
function showImportantPaths() {
|
function showImportantPaths() {
|
||||||
local message
|
local message
|
||||||
@ -2157,13 +2372,16 @@ function showImportantPaths() {
|
|||||||
We have a few important paths that you should know, and use to manually manage your setup.
|
We have a few important paths that you should know, and use to manually manage your setup.
|
||||||
|
|
||||||
DOCKER: ${VDM_REPO_PATH}
|
DOCKER: ${VDM_REPO_PATH}
|
||||||
|
SOURCE: ${VDM_SRC_PATH}/.images-source
|
||||||
|
DOMAINS: ${VDM_SRC_PATH}/.domains
|
||||||
|
CONFIG: ${VDM_SRC_PATH}/.env
|
||||||
SSH: ${VDM_REPO_PATH}/openssh/.ssh
|
SSH: ${VDM_REPO_PATH}/openssh/.ssh
|
||||||
VOLUMES: ${VDM_PROJECT_PATH}
|
VOLUMES: ${VDM_PROJECT_PATH}
|
||||||
CONFIG: ${VDM_SRC_PATH}
|
|
||||||
|
|
||||||
Then we have some key environment variable files that hold very useful and important information.
|
Then we have some key environment variable files that hold very useful and important information.
|
||||||
Since we do not store any passwords or other important details in the octojoom.yml files
|
Since we do not store any passwords or other important details in the docker-compose.yml files
|
||||||
they are stored in these environment variable files and its permissions are (600) for security.
|
they are stored in >>these environment variable files<< and therefore we set these .env file
|
||||||
|
permission to (600) for security.
|
||||||
|
|
||||||
JOOMLA: ${VDM_REPO_PATH}/joomla/.env
|
JOOMLA: ${VDM_REPO_PATH}/joomla/.env
|
||||||
OPENSSH: ${VDM_REPO_PATH}/openssh/.env
|
OPENSSH: ${VDM_REPO_PATH}/openssh/.env
|
||||||
@ -2332,6 +2550,48 @@ function getTargetBranch() {
|
|||||||
echo "${answer:-master}"
|
echo "${answer:-master}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get the target repository to use in update
|
||||||
|
function getImageSource() {
|
||||||
|
# we set some local stuff
|
||||||
|
local image
|
||||||
|
local image_source
|
||||||
|
local images_source
|
||||||
|
# menu for dynamic addition
|
||||||
|
local menu_options=()
|
||||||
|
# our counter
|
||||||
|
local i=2
|
||||||
|
# set the base images source
|
||||||
|
menu_options+=("joomla" "Joomla official image" "OFF")
|
||||||
|
menu_options+=("llewellyn/joomla" "Octoleo Joomla image" "OFF")
|
||||||
|
# get existing source
|
||||||
|
if [ -f "${VDM_SRC_PATH}/.images-source" ] && readarray -t images_source <"${VDM_SRC_PATH}/.images-source"; then
|
||||||
|
# build the menus
|
||||||
|
if [ "${#images_source[@]}" -gt 0 ]; then
|
||||||
|
# loop source images
|
||||||
|
for image in "${images_source[@]}"; do
|
||||||
|
# the image name (get before first comma)
|
||||||
|
image_name="${image%%,*}"
|
||||||
|
# the image description (get after last comma)
|
||||||
|
image_desc="${image##*,}"
|
||||||
|
# make sure we have a value, and it is not the defaults already set
|
||||||
|
if [ "${#image_name}" -ge 1 ] && [ "${#image_desc}" -ge 1 ] &&
|
||||||
|
[ "${image_name}" != 'joomla' ] && [ "${image_name}" != 'llewellyn/joomla' ]; then
|
||||||
|
# load the source name and description
|
||||||
|
menu_options+=("${image_name}" "${image_desc}" "OFF")
|
||||||
|
# increment our counter
|
||||||
|
i=$((i + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# now make the selection
|
||||||
|
image_source=$(whiptail --title "Select image source repository" --radiolist --nocancel --notags \
|
||||||
|
"You can select the source of your Joomla! image." 10 80 $i \
|
||||||
|
"${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
# return the answer (default joomla)
|
||||||
|
echo "${image_source:-joomla}"
|
||||||
|
}
|
||||||
|
|
||||||
# get a list of domains locally set
|
# get a list of domains locally set
|
||||||
function getListDomains() {
|
function getListDomains() {
|
||||||
# get the separator
|
# get the separator
|
||||||
@ -2440,6 +2700,61 @@ function getMainDomain() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# set the container user
|
||||||
|
function setContainerUser() {
|
||||||
|
# ask if a new User ID should be set if one is set
|
||||||
|
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?" --defaultno --title "Set User ID" 8 112); then
|
||||||
|
# always first reset
|
||||||
|
unset VDM_PUID
|
||||||
|
fi
|
||||||
|
# give little notice
|
||||||
|
# showNotice "To get the ID of a user in a container:\n\n$ docker exec -it container_name /bin/bash\n$ id -u www-data"
|
||||||
|
# we first get the container user ID
|
||||||
|
while [ -z "${VDM_PUID}" ] || [ ${#VDM_PUID} -le 1 ] || ! [[ "${VDM_PUID}" =~ ^[0-9]+$ ]]; do
|
||||||
|
VDM_PUID=$(getInput "Enter user ID for the ${VDM_CONTAINER_TYPE^} container. Use default:${1:-1000} if you don't know.\n[add only a number]" \
|
||||||
|
"${1:-1000}" 'Enter User ID')
|
||||||
|
# check if we have success
|
||||||
|
if [ ${#VDM_PUID} -le 1 ] || ! [[ "${VDM_PUID}" =~ ^[0-9]+$ ]]; then
|
||||||
|
showError "You must enter a user ID like: ${1:-1000} (only the number)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# ask if a new Group ID should be set if one is set
|
||||||
|
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?" --defaultno --title "Set User-Group ID" 8 112); then
|
||||||
|
# always first reset
|
||||||
|
unset VDM_PGID
|
||||||
|
fi
|
||||||
|
# give little notice
|
||||||
|
# showNotice "To get the ID of a user-group in a container:\n\n$ docker exec -it container_name /bin/bash\n$ id -u www-data"
|
||||||
|
# we get the container user-group ID
|
||||||
|
while [ -z "${VDM_PGID}" ] || [ ${#VDM_PGID} -le 1 ] || ! [[ "${VDM_PGID}" =~ ^[0-9]+$ ]]; do
|
||||||
|
VDM_PGID=$(getInput "Enter user-group ID for the ${VDM_CONTAINER_TYPE^} container. Use default:${1:-1000} if you don't know.\n[add only a number]" \
|
||||||
|
"${1:-1000}" 'Enter User Group ID')
|
||||||
|
# check if we have success
|
||||||
|
if [ ${#VDM_PGID} -le 1 ] || ! [[ "${VDM_PGID}" =~ ^[0-9]+$ ]]; then
|
||||||
|
showError "You must enter a user-group ID like: ${1:-1000} (only the number)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# make available
|
||||||
|
export VDM_PUID
|
||||||
|
export VDM_PGID
|
||||||
|
}
|
||||||
|
|
||||||
|
# set the program mode
|
||||||
|
function setMode() {
|
||||||
|
# some default
|
||||||
|
VDM_EXPERT_MODE=false
|
||||||
|
# set the switch
|
||||||
|
[ "${1:-basic}" = 'basic' ] || VDM_EXPERT_MODE=true
|
||||||
|
# always remove previous state
|
||||||
|
deleteEnvVariable "VDM_EXPERT_MODE"
|
||||||
|
# set persistent
|
||||||
|
setEnvVariable "VDM_EXPERT_MODE=${VDM_EXPERT_MODE}"
|
||||||
|
# make global
|
||||||
|
export VDM_EXPERT_MODE
|
||||||
|
}
|
||||||
|
|
||||||
# set the domain
|
# set the domain
|
||||||
function setDomain() {
|
function setDomain() {
|
||||||
# allow multi domain setup
|
# allow multi domain setup
|
||||||
@ -2593,6 +2908,17 @@ function setUpdateHostFile() {
|
|||||||
export VDM_UPDATE_HOST
|
export VDM_UPDATE_HOST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# set persistence volumes
|
||||||
|
function setPersistence() {
|
||||||
|
# ask the question
|
||||||
|
if (whiptail --yesno "Would you like to enable persistence on this container." --defaultno --title "Persist Volumes" 8 112); then
|
||||||
|
# yes persistence
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# no persistence
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# set the secure state
|
# set the secure state
|
||||||
function setSecureState() {
|
function setSecureState() {
|
||||||
if [ "${VDM_SECURE:-not}" = 'not' ]; then
|
if [ "${VDM_SECURE:-not}" = 'not' ]; then
|
||||||
@ -2672,6 +2998,41 @@ function downApache() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# lock a folder path
|
||||||
|
function lockFolder() {
|
||||||
|
cat <<EOF
|
||||||
|
# Apache 2.4+
|
||||||
|
<IfModule mod_authz_core.c>
|
||||||
|
Require all denied
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# Apache 2.0-2.2
|
||||||
|
<IfModule !mod_authz_core.c>
|
||||||
|
Deny from all
|
||||||
|
</IfModule>
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# clear the main environment variables
|
||||||
|
function quitProgram() {
|
||||||
|
####### CLEAR ALL
|
||||||
|
unset VDM_PUID
|
||||||
|
unset VDM_PGID
|
||||||
|
unset VDM_CONTAINER_TYPE
|
||||||
|
unset VDM_TASK
|
||||||
|
unset VDM_SRC_PATH
|
||||||
|
unset VDM_REPO_PATH
|
||||||
|
unset VDM_PROJECT_PATH
|
||||||
|
unset VDM_DOMAIN
|
||||||
|
unset VDM_MULTI_DOMAIN
|
||||||
|
unset VDM_SECURE
|
||||||
|
unset VDM_UPDATE_HOST
|
||||||
|
unset VDM_CONTAINER
|
||||||
|
unset VDM_ACCESS_TOKEN
|
||||||
|
# exit at this point
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
# do we allow multiple domains
|
# do we allow multiple domains
|
||||||
function allowMultiDomains() {
|
function allowMultiDomains() {
|
||||||
# Allow multiple domains
|
# Allow multiple domains
|
||||||
@ -2704,8 +3065,8 @@ function saveMultiDomain() {
|
|||||||
local domain_name
|
local domain_name
|
||||||
local src_path_domain
|
local src_path_domain
|
||||||
# set the domain and remove any whitespace
|
# set the domain and remove any whitespace
|
||||||
domain_name="$(echo -e "${1}" | tr -d '[:space:]')";
|
domain_name="$(echo -e "${1}" | tr -d '[:space:]')"
|
||||||
src_path_domain="${VDM_SRC_PATH}/.domains";
|
src_path_domain="${VDM_SRC_PATH}/.domains"
|
||||||
# check that we have a domain string
|
# check that we have a domain string
|
||||||
if [ ${#domain_name} -ge 1 ]; then
|
if [ ${#domain_name} -ge 1 ]; then
|
||||||
# check if the file exist
|
# check if the file exist
|
||||||
@ -2727,6 +3088,21 @@ function saveMultiDomain() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# delete a global Environment Variable
|
||||||
|
function deleteEnvVariable() {
|
||||||
|
# some locals
|
||||||
|
local env_key
|
||||||
|
# check if the env file exist
|
||||||
|
if [ -f "${VDM_SRC_PATH}/.env" ]; then
|
||||||
|
# check that we have the key
|
||||||
|
env_key="${1:-none}"
|
||||||
|
# shellcheck disable=SC2015
|
||||||
|
grep -vx "${env_key}=.*" "${VDM_SRC_PATH}/.env" >"${VDM_SRC_PATH}/.env_tmp" &&
|
||||||
|
mv "${VDM_SRC_PATH}/.env_tmp" "${VDM_SRC_PATH}/.env" ||
|
||||||
|
rm "${VDM_SRC_PATH}/.env_tmp"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# delete multiple domains
|
# delete multiple domains
|
||||||
function deleteMultiDomains() {
|
function deleteMultiDomains() {
|
||||||
# menu for dynamic addition
|
# menu for dynamic addition
|
||||||
@ -2767,6 +3143,17 @@ function deleteMultiDomains() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check if expert mode is on
|
||||||
|
function isExpert() {
|
||||||
|
# check if its set
|
||||||
|
if [ -n "${VDM_EXPERT_MODE}" ] && $VDM_EXPERT_MODE; then
|
||||||
|
# is expert
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
# not expert
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
# check if some thing is a function
|
# check if some thing is a function
|
||||||
function isFunc() {
|
function isFunc() {
|
||||||
declare -F "$1" >/dev/null
|
declare -F "$1" >/dev/null
|
||||||
@ -2950,7 +3337,7 @@ while :; do
|
|||||||
case $1 in
|
case $1 in
|
||||||
-h | --help)
|
-h | --help)
|
||||||
showHelp # Display a usage synopsis.
|
showHelp # Display a usage synopsis.
|
||||||
exit
|
quitProgram
|
||||||
;;
|
;;
|
||||||
--update)
|
--update)
|
||||||
runUpdate
|
runUpdate
|
||||||
@ -2966,6 +3353,7 @@ while :; do
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--access-token=?*)
|
--access-token=?*)
|
||||||
|
# shellcheck disable=SC2034
|
||||||
VDM_ACCESS_TOKEN=${1#*=} # Delete everything up to "=" and assign the remainder.
|
VDM_ACCESS_TOKEN=${1#*=} # Delete everything up to "=" and assign the remainder.
|
||||||
;;
|
;;
|
||||||
--access-token=) # Handle the case of an empty --type=
|
--access-token=) # Handle the case of an empty --type=
|
||||||
@ -3257,7 +3645,9 @@ VDM_SRC_PATH="/home/${USER}/.config/octojoom"
|
|||||||
# create the folder if not set
|
# create the folder if not set
|
||||||
# shellcheck disable=SC2174
|
# shellcheck disable=SC2174
|
||||||
mkdir -p -m '700' "${VDM_SRC_PATH}"
|
mkdir -p -m '700' "${VDM_SRC_PATH}"
|
||||||
# load this globals
|
# first run switch
|
||||||
|
VDM_FIRST_RUN=false
|
||||||
|
# load the globals
|
||||||
# shellcheck disable=SC1090
|
# shellcheck disable=SC1090
|
||||||
[ -f "${VDM_SRC_PATH}/.env" ] && source "${VDM_SRC_PATH}/.env"
|
[ -f "${VDM_SRC_PATH}/.env" ] && source "${VDM_SRC_PATH}/.env"
|
||||||
# get repo path where store the container deploy scripts
|
# get repo path where store the container deploy scripts
|
||||||
@ -3276,6 +3666,8 @@ while [ ${#VDM_REPO_PATH} -le 1 ] || [ ! -d "${VDM_REPO_PATH}" ]; do
|
|||||||
showError "You must set a repository path where we can store the containers' docker-composer.yml deployment files."
|
showError "You must set a repository path where we can store the containers' docker-composer.yml deployment files."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# trip switch of first run
|
||||||
|
VDM_FIRST_RUN=true
|
||||||
done
|
done
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
setEnvVariable "VDM_REPO_PATH=\"${VDM_REPO_PATH}\""
|
setEnvVariable "VDM_REPO_PATH=\"${VDM_REPO_PATH}\""
|
||||||
@ -3295,26 +3687,27 @@ while [ ${#VDM_PROJECT_PATH} -le 1 ] || [ ! -d "${VDM_PROJECT_PATH}" ]; do
|
|||||||
showError "You must set a projects' path where we can store the containers' persistent volumes."
|
showError "You must set a projects' path where we can store the containers' persistent volumes."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
# trip switch of first run
|
||||||
|
VDM_FIRST_RUN=true
|
||||||
done
|
done
|
||||||
# add this value if not set variable
|
# add this value if not set variable
|
||||||
setEnvVariable "VDM_PROJECT_PATH=\"${VDM_PROJECT_PATH}\""
|
setEnvVariable "VDM_PROJECT_PATH=\"${VDM_PROJECT_PATH}\""
|
||||||
# set these globally
|
# set these globally
|
||||||
export VDM_REPO_PATH
|
export VDM_REPO_PATH
|
||||||
export VDM_PROJECT_PATH
|
export VDM_PROJECT_PATH
|
||||||
|
# if this is the first run we should setup traefik
|
||||||
|
$VDM_FIRST_RUN && {
|
||||||
|
# set traefik as the container type
|
||||||
|
: "${VDM_CONTAINER_TYPE:=traefik}"
|
||||||
|
# and enable it
|
||||||
|
: "${VDM_TASK:=setup}"
|
||||||
|
# trigger main
|
||||||
|
main
|
||||||
|
# clear it again
|
||||||
|
VDM_CONTAINER_TYPE=''
|
||||||
|
VDM_TASK=''
|
||||||
|
}
|
||||||
|
|
||||||
#####################################################################################################################VDM
|
#####################################################################################################################VDM
|
||||||
######################################## MAIN ┬┴┬┴┤(・_├┬┴┬┴
|
######################################## MAIN ┬┴┬┴┤(・_├┬┴┬┴
|
||||||
main
|
main
|
||||||
|
|
||||||
####### CLEAR ALL
|
|
||||||
unset VDM_CONTAINER_TYPE
|
|
||||||
unset VDM_TASK
|
|
||||||
unset VDM_SRC_PATH
|
|
||||||
unset VDM_REPO_PATH
|
|
||||||
unset VDM_PROJECT_PATH
|
|
||||||
unset VDM_DOMAIN
|
|
||||||
unset VDM_MULTI_DOMAIN
|
|
||||||
unset VDM_SECURE
|
|
||||||
unset VDM_UPDATE_HOST
|
|
||||||
unset VDM_CONTAINER
|
|
||||||
unset VDM_ACCESS_TOKEN
|
|
||||||
|
Reference in New Issue
Block a user