-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_config/_localconfig.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/bin/bash | ||
|
||
################################### | ||
### local config: moodle-docker | ||
################################### | ||
|
||
# Path to moodle-docker-compose | ||
# The path where the moodle-docker-compose script is located | ||
pathtobin="$HOME/Workspaces/moodle-docker/bin/moodle-docker-compose" | ||
|
||
|
||
################################### | ||
### local config: clusters | ||
################################### | ||
|
||
# Clusters: | ||
# The moodle instance clusters which should be supported for on-demand usage | ||
clusters=(core plugins) | ||
|
||
|
||
################################### | ||
### local config: versions | ||
################################### | ||
|
||
# Versions: | ||
# The moodle versions which should be supported for on-demand usage | ||
versions=(master 401 402 403 404 405) | ||
|
||
|
||
################################### | ||
### local config: php | ||
################################### | ||
|
||
# PHP versions: | ||
# The PHP versions which should be supported for on-demand usage | ||
phps=(7.4 8.0 8.1 8.2 8.3) | ||
|
||
# Default PHP version: | ||
# The PHP version which is used if the parameter is not given when the script is run | ||
phps_default='8.2' | ||
|
||
|
||
################################### | ||
### local config: databases | ||
################################### | ||
|
||
# Databases: | ||
# The databases engines which should be supported for on-demand usage | ||
databases=(pgsql mariadb mysql mssql oracle) | ||
|
||
# Default database: | ||
# The database engine which is used if the parameter is not given when the script is run | ||
databases_default='pgsql' | ||
|
||
|
||
################################### | ||
### local config: browsers | ||
################################### | ||
|
||
# Browsers: | ||
# The browsers for selenium testing which should be supported for on-demand usage | ||
browsers=(firefox chrome) | ||
|
||
# Default browser: | ||
# The browser for selenium testing which is used if the parameter is not given when the script is run | ||
browsers_default='firefox' | ||
|
||
|
||
################################### | ||
### local config: wwwroot | ||
################################### | ||
|
||
# WWWroot base: | ||
# The base path which will be used for building the particular instance's wwwroot | ||
wwwrootbase="$HOME/Workspaces/moodle-sites/moodle-docker-" | ||
|
||
|
||
################################### | ||
### local config: instances | ||
################################### | ||
|
||
# Instance name base: | ||
# The prefix which will be used for building the instance's name | ||
instancenamebase='moodle-docker-' | ||
|
||
|
||
################################### | ||
### local config: hosts and ports | ||
################################### | ||
|
||
# Host: | ||
# The host which the container should bind its ports to | ||
bindto='127.0.0.1' | ||
|
||
# Webserver port base: | ||
# The first digit of the port which the webserver container should bind its port to | ||
webportbase='6' | ||
|
||
# VNC port base: | ||
# The first digit of the port which the selenium VNC container should bind its port to | ||
vncportbase='5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash | ||
|
||
################################### | ||
### functions | ||
################################### | ||
|
||
success () | ||
{ | ||
echo -e "\033[32mSuccess\033[0m" | ||
return 0 | ||
} | ||
|
||
failure () | ||
{ | ||
echo -e "\033[31mFailed (return code: $?)\033[0m" >&2 | ||
exit 1 | ||
} | ||
|
||
now () | ||
{ | ||
echo | ||
echo -e "\033[1;35mNow: $1\033[0m" | ||
} | ||
|
||
confirm () | ||
{ | ||
read -p "Continue (y/n)? " CONT | ||
if [ "$CONT" != "y" ]; then | ||
echo "Ok, exiting..."; | ||
exit 1; | ||
fi | ||
} | ||
|
||
ask () | ||
{ | ||
read -p "Do you want me to do this (y/n)? " CONT | ||
if [ "$CONT" == "y" ]; then | ||
echo "Ok, I will do this..."; | ||
$1 \ | ||
&& success || failure | ||
elif [ "$CONT" == "n" ]; then | ||
echo "Ok, I will not do this..."; | ||
else | ||
echo "Invalid answer, exiting..."; | ||
exit 1; | ||
fi | ||
} | ||
|
||
acknowledge () | ||
{ | ||
read -p "Press any key to continue." | ||
} | ||
|
||
array_join_by () | ||
{ | ||
local IFS="$1" | ||
shift | ||
echo "$*" | ||
} | ||
|
||
array_contains_element () | ||
{ | ||
local e match="$1" | ||
shift | ||
for e | ||
do | ||
if [[ "$e" == "$match" ]]; then | ||
return 0 | ||
fi | ||
done | ||
return 1 | ||
} | ||
|
||
array_get_index_of() | ||
{ | ||
needle=$1 && shift | ||
haystack=("$@") | ||
for i in "${!haystack[@]}"; do | ||
if [[ "${haystack[$i]}" = "${needle}" ]]; then | ||
echo "${i}" | ||
fi | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
################################### | ||
### includes | ||
################################### | ||
|
||
CURRENTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
source "$CURRENTDIR/../_include/_functions.sh" | ||
source "$CURRENTDIR/../_config/_localconfig.sh" | ||
|
||
|
||
################################### | ||
### check startup | ||
################################### | ||
|
||
usage () | ||
{ | ||
cat <<EOU | ||
Usage: | ||
moodle-docker-bash.sh | ||
EOU | ||
} | ||
|
||
|
||
# Verify that the script is not being sourced (just in case that the user was confused) | ||
if [[ $0 != "$BASH_SOURCE" ]]; then | ||
usage | ||
return 1 | ||
fi | ||
|
||
|
||
# Verify that all necessary env variables are set | ||
if [[ -z "$COMPOSE_PROJECT_NAME" ]] || [[ -z "$MOODLE_DOCKER_WWWROOT" ]] || [[ -z "$MOODLE_DOCKER_DB" ]] || [[ -z "$MOODLE_DOCKER_PHP_VERSION" ]] || [[ -z "$MOODLE_DOCKER_WEB_PORT" ]] || [[ -z "$MOODLE_DOCKER_BROWSER" ]] || [[ -z "$MOODLE_DOCKER_SELENIUM_VNC_PORT" ]]; then | ||
echo 'Necessary env variables are not set yet.' | ||
echo 'Please run moodle-docker-env.sh first' | ||
exit 1 | ||
fi | ||
|
||
|
||
# Process parameters | ||
while getopts 'h' OPTION; do | ||
case "$OPTION" in | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
:) | ||
usage | ||
exit 1 | ||
;; | ||
*) | ||
usage | ||
exit 1 | ||
;; | ||
?) | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
# Verify that no argument was given | ||
if [[ $OPTIND -ne 1 ]]; then | ||
usage | ||
exit 1 | ||
fi | ||
|
||
|
||
################################### | ||
### action | ||
################################### | ||
|
||
$pathtobin exec webserver bash |
Oops, something went wrong.