3 Commits

2 changed files with 266 additions and 224 deletions

View File

@ -1,4 +1,4 @@
# Easy Docker Deployment (UBUNTU ONLY) # Octojoom - Easy Docker Deployment
With this script we can easily deploy docker containers of Joomla and Openssh. This combination of these tools give rise to a powerful and very secure shared development environment. With this script we can easily deploy docker containers of Joomla and Openssh. This combination of these tools give rise to a powerful and very secure shared development environment.
This program has **command input** options as seen in the menus below, but these command are _not the only way_ to set these values. This program has **command input** options as seen in the menus below, but these command are _not the only way_ to set these values.
@ -11,37 +11,29 @@ That same time the output message to the terminal will show you where the specif
--- ---
# Install # Install
```shell ```shell
$ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/docker-deploy/raw/src/docker-deploy?access_token=xxxx" -o /usr/local/bin/docker-deploy $ sudo curl -L "https://git.vdm.dev/api/v1/repos/octoleo/octojoom/raw/src/octojoom" -o /usr/local/bin/octojoom
$ sudo chmod +x /usr/local/bin/docker-deploy $ sudo chmod +x /usr/local/bin/octojoom
``` ```
### How to get the Access Token
Sign in to [https://git.vdm.dev/](https://git.vdm.dev/user/login) with your **GitHub** or **Gitlab** account.
Then open your [applications settings](https://git.vdm.dev/user/settings/applications) and create a new access token.
![image](https://user-images.githubusercontent.com/5607939/143513412-946843be-acd8-4973-be44-00902226f6ba.png)
The first time you use the program, it will ask for the access token again, so it can do updates in the future.
--- ---
# Usage # Usage
> To see the usage help menu > To see the usage help menu
```shell ```shell
$ docker-deploy -h $ octojoom -h
``` ```
### Help Menu (docker-deploy) ### Help Menu (octojoom)
```txt ```txt
Usage: docker-deploy [OPTION...] Usage: octojoom [OPTION...]
Options Options
====================================================== ======================================================
--type <type> --type <type>
set type you would like to work with set type you would like to work with
example: docker-deploy --type joomla example: octojoom --type joomla
====================================================== ======================================================
--task <task> --task <task>
set type of task you would like to perform set type of task you would like to perform
example: docker-deploy --task setup example: octojoom --task setup
====================================================== ======================================================
--container <container.domain.name> --container <container.domain.name>
Directly enabling or disabling a container with Directly enabling or disabling a container with
@ -49,74 +41,74 @@ Usage: docker-deploy [OPTION...]
The container must exist, which means it was The container must exist, which means it was
setup previously setup previously
Used without type and task Joomla-Enable is (default) Used without type and task Joomla-Enable is (default)
example: docker-deploy --container "io.vdm.dev" example: octojoom --container "io.vdm.dev"
====================================================== ======================================================
--update --update
to update your install to update your install
example: docker-deploy --update example: octojoom --update
====================================================== ======================================================
--access-token <token> --access-token <token>
to update the program you will need an access token to update the program you will need an access token
from https://git.vdm.dev/user/settings/applications from https://git.vdm.dev/user/settings/applications
example: docker-deploy --access-token xxxxxxxxxxx example: octojoom --access-token xxxxxxxxxxx
====================================================== ======================================================
--uninstall --uninstall
to uninstall this script to uninstall this script
example: docker-deploy --uninstall example: octojoom --uninstall
====================================================== ======================================================
AVAILABLE FOR TO ANY CONTAINER AVAILABLE FOR TO ANY CONTAINER
====================================================== ======================================================
-k|--key <key> -k|--key <key>
set key for the docker compose container naming set key for the docker compose container naming
!! no spaces allowed in the key !! !! no spaces allowed in the key !!
example: docker-deploy -k="vdm" example: octojoom -k="vdm"
example: docker-deploy --key="vdm" example: octojoom --key="vdm"
====================================================== ======================================================
-e|--env-key <key> -e|--env-key <key>
set key for the environment variable naming set key for the environment variable naming
!! no spaces allowed in the key & must be UPPERCASE !! !! no spaces allowed in the key & must be UPPERCASE !!
example: docker-deploy -e="VDM" example: octojoom -e="VDM"
example: docker-deploy --env-key="VDM" example: octojoom --env-key="VDM"
====================================================== ======================================================
-d|--domain <domain.com> -d|--domain <domain.com>
set key website domain set key website domain
!! must be domain.tld !! !! must be domain.tld !!
example: docker-deploy -d="joomla.org" example: octojoom -d="joomla.org"
example: docker-deploy --domain="joomla.org" example: octojoom --domain="joomla.org"
====================================================== ======================================================
-s|--sub-domain <domain.com> -s|--sub-domain <domain.com>
set key website sub domain set key website sub domain
!! no spaces allowed in the sub domain !! !! no spaces allowed in the sub domain !!
example: docker-deploy -s="jcb" example: octojoom -s="jcb"
example: docker-deploy --sub-domain="jcb" example: octojoom --sub-domain="jcb"
====================================================== ======================================================
AVAILABLE FOR JOOMLA CONTAINER AVAILABLE FOR JOOMLA CONTAINER
====================================================== ======================================================
-j|--joomla-version <version-tag> -j|--joomla-version <version-tag>
see available tags here https://hub.docker.com/_/joomla see available tags here https://hub.docker.com/_/joomla
example: docker-deploy -j=3.10 example: octojoom -j=3.10
example: docker-deploy --joomla-version=3.10 example: octojoom --joomla-version=3.10
====================================================== ======================================================
AVAILABLE FOR OPENSSH CONTAINER AVAILABLE FOR OPENSSH CONTAINER
====================================================== ======================================================
-u|--username <username> -u|--username <username>
set username of the container set username of the container
example: docker-deploy -u="ubuntu" example: octojoom -u="ubuntu"
example: docker-deploy --username="ubuntu" example: octojoom --username="ubuntu"
====================================================== ======================================================
--uid <id> --uid <id>
set container user id set container user id
example: docker-deploy --uid=1000 example: octojoom --uid=1000
====================================================== ======================================================
--gid <id> --gid <id>
set container user group id set container user group id
example: docker-deploy --gid=1000 example: octojoom --gid=1000
====================================================== ======================================================
-p|--port <port> -p|--port <port>
set ssh port to use set ssh port to use
!! do not use 22 !! !! do not use 22 !!
example: docker-deploy -p=2239 example: octojoom -p=2239
example: docker-deploy --port=2239 example: octojoom --port=2239
====================================================== ======================================================
--ssh-dir <dir> --ssh-dir <dir>
set ssh directory name found in the .ssh dir set ssh directory name found in the .ssh dir
@ -124,34 +116,34 @@ Usage: docker-deploy [OPTION...]
This directory has separate files for This directory has separate files for
each public key allowed to access each public key allowed to access
the container the container
example: docker-deploy --ssh-dir="teamname" example: octojoom --ssh-dir="teamname"
====================================================== ======================================================
--sudo --sudo
switch to add the container user to the switch to add the container user to the
sudo group of the container sudo group of the container
example: docker-deploy --sudo example: octojoom --sudo
====================================================== ======================================================
-t|--time-zone <time/zone> -t|--time-zone <time/zone>
set time zone of the container set time zone of the container
!! must valid time zone !! !! must valid time zone !!
example: docker-deploy -t="Africa/Windhoek" example: octojoom -t="Africa/Windhoek"
example: docker-deploy --time-zone="Africa/Windhoek" example: octojoom --time-zone="Africa/Windhoek"
====================================================== ======================================================
HELP ʕ•ᴥ•ʔ HELP ʕ•ᴥ•ʔ
====================================================== ======================================================
-h|--help -h|--help
display this help menu display this help menu
example: docker-deploy -h example: octojoom -h
example: docker-deploy --help example: octojoom --help
====================================================== ======================================================
Docker Deployment v2.1.0 Octojoom
====================================================== ======================================================
``` ```
--- ---
# Uninstall # Uninstall
```shell ```shell
$ docker-deploy --uninstall $ octojoom --uninstall
``` ```
--- ---
# Free Software License # Free Software License

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# The most recent program version. # The most recent program version.
_VERSION="2.1.0" _VERSION="3.0.0"
_V="2.1" _V="3.0"
# The program full name # The program full name
PROGRAM_NAME="Docker Deployment" PROGRAM_NAME="Octojoom"
# make sure whiptail is installed # make sure whiptail is installed
command -v whiptail >/dev/null 2>&1 || { command -v whiptail >/dev/null 2>&1 || {
@ -176,8 +176,6 @@ function portainer__TRuST__setup() {
# container # container
export VDM_REMOVE_SECURE export VDM_REMOVE_SECURE
export VDM_ENTRY_POINT export VDM_ENTRY_POINT
# set the update of the host file once
setUpdateHostFile
# set host file if needed # set host file if needed
updateHostFile updateHostFile
## create the directory if it does not yet already exist ## create the directory if it does not yet already exist
@ -376,8 +374,6 @@ function joomla__TRuST__setup() {
export vdm_database_user export vdm_database_user
export vdm_database_pass export vdm_database_pass
export vdm_database_rootpass export vdm_database_rootpass
# set the update of the host file once
setUpdateHostFile
# set host file if needed # set host file if needed
updateHostFile updateHostFile
# also set the database domain # also set the database domain
@ -716,7 +712,7 @@ function joomla__TRuST__edit() {
local vdm_edit_me local vdm_edit_me
local container local container
# list containers... and allow selection to edit # list containers... and allow selection to edit
container=$(getSelectedDirectory "Select a container to manually edit if you like." \ container=$(getSelectedDirectory "Select a container to manually edit the docker-composer.yml file.\n[Only continue if you know what your doing!]" \
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/" '' "Edit ${VDM_CONTAINER_TYPE^} Container") "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/" '' "Edit ${VDM_CONTAINER_TYPE^} Container")
# check that we have something, else return to main menu # check that we have something, else return to main menu
if [ ${#container} -ge 1 ]; then if [ ${#container} -ge 1 ]; then
@ -724,6 +720,8 @@ function joomla__TRuST__edit() {
vdm_edit_me="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}/docker-compose.yml" vdm_edit_me="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}/docker-compose.yml"
# check if this docker-composer.yml exist # check if this docker-composer.yml exist
if [ -f "${vdm_edit_me}" ]; then if [ -f "${vdm_edit_me}" ]; then
# 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
# lets open the file with nano for now # lets open the file with nano for now
"${EDITOR:-nano}" "${vdm_edit_me}" "${EDITOR:-nano}" "${vdm_edit_me}"
# if this container is enabled ask if it should be redeployed # if this container is enabled ask if it should be redeployed
@ -750,7 +748,7 @@ function openssh__TRuST__edit() {
local vdm_edit_me local vdm_edit_me
local container local container
# list containers... and allow selection to edit # list containers... and allow selection to edit
container=$(getSelectedDirectory "Select a container to manually edit if you like." \ container=$(getSelectedDirectory "Select a container to manually edit the docker-composer.yml file.\n[Only continue if you know what your doing!]" \
"${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/" '' "Edit ${VDM_CONTAINER_TYPE^} Container") "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/" '' "Edit ${VDM_CONTAINER_TYPE^} Container")
# check that we have something, else return to main menu # check that we have something, else return to main menu
if [ ${#container} -ge 1 ]; then if [ ${#container} -ge 1 ]; then
@ -758,6 +756,8 @@ function openssh__TRuST__edit() {
vdm_edit_me="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}/docker-compose.yml" vdm_edit_me="${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${container}/docker-compose.yml"
# check if this docker-composer.yml exist # check if this docker-composer.yml exist
if [ -f "${vdm_edit_me}" ]; then if [ -f "${vdm_edit_me}" ]; then
# 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
# lets open the file with nano for now # lets open the file with nano for now
"${EDITOR:-nano}" "${vdm_edit_me}" "${EDITOR:-nano}" "${vdm_edit_me}"
# if this container is enabled ask if it should be redeployed # if this container is enabled ask if it should be redeployed
@ -780,12 +780,17 @@ function traefik__TRuST__edit() {
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 edit." showError "There is no ${VDM_CONTAINER_TYPE^} container to edit."
else else
# lets open the file with nano for now # give little warning for less command ready people
"${EDITOR:-nano}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" if (whiptail --yesno "Only continue if you know what your doing!\n\n\
# if this container is enabled ask if it should be redeployed ${USER^}, to save the changes you've made or to just close the file again press:\n\n\
if (whiptail --yesno "Would you like to deploy or re-deploy the ${VDM_CONTAINER_TYPE^} container that you opened to edit?" --title "Deploy or Re-Deploy Container" 8 112); then [ctrl+x] with nano on ubuntu." --title "Continue to edit ${VDM_CONTAINER_TYPE^} config." 15 112); then
# then we enable it # lets open the file with nano for now
enableContainer "${VDM_CONTAINER_TYPE}" "${EDITOR:-nano}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
# if this container is enabled ask if it should be redeployed
if (whiptail --yesno "Would you like to deploy or re-deploy the ${VDM_CONTAINER_TYPE^} container that you opened to edit?" --title "Deploy or Re-Deploy Container" 8 112); then
# then we enable it
enableContainer "${VDM_CONTAINER_TYPE}"
fi
fi fi
fi fi
} }
@ -797,12 +802,17 @@ function portainer__TRuST__edit() {
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 edit." showError "There is no ${VDM_CONTAINER_TYPE^} container to edit."
else else
# lets open the file with nano for now # give little warning for less command ready people
"${EDITOR:-nano}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml" if (whiptail --yesno "Only continue if you know what your doing!\n\n\
# if this container is enabled ask if it should be redeployed ${USER^}, to save the changes you've made or to just close the file again press:\n\n\
if (whiptail --yesno "Would you like to deploy or re-deploy the ${VDM_CONTAINER_TYPE^} container that you opened to edit?" --title "Deploy or Re-Deploy Container" 8 112); then [ctrl+x] with nano on ubuntu." --title "Continue to edit ${VDM_CONTAINER_TYPE^} config." 15 112); then
# then we enable it # lets open the file with nano for now
enableContainer "${VDM_CONTAINER_TYPE}" "${EDITOR:-nano}" "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/docker-compose.yml"
# if this container is enabled ask if it should be redeployed
if (whiptail --yesno "Would you like to deploy or re-deploy the ${VDM_CONTAINER_TYPE^} container that you opened to edit?" --title "Deploy or Re-Deploy Container" 8 112); then
# then we enable it
enableContainer "${VDM_CONTAINER_TYPE}"
fi
fi fi
fi fi
} }
@ -818,7 +828,7 @@ function joomla__TRuST__enable() {
elif [ ! -d "${VDM_PROJECT_PATH}" ]; then elif [ ! -d "${VDM_PROJECT_PATH}" ]; then
# this should never happen, but in case # this should never happen, but in case
showError "The path ${VDM_PROJECT_PATH} does not exist, so we can't mount the persistent volumes. This error should never show, \ showError "The path ${VDM_PROJECT_PATH} does not exist, so we can't mount the persistent volumes. This error should never show, \
please open an issue and report docker-deploy-error-1234 with the steps of how you got here?" please open an issue and report octojoom-error-1234 with the steps of how you got here?"
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 enable if it exists
if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" ]; then if [ -d "${VDM_REPO_PATH}/${VDM_CONTAINER_TYPE}/available/${VDM_CONTAINER}" ]; then
@ -1506,39 +1516,37 @@ function deletePersistentVolumes() {
function runUpdate() { function runUpdate() {
# we need sudo permissions # we need sudo permissions
if (whiptail --yesno "${USER^}, to update ${PROGRAM_NAME} we need sudo privileges." --title "Give sudo Privileges" 8 112); then if (whiptail --yesno "${USER^}, to update ${PROGRAM_NAME} we need sudo privileges." --title "Give sudo Privileges" 8 112); then
# check that we have an access token
getAccessToken || return 1
# remove the current version # remove the current version
if [ -f /usr/local/bin/docker-deploy ]; then if [ -f /usr/local/bin/octojoom ]; then
# just backup in case of failure # just backup in case of failure
sudo mv /usr/local/bin/docker-deploy /usr/local/bin/docker-deploy.bak sudo mv /usr/local/bin/octojoom /usr/local/bin/octojoom.bak
fi fi
# 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) branch=$(getTargetBranch)
# pull the latest version. Master is always the latest # pull the latest version. Master is always the latest
if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/docker-deploy/raw/src/docker-deploy?ref=${branch:-master}&access_token=${VDM_ACCESS_TOKEN}" -o /usr/local/bin/docker-deploy 2>/dev/null; then if sudo curl --fail -L "https://git.vdm.dev/api/v1/repos/octoleo/octojoom/raw/src/octojoom?ref=${branch:-master}" -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
if [ -f /usr/local/bin/docker-deploy.bak ]; then if [ -f /usr/local/bin/octojoom.bak ]; then
# lets remove it now # lets remove it now
sudo rm -f /usr/local/bin/docker-deploy.bak sudo rm -f /usr/local/bin/octojoom.bak
fi fi
else else
# show the error # show the error
echo >&2 "ERROR: Update failed! Please try again later." echo >&2 "ERROR: Update failed! Please try again later."
# do we have a backup # do we have a backup
if [ -f /usr/local/bin/docker-deploy.bak ]; then if [ -f /usr/local/bin/octojoom.bak ]; then
# move backup back # move backup back
sudo mv /usr/local/bin/docker-deploy.bak /usr/local/bin/docker-deploy sudo mv /usr/local/bin/octojoom.bak /usr/local/bin/octojoom
fi fi
fi fi
# always set the permission again if we have a file # always set the permission again if we have a file
if [ -f /usr/local/bin/docker-deploy ]; then if [ -f /usr/local/bin/octojoom ]; then
# the we make sure its executable # the we make sure its executable
sudo chmod +x /usr/local/bin/docker-deploy 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 exit 0
@ -1591,9 +1599,9 @@ function runUninstall() {
sudo rm -fr "${VDM_REPO_PATH}" sudo rm -fr "${VDM_REPO_PATH}"
fi fi
elif (whiptail --yesno "Would you like to only remove the actual ${PROGRAM_NAME} v${_V} script but keep all the Docker stuff?" --title "Keep Docker Stuff" 8 112); then elif (whiptail --yesno "Would you like to only remove the actual ${PROGRAM_NAME} v${_V} script but keep all the Docker stuff?" --title "Keep Docker Stuff" 8 112); then
# now remove the docker-deploy script # now remove the octojoom script
if [ -f /usr/local/bin/docker-deploy ]; then if [ -f /usr/local/bin/octojoom ]; then
sudo rm -f /usr/local/bin/docker-deploy sudo rm -f /usr/local/bin/octojoom
fi fi
# give the final message # give the final message
whiptail --title "${PROGRAM_NAME} v${_VERSION} is UNINSTALLED" --msgbox "\n\ whiptail --title "${PROGRAM_NAME} v${_VERSION} is UNINSTALLED" --msgbox "\n\
@ -1677,9 +1685,9 @@ function runUninstall() {
sudo rm -fr "${VDM_SRC_PATH}" sudo rm -fr "${VDM_SRC_PATH}"
fi fi
fi fi
# now remove the docker-deploy script # now remove the octojoom script
if [ -f /usr/local/bin/docker-deploy ]; then if [ -f /usr/local/bin/octojoom ]; then
sudo rm -f /usr/local/bin/docker-deploy sudo rm -f /usr/local/bin/octojoom
fi fi
# last and final question as this is most dangerous and serious issue. # last and final question as this is most dangerous and serious issue.
if [ -d "${VDM_PROJECT_PATH}" ] && if [ -d "${VDM_PROJECT_PATH}" ] &&
@ -1695,10 +1703,10 @@ function runUninstall() {
} }
# we show the octoleo info quietly # we show the octoleo info quietly
octoleoQuietly() { octojoomQuietly() {
local message local message
# now set the message # now set the message
message=" https://git.vdm.dev/octoleo/docker-deploy message=" https://git.vdm.dev/octoleo/octojoom
Welcome to an Octoleo Program (${PROGRAM_NAME} v$_VERSION) Welcome to an Octoleo Program (${PROGRAM_NAME} v$_VERSION)
@ -1887,7 +1895,7 @@ function showTraefik() {
menu_options+=("delete" "Delete Traefik") && i=$((i + 1)) menu_options+=("delete" "Delete Traefik") && i=$((i + 1))
# get the selection # get the selection
CHOICE=$( CHOICE=$(
whiptail --menu "Make your selection" 16 112 $i \ whiptail --menu "Make your selection" 20 112 $i \
--title "Traefik | ${PROGRAM_NAME} v${_V}" --fb \ --title "Traefik | ${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
@ -1936,7 +1944,7 @@ function showPortainer() {
menu_options+=("delete" "Delete Portainer") && i=$((i + 1)) menu_options+=("delete" "Delete Portainer") && i=$((i + 1))
# get the selection # get the selection
CHOICE=$( CHOICE=$(
whiptail --menu "Make your selection" 16 112 $i \ whiptail --menu "Make your selection" 20 112 $i \
--title "Portainer | ${PROGRAM_NAME} v${_V}" --fb \ --title "Portainer | ${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
@ -1973,6 +1981,9 @@ function showHelpMenu() {
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
[ -f "${VDM_SRC_PATH}/.env" ] &&
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")
# Update the whole script # Update the whole script
@ -1980,10 +1991,10 @@ function showHelpMenu() {
# Uninstall the whole script # Uninstall the whole script
menu_options+=("uninstall" "Uninstall ${PROGRAM_NAME,,}") menu_options+=("uninstall" "Uninstall ${PROGRAM_NAME,,}")
# Octoleo details # Octoleo details
menu_options+=("octoleo" "Octoleo") menu_options+=("octojoom" "Octojoom")
# get the selection # get the selection
CHOICE=$( CHOICE=$(
whiptail --menu "Make your selection" 16 112 $i \ whiptail --menu "Make your selection" 20 112 $i \
--title "Help Menu | ${PROGRAM_NAME} v${_V}" --fb \ --title "Help 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
@ -1996,8 +2007,11 @@ function showHelpMenu() {
"important-paths") "important-paths")
showImportantPaths showImportantPaths
;; ;;
"edit-config")
editConfigFile
;;
"report-issue") "report-issue")
showLink "https://git.vdm.dev/octoleo/docker-deploy/issues" "To report an issue go to:" "Report an Issue" showLink "https://git.vdm.dev/octoleo/octojoom/issues" "To report an issue go to:" "Report an Issue"
;; ;;
"update") "update")
runUpdate runUpdate
@ -2005,8 +2019,8 @@ function showHelpMenu() {
"uninstall") "uninstall")
runUninstall runUninstall
;; ;;
"octoleo") "octojoom")
octoleoQuietly octojoomQuietly
;; ;;
esac esac
} }
@ -2020,14 +2034,18 @@ function domainsMenu() {
# 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
menu_options+=("add" "Add Domain") allowMultiDomains &&
menu_options+=("add" "Add Domain") && i=$((i + 1))
# remove existing domains # remove existing domains
[ -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
allowEditHostFile &&
menu_options+=("edit" "Edit Host File") && i=$((i + 1))
# get the selection # get the selection
CHOICE=$( CHOICE=$(
whiptail --menu "Make your selection" 16 112 $i \ whiptail --menu "Make your selection" 20 112 $i \
--title "Help Menu | ${PROGRAM_NAME} v${_V}" --fb \ --title "Domains 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
) )
@ -2039,6 +2057,9 @@ function domainsMenu() {
"delete") "delete")
deleteMultiDomains deleteMultiDomains
;; ;;
"edit")
editHostFile
;;
esac esac
} }
@ -2047,7 +2068,7 @@ function mainMenu() {
# menu for dynamic addition # menu for dynamic addition
local menu_options=() local menu_options=()
# our counter # our counter
local i=9 local i=6
# Joomla containers # Joomla containers
menu_options+=("joomla" "Joomla Containers") menu_options+=("joomla" "Joomla Containers")
# Openssh containers # Openssh containers
@ -2057,8 +2078,10 @@ function mainMenu() {
# Portainer container # Portainer container
menu_options+=("portainer" "Portainer Container") menu_options+=("portainer" "Portainer Container")
# Manage Domains # Manage Domains
allowMultiDomains && if allowEditHostFile || allowMultiDomains; then
menu_options+=("domains" "Manage Domains") && i=$((i + 1)) menu_options+=("domains" "Manage Domains")
i=$((i + 1))
fi
# 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))
@ -2107,17 +2130,17 @@ function mainMenu() {
# show error # show error
function showError() { function showError() {
whiptail --title "ERROR | ${PROGRAM_NAME} v${_V}" --msgbox "${1}" 12 112 whiptail --title "ERROR | ${PROGRAM_NAME} v${_V}" --msgbox "${1}" "${2:-12}" 112
} }
# show info # show info
function showInfo() { function showInfo() {
whiptail --title "INFO | ${PROGRAM_NAME} v${_V}" --infobox "${1}" 12 112 whiptail --title "INFO | ${PROGRAM_NAME} v${_V}" --infobox "${1}" "${2:-12}" 112
} }
# show notice # show notice
function showNotice() { function showNotice() {
whiptail --title "NOTICE | ${PROGRAM_NAME} v${_V}" --msgbox "${1}" 12 112 whiptail --title "NOTICE | ${PROGRAM_NAME} v${_V}" --msgbox "${1}" "${2:-12}" 112
} }
# show link # show link
@ -2139,7 +2162,7 @@ function showImportantPaths() {
CONFIG: ${VDM_SRC_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 docker-deploy.yml files Since we do not store any passwords or other important details in the octojoom.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 its permissions are (600) for security.
JOOMLA: ${VDM_REPO_PATH}/joomla/.env JOOMLA: ${VDM_REPO_PATH}/joomla/.env
@ -2198,6 +2221,7 @@ function hasDirectories() {
function getRandomPass() { function getRandomPass() {
# simple basic random # simple basic random
# shellcheck disable=SC2046 # shellcheck disable=SC2046
# shellcheck disable=SC2005
echo $(tr -dc 'A-HJ-NP-Za-km-z2-9' </dev/urandom | dd bs="${1:-128}" count=1 status=none) echo $(tr -dc 'A-HJ-NP-Za-km-z2-9' </dev/urandom | dd bs="${1:-128}" count=1 status=none)
} }
@ -2296,38 +2320,6 @@ function getPassword() {
echo "${PASSWORD}" echo "${PASSWORD}"
} }
# get and set the access token
function getAccessToken() {
# we try getting the token twice
local t=0
local new_token=false
# check that we have an access token, els ask for it
while [ ${#VDM_ACCESS_TOKEN} -le 30 ]; do
# this is a new token
new_token=true
# get the value
VDM_ACCESS_TOKEN=$(getInput "Enter access token for updates.\n[You can get an access token from https://git.vdm.dev/user/settings/applications]" \
'' 'Access Token')
# keep asking if empty
if [ ${#VDM_ACCESS_TOKEN} -le 30 ]; then
showError "Updates can only be done if you have an access token."
# increment our try
t=$((t + 1))
# when the user for the second time does not supply the correct value we return
if [ $t -eq 2 ]; then
return 12
fi
fi
done
# make the token available
export VDM_ACCESS_TOKEN
# store the token for next time
$new_token && setEnvVariable "VDM_ACCESS_TOKEN=\"${VDM_ACCESS_TOKEN}\"" &&
showNotice "The token has been stored in the environment variable file (${VDM_SRC_PATH}/.env)."
# we have success
return 0
}
# get the target branch to use in update # get the target branch to use in update
function getTargetBranch() { function getTargetBranch() {
# now make the selection # now make the selection
@ -2354,9 +2346,10 @@ function getListDomains() {
# build the menu # build the menu
for domain in "${domains[@]}"; do for domain in "${domains[@]}"; do
# load the back menu # load the back menu
menu_options+=("${domain}") [ "${#domain}" -ge 1 ] && menu_options+=("${domain}")
done done
# we show a list of options including the option to add another # we show a list of options including the option to add another
# shellcheck disable=SC2005
echo "$(printf "${separator}%s" "${menu_options[@]}")" echo "$(printf "${separator}%s" "${menu_options[@]}")"
fi fi
fi fi
@ -2373,52 +2366,66 @@ function getMultiDomain() {
local i=0 local i=0
# always add the main domain or (default) first # always add the main domain or (default) first
# so we should always have a selection # so we should always have a selection
setMultiDomain "${VDM_DOMAIN:-${USER:-joomla}.vdm}" saveMultiDomain "${VDM_DOMAIN}"
# now clear the main domain (in case we use getDomain) # now clear the main domain (in case we use getDomain)
unset VDM_DOMAIN unset VDM_DOMAIN
# get existing domains # get existing domains
if [ -f "${VDM_SRC_PATH}/.domains" ] && readarray -t domains <"${VDM_SRC_PATH}/.domains"; then if [ -f "${VDM_SRC_PATH}/.domains" ] && readarray -t domains <"${VDM_SRC_PATH}/.domains"; then
# build the menu # build the menu
if [ "${#domains[@]}" -gt 0 ]; then if [ "${#domains[@]}" -gt 0 ]; then
# loop domains
for domain in "${domains[@]}"; do for domain in "${domains[@]}"; do
# load the back menu # load the domain if it has a length
menu_options+=("${domain}" "${domain}" "OFF") [ "${#domain}" -ge 1 ] && menu_options+=("${domain}" "${domain}" "OFF")
# increment our counter # increment our counter
i=$((i + 1)) [ "${#domain}" -ge 1 ] && i=$((i + 1))
done done
# we show a list of options including the option to add another # make sure we have domains
domain_name=$(whiptail --title "Select a Domain" --radiolist --nocancel --notags \ if [ "${#menu_options[@]}" -gt 0 ]; then
"Select a domain, or none to add another." 30 80 $i \ # we show a list of options including the option to add another
"${menu_options[@]}" 3>&1 1>&2 2>&3) domain_name=$(whiptail --title "Select a Domain" --radiolist --nocancel --notags \
"Select a domain, or none to add another." 30 80 $i \
"${menu_options[@]}" 3>&1 1>&2 2>&3)
fi
fi fi
fi fi
# check if we have a selection # check if we have a selection
if [ "${domain_name:-none}" = 'none' ]; then if [ "${domain_name:-none}" = 'none' ]; then
# we must let them enter the new domain name # we must let them enter the new domain name
domain_name=$(getDomain "Enter a domain name" "Enter a Domain Name") getDomain 'Enter a domain name' 'Enter a Domain Name'
else
# set the new main domain
VDM_DOMAIN="${domain_name}"
# update the main domain
export VDM_DOMAIN
fi fi
# add for next time # add for next time
setMultiDomain "${domain_name:-${USER:-joomla}.vdm}" saveMultiDomain "${VDM_DOMAIN}"
# update the main domain
echo "${domain_name:-${USER:-joomla}.vdm}"
} }
# set the VDM domain value # set the VDM domain value
function getDomain() { function getDomain() {
# set some locals
local message="Enter main domain name"
local title="Enter Main Domain"
local tld="${VDM_CONTAINER_TYPE:-vdm}"
# get the arg passed if any
message="${1:-$message}"
title="${2:-$title}"
# get the VDM Domain value if not already set # get the VDM Domain value if not already set
while [ ${#VDM_DOMAIN} -le 1 ] || [[ "${VDM_DOMAIN}" != *.* ]]; do while [ ${#VDM_DOMAIN} -le 1 ] || [[ "${VDM_DOMAIN}" != *.* ]]; do
# get the value # get the value
VDM_DOMAIN=$(getInput "${1:-Enter main domain name.}\n[must have at least one dot]" \ VDM_DOMAIN=$(getInput "${message}\n[must have at least one dot]" \
"${3:-${USER:-joomla}.vdm}" "${2:-Enter Main Domain}") "${USER:-octoleo}.${tld,,}" "${title}")
# keep asking if empty or does exist # keep asking if empty or does exist
if [ ${#VDM_DOMAIN} -le 1 ]; then if [ ${#VDM_DOMAIN} -le 1 ]; then
showError "${4:-You must enter a domain name!}" showError "You must enter a domain name!"
elif [[ "${VDM_DOMAIN}" != *.* ]]; then elif [[ "${VDM_DOMAIN}" != *.* ]]; then
showError "${5:-You must enter a domain name with at least one dot!}" showError "You must enter a domain name with at least one dot"
fi fi
done done
# return what we found # update the main domain
echo "${VDM_DOMAIN}" export VDM_DOMAIN
} }
# set the main domain # set the main domain
@ -2426,13 +2433,11 @@ function getMainDomain() {
# we first check if we have a main domain passed as command argument # we first check if we have a main domain passed as command argument
if $VDM_ARG_DOMAIN; then if $VDM_ARG_DOMAIN; then
# if domain passed by arg we just return it # if domain passed by arg we just return it
VDM_DOMAIN=$(getDomain "Enter a domain name" "Enter a Domain Name") getDomain 'Enter a domain name' 'Enter a Domain Name'
else else
# update the main domain with a selection # update the main domain with a selection
VDM_DOMAIN=$(getMultiDomain) getMultiDomain
fi fi
# make sure it is available
export VDM_DOMAIN
} }
# set the domain # set the domain
@ -2450,11 +2455,9 @@ function setDomain() {
# set the main domain # set the main domain
function setMainDomain() { function setMainDomain() {
# set the main domain if not set # set the main domain if not set
VDM_DOMAIN=$(getDomain) getDomain
# add this value if not set variable # add this value if not set variable
setEnvVariable "VDM_DOMAIN=\"${VDM_DOMAIN}\"" setEnvVariable "VDM_DOMAIN=\"${VDM_DOMAIN}\""
# make sure it is available
export VDM_DOMAIN
} }
# set the sub domain # set the sub domain
@ -2464,10 +2467,10 @@ function setSubDomain() {
while [ ${#VDM_SUBDOMAIN} -le 1 ] || [[ "${VDM_SUBDOMAIN}" =~ [^a-zA-Z] ]] || while [ ${#VDM_SUBDOMAIN} -le 1 ] || [[ "${VDM_SUBDOMAIN}" =~ [^a-zA-Z] ]] ||
[ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN}.${VDM_DOMAIN}" ] || [ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN}.${VDM_DOMAIN}" ] ||
[ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN%db}.${VDM_DOMAIN}" ] || [ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN%db}.${VDM_DOMAIN}" ] ||
[ "${VDM_SUBDOMAIN}" = "${2:-}" ]; do [ "${VDM_SUBDOMAIN}" = "${2}" ]; do
# get the value # get the value
VDM_SUBDOMAIN=$(getInput "Enter sub-domain used for this ${VDM_CONTAINER_TYPE^} container.\n[Text with no spaces that is only alphabetical]" \ VDM_SUBDOMAIN=$(getInput "Enter sub-domain used for this ${VDM_CONTAINER_TYPE^} container.\n[Text with no spaces that is only alphabetical]" \
"${1:-}" 'Enter Sub-Domain') "${1}" 'Enter Sub-Domain')
# keep asking if empty or does exist # keep asking if empty or does exist
if [ ${#VDM_SUBDOMAIN} -ge 1 ] && [ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN}.${VDM_DOMAIN}" ] || if [ ${#VDM_SUBDOMAIN} -ge 1 ] && [ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN}.${VDM_DOMAIN}" ] ||
[ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN%db}.${VDM_DOMAIN}" ]; then [ -d "${VDM_REPO_PATH}/${3:-$VDM_CONTAINER_TYPE}/available/${VDM_SUBDOMAIN%db}.${VDM_DOMAIN}" ]; then
@ -2500,12 +2503,9 @@ function setMultiDomains() {
# now clear the main domain each time # now clear the main domain each time
unset VDM_DOMAIN unset VDM_DOMAIN
# we must let them enter the new domain name # we must let them enter the new domain name
domain_name=$(getDomain "Enter a domain name" "Enter a Domain Name") getDomain 'Enter a domain name' 'Enter a Domain Name'
# add for next time # add for next time
setMultiDomain "${domain_name:-${USER:-joomla}.vdm}" || { saveMultiDomain "${VDM_DOMAIN}"
# return an error
return $?
}
# get the list of domains # get the list of domains
list_domains=$(getListDomains "\n") list_domains=$(getListDomains "\n")
# update the question # update the question
@ -2514,35 +2514,17 @@ function setMultiDomains() {
fi fi
} }
# to set a global multiple domain file and values
function setMultiDomain() {
# check if the env file exist
if [ -f "${VDM_SRC_PATH}/.domains" ]; then
grep -q "${1}" "${VDM_SRC_PATH}/.domains" || echo "${1}" >>"${VDM_SRC_PATH}/.domains"
elif (whiptail --yesno "Can we create the ${VDM_SRC_PATH}/.domains file" --title "Multi Domain File" 8 112); then
# make sure the folder exist
mkdir -p "${VDM_SRC_PATH}"
# so we creat the file
echo "${1}" >"${VDM_SRC_PATH}/.domains"
# make sure the permissions are secured
chmod 600 "${VDM_SRC_PATH}/.domains"
else
showError "The ${VDM_SRC_PATH}/.domains file does not exist. So ${1} could not be added!"
# we return false
return 12
fi
# we return true
return 0
}
# set the multi domain switch # set the multi domain switch
function setMultiDomainSwitch() { function setMultiDomainSwitch() {
# Allow multiple domains # Allow multiple domains
if [ "${VDM_MULTI_DOMAIN:-not}" = 'not' ]; then if [ "${VDM_MULTI_DOMAIN:-not}" = 'not' ]; then
# explain the pros and cons... # explain the pros and cons...
showNotice "The down side to allowing multiple domains is that you will need to select a main domain each time you setup a new container. The advantage is that you can have multiple domains ;)" showNotice "Next you should make the selection of using a single or multiple domain setup.\n\n\
With multiple domain setups you will need to select a main domain each time you setup a new container.\n\
With a single domain setup you setup the main domain once, and then only need setup the subdomains\n\
with each new container."
# check the security switch # check the security switch
if (whiptail --yesno "Would you like to allow for multiple domains?" --defaultno --title "Allow Multi Domains" 8 112); then if (whiptail --yesno "Would you like to use a multiple domains setup?" --defaultno --title "Allow Multi Domains" 8 112); then
# we set the secure switch # we set the secure switch
VDM_MULTI_DOMAIN=true VDM_MULTI_DOMAIN=true
else else
@ -2615,7 +2597,7 @@ function setUpdateHostFile() {
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]" --defaultno --title "Letsencrypt" 8 112); then if (whiptail --yesno "Would you like to use Letsencrypt auto setup for your containers [ONLY for server with public static IP]" --defaultno --title "Letsencrypt" 8 112); then
# we set the secure switch # we set the secure switch
VDM_SECURE=true VDM_SECURE=true
else else
@ -2703,6 +2685,48 @@ function allowMultiDomains() {
return 12 return 12
} }
# do we allow multiple domains
function allowEditHostFile() {
# check if we allow host file updates
setUpdateHostFile
# allow multi domain setup
if $VDM_UPDATE_HOST; then
# yes we do
return 0
fi
# now we don't
return 12
}
# to set a global multiple domain file and values
function saveMultiDomain() {
# set some locals
local domain_name
local src_path_domain
# set the domain and remove any whitespace
domain_name="$(echo -e "${1}" | tr -d '[:space:]')";
src_path_domain="${VDM_SRC_PATH}/.domains";
# check that we have a domain string
if [ ${#domain_name} -ge 1 ]; then
# check if the file exist
if [ -f "${src_path_domain}" ]; then
# check if its already set
if grep -L "${domain_name}" "${src_path_domain}"; then
echo "${domain_name}" >>"${src_path_domain}"
fi
else
# make sure the folder exist
mkdir -p "${VDM_SRC_PATH}"
# so we creat the file
echo "${domain_name}" >"${src_path_domain}"
# make sure the permissions are secured
chmod 600 "${src_path_domain}"
fi
fi
# we return true
return 0
}
# delete multiple domains # delete multiple domains
function deleteMultiDomains() { function deleteMultiDomains() {
# menu for dynamic addition # menu for dynamic addition
@ -2751,7 +2775,7 @@ function isFunc() {
# update the host file # update the host file
function updateHostFile() { function updateHostFile() {
# check if we should add to host file # check if we should add to host file
if $VDM_UPDATE_HOST; then if allowEditHostFile; then
# check if already in host file # check if already in host file
if grep -q "${1:-$VDM_SUBDOMAIN}.${2:-$VDM_DOMAIN}" /etc/hosts; then if grep -q "${1:-$VDM_SUBDOMAIN}.${2:-$VDM_DOMAIN}" /etc/hosts; then
showNotice "${USER^}, ${1:-$VDM_SUBDOMAIN}.${2:-$VDM_DOMAIN} is already in the /etc/hosts file." showNotice "${USER^}, ${1:-$VDM_SUBDOMAIN}.${2:-$VDM_DOMAIN} is already in the /etc/hosts file."
@ -2764,22 +2788,50 @@ function updateHostFile() {
fi fi
} }
# the manually edit the host file
function editHostFile() {
# check if we should add to host file
if allowEditHostFile; then
# if this container is enabled ask if it should be redeployed
if (whiptail --yesno "To edit the host file we need sudo privileges.\n[Only continue if you know what your doing!]" --title "Give sudo Privileges" 15 112); then
# 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
# lets open the file with nano for now
sudo "${EDITOR:-nano}" /etc/hosts
fi
fi
}
# the manually edit the config file
function editConfigFile() {
# check if the file exist
if [ -f "${VDM_SRC_PATH}/.env" ]; then
# give little warning for less command ready people
if (whiptail --yesno "Only continue if you know what your doing!\n\n\
${USER^}, to save the changes you've made or to just close the file again press:\n\n\
[ctrl+x] with nano on ubuntu." --title "Continue to edit ${PROGRAM_NAME} global config." 15 112); then
# all direct edit of the global config file
"${EDITOR:-nano}" "${VDM_SRC_PATH}/.env"
fi
fi
}
#####################################################################################################################VDM #####################################################################################################################VDM
######################################## CLI MENU ʕ•ᴥ•ʔ ######################################## CLI MENU ʕ•ᴥ•ʔ
# help message # help message
function showHelp() { function showHelp() {
cat <<EOF cat <<EOF
Usage: ${0##*/:-} [OPTION...] Usage: octojoom [OPTION...]
Options Options
====================================================== ======================================================
--type <type> --type <type>
set type you would like to work with set type you would like to work with
example: ${0##*/:-} --type joomla example: octojoom --type joomla
====================================================== ======================================================
--task <task> --task <task>
set type of task you would like to perform set type of task you would like to perform
example: ${0##*/:-} --task setup example: octojoom --task setup
====================================================== ======================================================
--container <container.domain.name> --container <container.domain.name>
Directly enabling or disabling a container with Directly enabling or disabling a container with
@ -2787,74 +2839,74 @@ Usage: ${0##*/:-} [OPTION...]
The container must exist, which means it was The container must exist, which means it was
setup previously setup previously
Used without type and task Joomla-Enable is (default) Used without type and task Joomla-Enable is (default)
example: ${0##*/:-} --container "io.vdm.dev" example: octojoom --container "io.vdm.dev"
====================================================== ======================================================
--update --update
to update your install to update your install
example: ${0##*/:-} --update example: octojoom --update
====================================================== ======================================================
--access-token <token> --access-token <token>
to update the program you will need an access token to update the program you will need an access token
from https://git.vdm.dev/user/settings/applications from https://git.vdm.dev/user/settings/applications
example: docker-deploy --access-token xxxxxxxxxxx example: octojoom --access-token xxxxxxxxxxx
====================================================== ======================================================
--uninstall --uninstall
to uninstall this script to uninstall this script
example: ${0##*/:-} --uninstall example: octojoom --uninstall
====================================================== ======================================================
AVAILABLE FOR TO ANY CONTAINER AVAILABLE FOR TO ANY CONTAINER
====================================================== ======================================================
-k|--key <key> -k|--key <key>
set key for the docker compose container naming set key for the docker compose container naming
!! no spaces allowed in the key !! !! no spaces allowed in the key !!
example: ${0##*/:-} -k="vdm" example: octojoom -k="vdm"
example: ${0##*/:-} --key="vdm" example: octojoom --key="vdm"
====================================================== ======================================================
-e|--env-key <key> -e|--env-key <key>
set key for the environment variable naming set key for the environment variable naming
!! no spaces allowed in the key & must be UPPERCASE !! !! no spaces allowed in the key & must be UPPERCASE !!
example: ${0##*/:-} -e="VDM" example: octojoom -e="VDM"
example: ${0##*/:-} --env-key="VDM" example: octojoom --env-key="VDM"
====================================================== ======================================================
-d|--domain <domain.com> -d|--domain <domain.com>
set key website domain set key website domain
!! must be domain.tld !! !! must be domain.tld !!
example: ${0##*/:-} -d="joomla.org" example: octojoom -d="joomla.org"
example: ${0##*/:-} --domain="joomla.org" example: octojoom --domain="joomla.org"
====================================================== ======================================================
-s|--sub-domain <domain.com> -s|--sub-domain <domain.com>
set key website sub domain set key website sub domain
!! no spaces allowed in the sub domain !! !! no spaces allowed in the sub domain !!
example: ${0##*/:-} -s="jcb" example: octojoom -s="jcb"
example: ${0##*/:-} --sub-domain="jcb" example: octojoom --sub-domain="jcb"
====================================================== ======================================================
AVAILABLE FOR JOOMLA CONTAINER AVAILABLE FOR JOOMLA CONTAINER
====================================================== ======================================================
-j|--joomla-version <version-tag> -j|--joomla-version <version-tag>
see available tags here https://hub.docker.com/_/joomla see available tags here https://hub.docker.com/_/joomla
example: ${0##*/:-} -j=3.10 example: octojoom -j=3.10
example: ${0##*/:-} --joomla-version=3.10 example: octojoom --joomla-version=3.10
====================================================== ======================================================
AVAILABLE FOR OPENSSH CONTAINER AVAILABLE FOR OPENSSH CONTAINER
====================================================== ======================================================
-u|--username <username> -u|--username <username>
set username of the container set username of the container
example: ${0##*/:-} -u="ubuntu" example: octojoom -u="ubuntu"
example: ${0##*/:-} --username="ubuntu" example: octojoom --username="ubuntu"
====================================================== ======================================================
--uid <id> --uid <id>
set container user id set container user id
example: ${0##*/:-} --uid=1000 example: octojoom --uid=1000
====================================================== ======================================================
--gid <id> --gid <id>
set container user group id set container user group id
example: ${0##*/:-} --gid=1000 example: octojoom --gid=1000
====================================================== ======================================================
-p|--port <port> -p|--port <port>
set ssh port to use set ssh port to use
!! do not use 22 !! !! do not use 22 !!
example: ${0##*/:-} -p=2239 example: octojoom -p=2239
example: ${0##*/:-} --port=2239 example: octojoom --port=2239
====================================================== ======================================================
--ssh-dir <dir> --ssh-dir <dir>
set ssh directory name found in the .ssh dir set ssh directory name found in the .ssh dir
@ -2862,25 +2914,25 @@ Usage: ${0##*/:-} [OPTION...]
This directory has separate files for This directory has separate files for
each public key allowed to access each public key allowed to access
the container the container
example: ${0##*/:-} --ssh-dir="teamname" example: octojoom --ssh-dir="teamname"
====================================================== ======================================================
--sudo --sudo
switch to add the container user to the switch to add the container user to the
sudo group of the container sudo group of the container
example: ${0##*/:-} --sudo example: octojoom --sudo
====================================================== ======================================================
-t|--time-zone <time/zone> -t|--time-zone <time/zone>
set time zone of the container set time zone of the container
!! must valid time zone !! !! must valid time zone !!
example: ${0##*/:-} -t="Africa/Windhoek" example: octojoom -t="Africa/Windhoek"
example: ${0##*/:-} --time-zone="Africa/Windhoek" example: octojoom --time-zone="Africa/Windhoek"
====================================================== ======================================================
HELP ʕ•ᴥ•ʔ HELP ʕ•ᴥ•ʔ
====================================================== ======================================================
-h|--help -h|--help
display this help menu display this help menu
example: ${0##*/:-} -h example: octojoom -h
example: ${0##*/:-} --help example: octojoom --help
====================================================== ======================================================
${PROGRAM_NAME} v${_VERSION} ${PROGRAM_NAME} v${_VERSION}
====================================================== ======================================================
@ -3201,7 +3253,7 @@ fi
#####################################################################################################################VDM #####################################################################################################################VDM
######################################## SETUP KEY PATHS ######################################## SETUP KEY PATHS
# the src folder path is where we store the script global env # the src folder path is where we store the script global env
VDM_SRC_PATH="/home/${USER}/.config/docker-deploy" 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}"
@ -3210,8 +3262,6 @@ mkdir -p -m '700' "${VDM_SRC_PATH}"
[ -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
while [ ${#VDM_REPO_PATH} -le 1 ] || [ ! -d "${VDM_REPO_PATH}" ]; do while [ ${#VDM_REPO_PATH} -le 1 ] || [ ! -d "${VDM_REPO_PATH}" ]; do
# we catch the token now.. so we don't need asking for it later
getAccessToken
# creat the path if it exist # creat the path if it exist
if [ ${#VDM_REPO_PATH} -ge 1 ] && (whiptail --yesno "Can we create the ${VDM_REPO_PATH} repository folder" --title "Create the Path" 8 112); then if [ ${#VDM_REPO_PATH} -ge 1 ] && (whiptail --yesno "Can we create the ${VDM_REPO_PATH} repository folder" --title "Create the Path" 8 112); then
mkdir -p "${VDM_REPO_PATH}" mkdir -p "${VDM_REPO_PATH}"