Skip to content

Commit

Permalink
Export DB port to allow us to connect with an external database tool
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Oct 23, 2024
1 parent dec2538 commit 94901a8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions _config/_localconfig.dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ webportbase='6'
# VNC port base:
# The first digit of the port which the selenium VNC container should bind its port to
vncportbase='5'

# DB port base:
# The first digit of the port which the DB container should bind its port to
dbportbase='4'

2 changes: 1 addition & 1 deletion bin/moodle-docker-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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
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" ]] || [[ -z "$MOODLE_DOCKER_DB_PORT" ]]; then
echo 'Necessary env variables are not set yet.'
echo 'Please run moodle-docker-env.sh first'
exit 1
Expand Down
3 changes: 3 additions & 0 deletions bin/moodle-docker-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ port4=$(array_get_index_of $database "${databases[@]}")
port5=$(array_get_index_of $php "${phps[@]}")
webport=${webportbase}${port2}${port3}${port4}${port5}
vncport=${vncportbase}${port2}${port3}${port4}${port5}
dbport=${dbportbase}${port2}${port3}${port4}${port5}


###################################
Expand All @@ -192,6 +193,7 @@ export MOODLE_DOCKER_PHP_VERSION=$php
export MOODLE_DOCKER_WEB_PORT=$bindto:$webport
export MOODLE_DOCKER_BROWSER=$browser
export MOODLE_DOCKER_SELENIUM_VNC_PORT=$bindto:$vncport
export MOODLE_DOCKER_DB_PORT=$bindto:$dbport


###################################
Expand All @@ -216,3 +218,4 @@ echo -e "Selenium browser: \033[1m${browser}\033[0m"
echo
echo -e "Webserver URL: \033[1m\033[93mhttp://${bindto}:${webport}/\033[39m\033[0m"
echo -e "VNC Port: \033[1m${bindto}:${vncport}\033[0m"
echo -e "DB Port: \033[1m${bindto}:${dbport}\033[0m"
2 changes: 1 addition & 1 deletion bin/moodle-docker-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ 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
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" ]] || [[ -z "$MOODLE_DOCKER_DB_PORT" ]]; then
echo 'Necessary env variables are not set yet.'
echo 'Please run moodle-docker-env.sh first'
exit 1
Expand Down
2 changes: 1 addition & 1 deletion bin/moodle-docker-xdebug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ 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
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" ]] || [[ -z "$MOODLE_DOCKER_DB_PORT" ]]; then
echo 'Necessary env variables are not set yet.'
echo 'Please run moodle-docker-env.sh first'
exit 1
Expand Down

0 comments on commit 94901a8

Please sign in to comment.