Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ When you change them, use `bin/moodle-docker-compose down && bin/moodle-docker-c
| `MOODLE_DOCKER_SELENIUM_VNC_PORT` | no | any integer value (or bind_ip:integer)| not set | If set, the selenium node will expose a vnc session on the port specified. Similar to MOODLE_DOCKER_WEB_PORT, you can optionally define the host IP to bind to. If you just set the port, VNC binds to 127.0.0.1 |
| `MOODLE_DOCKER_APP_PATH` | no | path on your file system | not set | If set and the chrome browser is selected, it will start an instance of the Moodle app from your local codebase |
| `MOODLE_DOCKER_APP_VERSION` | no | a valid [app docker image version](https://docs.moodle.org/dev/Moodle_App_Docker_images) | not set | If set will start an instance of the Moodle app if the chrome browser is selected |
| `MOODLE_DOCKER_APP_PORT` | no | any integer value | 8100 | The app will be served on this port, 0 will mean the app is not available on the host machine |
| `MOODLE_DOCKER_TIMEOUT_FACTOR` | no | any integer value | 1 | If set the timeouts in behat will be multiplied by the factor |

In addition to that, `MOODLE_DOCKER_RUNNING=1` env variable is defined and available
Expand Down
24 changes: 20 additions & 4 deletions bin/moodle-docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,23 @@ then
export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion"
fi

# Guess mobile app port (only when using Docker app images)
if [[ -z "$MOODLE_DOCKER_APP_PORT" ]] && [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]];

if [[ -z "$MOODLE_DOCKER_APP_INTERNAL_PORT" ]] && [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]];
then
# Guess mobile app port (only when using Docker app images)
if [[ "$MOODLE_DOCKER_APP_RUNTIME" = "ionic5" ]];
then
export MOODLE_DOCKER_APP_PORT="80"
export MOODLE_DOCKER_APP_INTERNAL_PORT="80"
else
export MOODLE_DOCKER_APP_PORT="443"
export MOODLE_DOCKER_APP_INTERNAL_PORT="443"
fi
fi

if [[ -z "$MOODLE_DOCKER_APP_PORT" ]];
then
export MOODLE_DOCKER_APP_PORT="8100"
fi

# Guess mobile app protocol
if [[ -z "$MOODLE_DOCKER_APP_PROTOCOL" ]];
then
Expand Down Expand Up @@ -146,10 +152,20 @@ then
if [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]];
then
dockercompose="${dockercompose} -f ${basedir}/moodle-app-dev.yml"

if [[ "$MOODLE_DOCKER_APP_PORT" != "0" ]];
then
dockercompose="${dockercompose} -f ${basedir}/moodle-app-dev-port.yml"
fi
elif [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]];
then
# Mobile app using a docker image
dockercompose="${dockercompose} -f ${basedir}/moodle-app.yml"

if [[ "$MOODLE_DOCKER_APP_PORT" != "0" ]];
then
dockercompose="${dockercompose} -f ${basedir}/moodle-app-port.yml"
fi
fi
fi

Expand Down
24 changes: 18 additions & 6 deletions bin/moodle-docker-compose.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,21 @@ IF "%MOODLE_DOCKER_APP_NODE_VERSION%"=="" (
)
)

REM Guess mobile app port (only when using Docker app images)
IF "%MOODLE_DOCKER_APP_PORT%"=="" (
IF "%MOODLE_DOCKER_APP_INTERNAL_PORT%"=="" (
IF NOT "%MOODLE_DOCKER_APP_VERSION%"=="" (
REM Guess mobile app port (only when using Docker app images)
IF "%MOODLE_DOCKER_APP_RUNTIME%"=="ionic5" (
SET MOODLE_DOCKER_APP_PORT=80
SET MOODLE_DOCKER_APP_INTERNAL_PORT=80
) ELSE (
SET MOODLE_DOCKER_APP_PORT=443
SET MOODLE_DOCKER_APP_INTERNAL_PORT=443
)
)
)

IF "%MOODLE_DOCKER_APP_PORT%"=="" (
SET MOODLE_DOCKER_APP_PORT=8100
)

REM Guess mobile app protocol
IF "%MOODLE_DOCKER_APP_PROTOCOL%"=="" (
if "%MOODLE_DOCKER_APP_RUNTIME%"=="ionic5" (
Expand Down Expand Up @@ -109,9 +113,17 @@ IF "%MOODLE_DOCKER_BROWSER_TAG%"=="" (

IF "%MOODLE_DOCKER_BROWSER_NAME%"=="chrome" (
IF NOT "%MOODLE_DOCKER_APP_PATH%"=="" (
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app-dev.yml"
IF NOT "%MOODLE_DOCKER_APP_PORT%"=="0" (
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app-dev.yml" -f "%BASEDIR%\moodle-app-dev-port.yml"
) ELSE (
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app-dev.yml"
)
) ELSE IF NOT "%MOODLE_DOCKER_APP_VERSION%"=="" (
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app.yml"
IF NOT "%MOODLE_DOCKER_APP_PORT%"=="0" (
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app.yml" -f "%BASEDIR%\moodle-app-port.yml"
) ELSE (
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app.yml"
)
)
)

Expand Down
6 changes: 6 additions & 0 deletions moodle-app-dev-port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
moodleapp:
ports:
- "$MOODLE_DOCKER_APP_PORT:8100"
- "35729:35729"
- "53703:53703"
4 changes: 0 additions & 4 deletions moodle-app-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ services:
- 8100
- 35729
- 53703
ports:
- "8100:8100"
- "35729:35729"
- "53703:53703"
4 changes: 4 additions & 0 deletions moodle-app-port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
moodleapp:
ports:
- "$MOODLE_DOCKER_APP_PORT:$MOODLE_DOCKER_APP_INTERNAL_PORT"
4 changes: 1 addition & 3 deletions moodle-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ services:
webserver:
environment:
MOODLE_DOCKER_APP: "true"
MOODLE_DOCKER_APP_PORT: ${MOODLE_DOCKER_APP_PORT}
MOODLE_DOCKER_APP_PORT: ${MOODLE_DOCKER_APP_INTERNAL_PORT}
MOODLE_DOCKER_APP_PROTOCOL: ${MOODLE_DOCKER_APP_PROTOCOL}
moodleapp:
image: "moodlehq/moodleapp:${MOODLE_DOCKER_APP_VERSION}"
ports:
- "8100:$MOODLE_DOCKER_APP_PORT"
Loading