Skip to content

Commit 1534244

Browse files
committed
MOODLE_DOCKER_SELENIUM_VNC_PORT to control both bind_ip and port #66
This solves #64 Truth table: not set (dflt) ==> 0 (means no vnc server is started) 0 ==> 0 (means no vnc server is started) 999 ==> 127.0.0.1:999 0.0.0.0:999 ==> 0.0.0.0.999
1 parent 1cc9a7a commit 1534244

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ You can change the configuration of the docker images by setting various environ
133133
| `MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES` | no | any value | not set | If set, dependencies for memcached, redis, solr, and openldap are added |
134134
| `MOODLE_DOCKER_WEB_HOST` | no | any valid hostname | localhost | The hostname for web |
135135
| `MOODLE_DOCKER_WEB_PORT` | no | any integer value (or bind_ip:integer)| 127.0.0.1:8000| The port number for web. If set to 0, no port is used.<br/>If you want to bind to any host IP different from the default 127.0.0.1, you can specify it with the bind_ip:port format (0.0.0.0 means bind to all) |
136-
| `MOODLE_DOCKER_SELENIUM_VNC_PORT` | no | any integer value | not set | If set, the selenium node will expose a vnc session on the port specified |
136+
| `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 |
137137

138138
## Advanced usage
139139

bin/moodle-docker-compose

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,16 @@ then
5050
dockercompose="${dockercompose} -f ${basedir}/selenium.${MOODLE_DOCKER_BROWSER}.yml"
5151
fi
5252

53-
if [[ -z "$MOODLE_DOCKER_SELENIUM_VNC_PORT" ]]
53+
# Selenium VNC port
54+
export MOODLE_DOCKER_SELENIUM_SUFFIX=""
55+
if [[ $MOODLE_DOCKER_SELENIUM_VNC_PORT == *":"* ]] || [[ $MOODLE_DOCKER_SELENIUM_VNC_PORT -gt 0 ]]
5456
then
55-
export MOODLE_DOCKER_SELENIUM_SUFFIX=""
56-
else
5757
export MOODLE_DOCKER_SELENIUM_SUFFIX="-debug"
58+
# If no bind ip has been configured (bind_ip:port), default to 127.0.0.1
59+
if [[ ! $MOODLE_DOCKER_SELENIUM_VNC_PORT == *":"* ]]
60+
then
61+
MOODLE_DOCKER_SELENIUM_VNC_PORT=127.0.0.1:$MOODLE_DOCKER_SELENIUM_VNC_PORT
62+
fi
5863
dockercompose="${dockercompose} -f ${basedir}/selenium.debug.yml"
5964
fi
6065

bin/moodle-docker-compose.cmd

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,17 @@ IF DEFINED TRUE (
6666
IF "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="" (
6767
SET MOODLE_DOCKER_SELENIUM_SUFFIX=
6868
) ELSE (
69-
SET MOODLE_DOCKER_SELENIUM_SUFFIX=-debug
70-
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\selenium.debug.yml"
69+
SET "TRUE="
70+
IF NOT "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="%MOODLE_DOCKER_SELENIUM_VNC_PORT::=%" SET TRUE=1
71+
IF NOT "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="0" SET TRUE=1
72+
IF DEFINED TRUE (
73+
SET MOODLE_DOCKER_SELENIUM_SUFFIX=-debug
74+
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\selenium.debug.yml"
75+
REM If no bind ip has been configured (bind_ip:port), default to 127.0.0.1
76+
IF "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="%MOODLE_DOCKER_SELENIUM_VNC_PORT::=%" (
77+
SET MOODLE_DOCKER_SELENIUM_VNC_PORT=127.0.0.1:%MOODLE_DOCKER_SELENIUM_VNC_PORT%
78+
)
79+
)
7180
)
7281

7382
%DOCKERCOMPOSE% %*

0 commit comments

Comments
 (0)