├── .gitignore
├── .gitattributes
├── db.mariadb.port.yml
├── db.mssql.port.yml
├── db.mysql.port.yml
├── db.oracle.port.yml
├── db.pgsql.port.yml
├── bbb-mock.yml
├── matrix-mock.yml
├── webserver.port.yml
├── mlbackend.yml
├── db.oracle.yml
├── behat-faildump.yml
├── volumes-cached.yml
├── selenium.debug.yml
├── selenium.chrome.yml
├── db.pgsql.yml
├── service.mail.yml
├── db.mssql.yml
├── tests
├── integration-teardown.sh
├── behat-teardown.sh
├── integration-setup.sh
├── app-teardown.sh
├── phpunit-teardown.sh
├── phpunit-test.sh
├── behat-test.sh
├── app-test.sh
├── behat-setup.sh
├── phpunit-setup.sh
├── integration-test.sh
└── app-setup.sh
├── db.mysql.5.6.yml
├── db.mysql.5.7.yml
├── .github
└── workflows
│ ├── auto-author-assign.yml
│ └── ci.yml
├── moodle-app.yml
├── assets
├── exttests
│ ├── apache2_ports.conf
│ └── apache2.conf
├── web
│ ├── apache2_mailpit.conf
│ └── apache2_faildumps.conf
└── appbehattests
│ └── app.feature
├── phpunit-external-services.yml
├── db.mysql.yml
├── moodle-app-dev.yml
├── db.mariadb.yml
├── bin
├── moodle-docker-wait-for-app
├── moodle-docker-wait-for-db
├── moodle-docker-compose.cmd
└── moodle-docker-compose
├── base.yml
├── .gitpod
└── setup-env.sh
├── .gitpod.yml
├── config.docker-template.php
├── README.md
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | local.yml
2 | /moodle/
3 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | bin/moodle-docker-compose.cmd eol=crlf
2 |
--------------------------------------------------------------------------------
/db.mariadb.port.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | ports:
4 | - "${MOODLE_DOCKER_DB_PORT}:3306/tcp"
5 |
--------------------------------------------------------------------------------
/db.mssql.port.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | ports:
4 | - "${MOODLE_DOCKER_DB_PORT}:1433/tcp"
5 |
--------------------------------------------------------------------------------
/db.mysql.port.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | ports:
4 | - "${MOODLE_DOCKER_DB_PORT}:3306/tcp"
5 |
--------------------------------------------------------------------------------
/db.oracle.port.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | ports:
4 | - "${MOODLE_DOCKER_DB_PORT}:1521/tcp"
5 |
--------------------------------------------------------------------------------
/db.pgsql.port.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | ports:
4 | - "${MOODLE_DOCKER_DB_PORT}:5432/tcp"
5 |
--------------------------------------------------------------------------------
/bbb-mock.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_BBB_MOCK: "true"
5 | bbbmock:
6 | image: moodlehq/bigbluebutton_mock
7 |
--------------------------------------------------------------------------------
/matrix-mock.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_MATRIX_MOCK: "true"
5 | matrixmock:
6 | image: moodlehq/matrixsynapse_mock
7 |
--------------------------------------------------------------------------------
/webserver.port.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_WEB_PORT: "${MOODLE_DOCKER_WEB_PORT}"
5 | ports:
6 | - "${MOODLE_DOCKER_WEB_PORT}:80"
7 |
--------------------------------------------------------------------------------
/mlbackend.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_MLBACKEND: "true"
5 | mlbackendpython:
6 | image: moodlehq/moodle-mlbackend-python:3.0.5-python3.7.5
7 |
--------------------------------------------------------------------------------
/db.oracle.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_DBTYPE: oci
5 | MOODLE_DOCKER_DBNAME: XE
6 | db:
7 | image: moodlehq/moodle-db-oracle-r2:${MOODLE_DOCKER_DB_VERSION:-21}
8 |
--------------------------------------------------------------------------------
/behat-faildump.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | volumes:
4 | - "${MOODLE_DOCKER_BEHAT_FAILDUMP}:/var/www/behatfaildumps"
5 | environment:
6 | MOODLE_DOCKER_BEHAT_FAILDUMP: "${MOODLE_DOCKER_BEHAT_FAILDUMP}"
7 |
--------------------------------------------------------------------------------
/volumes-cached.yml:
--------------------------------------------------------------------------------
1 | # Here we support https://docs.docker.com/docker-for-mac/osxfs-caching/
2 | # for improved performance on mac
3 | services:
4 | webserver:
5 | volumes:
6 | - "${MOODLE_DOCKER_WWWROOT}:/var/www/html:cached"
7 |
--------------------------------------------------------------------------------
/selenium.debug.yml:
--------------------------------------------------------------------------------
1 | services:
2 | selenium:
3 | ports:
4 | - "${MOODLE_DOCKER_SELENIUM_VNC_PORT}:5900"
5 | environment:
6 | # Workaround for https://github.com/SeleniumHQ/docker-selenium/issues/227
7 | "no_proxy": localhost
8 |
--------------------------------------------------------------------------------
/selenium.chrome.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_BROWSER: chrome
5 | selenium:
6 | image: "selenium/standalone-chrome${MOODLE_DOCKER_SELENIUM_SUFFIX:-}:${MOODLE_DOCKER_BROWSER_TAG}"
7 | volumes:
8 | - /dev/shm:/dev/shm
9 |
--------------------------------------------------------------------------------
/db.pgsql.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_DBTYPE: pgsql
5 | db:
6 | image: postgres:${MOODLE_DOCKER_DB_VERSION:-16}
7 | environment:
8 | POSTGRES_USER: moodle
9 | POSTGRES_PASSWORD: "m@0dl3ing"
10 | POSTGRES_DB: moodle
11 |
--------------------------------------------------------------------------------
/service.mail.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | volumes:
4 | - "${ASSETDIR}/web/apache2_mailpit.conf:/etc/apache2/conf-enabled/apache2_mailpit.conf"
5 | depends_on:
6 | - mailpit
7 | mailpit:
8 | image: axllent/mailpit:v1.10
9 | environment:
10 | MP_WEBROOT: /_/mail/
11 |
--------------------------------------------------------------------------------
/db.mssql.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_DBTYPE: sqlsrv
5 | MOODLE_DOCKER_DBUSER: sa
6 | db:
7 | image: moodlehq/moodle-db-mssql:${MOODLE_DOCKER_DB_VERSION:-latest}
8 | environment:
9 | ACCEPT_EULA: "y"
10 | SA_PASSWORD: "m@0dl3ing"
11 |
--------------------------------------------------------------------------------
/tests/integration-teardown.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5 |
6 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
7 | export MOODLE_DOCKER_DB=pgsql
8 |
9 | echo "Stopping down container"
10 | $basedir/bin/moodle-docker-compose down
11 |
--------------------------------------------------------------------------------
/db.mysql.5.6.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | image: mysql:${MOODLE_DOCKER_DB_VERSION:-5.6}
4 | command: >
5 | --character-set-server=utf8mb4
6 | --collation-server=utf8mb4_bin
7 | --innodb_file_format=barracuda
8 | --innodb_file_per_table=On
9 | --innodb_large_prefix=On
10 |
--------------------------------------------------------------------------------
/db.mysql.5.7.yml:
--------------------------------------------------------------------------------
1 | services:
2 | db:
3 | image: mysql:${MOODLE_DOCKER_DB_VERSION:-5.7}
4 | command: >
5 | --character-set-server=utf8mb4
6 | --collation-server=utf8mb4_bin
7 | --innodb_file_format=barracuda
8 | --innodb_file_per_table=On
9 | --innodb_large_prefix=On
10 |
--------------------------------------------------------------------------------
/.github/workflows/auto-author-assign.yml:
--------------------------------------------------------------------------------
1 | name: Auto Author Assign
2 |
3 | on:
4 | pull_request_target:
5 | types: [ opened, reopened ]
6 |
7 | permissions:
8 | pull-requests: write
9 |
10 | jobs:
11 | assign-author:
12 | name: Auto assign PR
13 | runs-on: ubuntu-latest
14 | steps:
15 | - uses: toshimaru/auto-author-assign@v2.1.0
16 |
--------------------------------------------------------------------------------
/moodle-app.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_APP: "true"
5 | MOODLE_DOCKER_APP_PORT: ${MOODLE_DOCKER_APP_PORT}
6 | MOODLE_DOCKER_APP_PROTOCOL: ${MOODLE_DOCKER_APP_PROTOCOL}
7 | moodleapp:
8 | image: "moodlehq/moodleapp:${MOODLE_DOCKER_APP_VERSION}"
9 | ports:
10 | - "8100:$MOODLE_DOCKER_APP_PORT"
11 |
--------------------------------------------------------------------------------
/tests/behat-teardown.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
4 |
5 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
6 |
7 | if [ "$SUITE" = "behat" ];
8 | then
9 | echo
10 | else
11 | echo "Error, unknown suite '$SUITE'"
12 | exit 1
13 | fi
14 |
15 | echo "Stopping down container"
16 | $basedir/bin/moodle-docker-compose down
17 |
--------------------------------------------------------------------------------
/assets/exttests/apache2_ports.conf:
--------------------------------------------------------------------------------
1 | # If you just change the port or add more ports here, you will likely also
2 | # have to change the VirtualHost statement in
3 | # /etc/apache2/sites-enabled/000-default.conf
4 |
5 | Listen 9000
6 |
7 |
8 | Listen 9443
9 |
10 |
11 |
12 | Listen 9443
13 |
14 |
15 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
16 |
--------------------------------------------------------------------------------
/tests/integration-setup.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5 |
6 | export MOODLE_DOCKER_DB=pgsql
7 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
8 |
9 | echo "Pulling docker images"
10 | $basedir/bin/moodle-docker-compose pull
11 | echo "Starting up container"
12 | $basedir/bin/moodle-docker-compose up -d
13 | echo "Waiting for DB to come up"
14 | $basedir/bin/moodle-docker-wait-for-db
15 |
--------------------------------------------------------------------------------
/phpunit-external-services.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_PHPUNIT_EXTRAS: "true"
5 | memcached0:
6 | image: memcached:1.4
7 | memcached1:
8 | image: memcached:1.4
9 | mongo:
10 | image: mongo:4.0
11 | redis:
12 | image: redis:5
13 | solr:
14 | image: solr:6.5
15 | entrypoint:
16 | - docker-entrypoint.sh
17 | - solr-precreate
18 | - test
19 | ldap:
20 | image: larrycai/openldap
21 |
--------------------------------------------------------------------------------
/db.mysql.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_DBTYPE: mysqli
5 | MOODLE_DOCKER_DBCOLLATION: utf8mb4_bin
6 | db:
7 | image: mysql:${MOODLE_DOCKER_DB_VERSION:-8.4}
8 | command: >
9 | --character-set-server=utf8mb4
10 | --collation-server=utf8mb4_bin
11 | --skip-log-bin
12 | environment:
13 | MYSQL_ROOT_PASSWORD: "m@0dl3ing"
14 | MYSQL_USER: moodle
15 | MYSQL_PASSWORD: "m@0dl3ing"
16 | MYSQL_DATABASE: moodle
17 |
--------------------------------------------------------------------------------
/tests/app-teardown.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
4 |
5 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
6 | export MOODLE_DOCKER_BROWSER="chrome"
7 | export MOODLE_DOCKER_DB=pgsql
8 |
9 | if [ "$SUITE" = "app-development" ];
10 | then
11 | export MOODLE_DOCKER_APP_PATH="${basedir}/app"
12 | elif [ "$SUITE" != "app" ];
13 | then
14 | echo "Error, unknown suite '$SUITE'"
15 | exit 1
16 | fi
17 |
18 | echo "Stopping down container"
19 | $basedir/bin/moodle-docker-compose down
20 |
--------------------------------------------------------------------------------
/tests/phpunit-teardown.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
4 |
5 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
6 |
7 | rm -f $basedir/moodle/local/moodleappbehat/tests/behat/app.feature
8 |
9 | if [ "$SUITE" = "phpunit" ];
10 | then
11 | echo
12 | elif [ "$SUITE" = "phpunit-full" ];
13 | then
14 | export MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES=true
15 | else
16 | echo "Error, unknown suite '$SUITE'"
17 | exit 1
18 | fi
19 |
20 | echo "Stopping down container"
21 | $basedir/bin/moodle-docker-compose down
22 |
--------------------------------------------------------------------------------
/moodle-app-dev.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_APP: "true"
5 | MOODLE_DOCKER_APP_PROTOCOL: ${MOODLE_DOCKER_APP_PROTOCOL}
6 | moodleapp:
7 | image: node:${MOODLE_DOCKER_APP_NODE_VERSION}
8 | working_dir: /app
9 | command: [ "bash", "-c", "git config --global --add safe.directory /app && npm start -- --host 0.0.0.0"]
10 | volumes:
11 | - "${MOODLE_DOCKER_APP_PATH}:/app"
12 | expose:
13 | - 8100
14 | - 35729
15 | - 53703
16 | ports:
17 | - "8100:8100"
18 | - "35729:35729"
19 | - "53703:53703"
20 |
--------------------------------------------------------------------------------
/tests/phpunit-test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5 |
6 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
7 |
8 | if [ "$SUITE" = "phpunit" ];
9 | then
10 | testcmd="bin/moodle-docker-compose exec -T webserver vendor/bin/phpunit --filter core_dml_testcase"
11 | elif [ "$SUITE" = "phpunit-full" ];
12 | then
13 | testcmd="bin/moodle-docker-compose exec -T webserver vendor/bin/phpunit"
14 | else
15 | echo "Error, unknown suite '$SUITE'"
16 | exit 1
17 | fi
18 |
19 | echo "Running: $testcmd"
20 | $basedir/$testcmd
21 |
--------------------------------------------------------------------------------
/db.mariadb.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | environment:
4 | MOODLE_DOCKER_DBTYPE: mariadb
5 | MOODLE_DOCKER_DBCOLLATION: utf8mb4_bin
6 | db:
7 | image: mariadb:${MOODLE_DOCKER_DB_VERSION:-10.11}
8 | command: >
9 | --character-set-server=utf8mb4
10 | --collation-server=utf8mb4_bin
11 | --innodb_file_per_table=On
12 | --wait-timeout=28800
13 | --skip-log-bin
14 | environment:
15 | MYSQL_ROOT_PASSWORD: "m@0dl3ing"
16 | MYSQL_USER: moodle
17 | MYSQL_PASSWORD: "m@0dl3ing"
18 | MYSQL_DATABASE: moodle
19 |
--------------------------------------------------------------------------------
/tests/behat-test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5 |
6 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
7 |
8 | if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
9 | then
10 | MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
11 | else
12 | MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
13 | fi
14 |
15 | if [ "$SUITE" = "behat" ];
16 | then
17 | testcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/run.php --tags=@auth_manual"
18 | else
19 | echo "Error, unknown suite '$SUITE'"
20 | exit 1
21 | fi
22 |
23 | echo "Running: $testcmd"
24 | $basedir/$testcmd
25 |
--------------------------------------------------------------------------------
/bin/moodle-docker-wait-for-app:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | thisfile=$( readlink "${BASH_SOURCE[0]}" ) || thisfile="${BASH_SOURCE[0]}"
5 | basedir="$( cd "$( dirname "$thisfile" )/../" && pwd -P )"
6 |
7 | if [[ ! -z "$MOODLE_DOCKER_BROWSER" ]] && [[ "$MOODLE_DOCKER_BROWSER" == "chrome" ]] && ([[ ! -z "$MOODLE_DOCKER_APP_PATH" ]] || [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]]);
8 | then
9 | until $basedir/bin/moodle-docker-compose logs moodleapp | grep -q -E 'dev server running: |Angular Live Development Server is listening|Configuration complete; ready for start up';
10 | do
11 | echo 'Waiting for Moodle app to come up...'
12 | sleep 15
13 | done
14 | fi
15 |
--------------------------------------------------------------------------------
/assets/web/apache2_mailpit.conf:
--------------------------------------------------------------------------------
1 |
2 | LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
3 |
4 |
5 |
6 | LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
7 |
8 |
9 |
10 | LoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so
11 |
12 |
13 | Redirect "/_/mail" "/_/mail/"
14 |
15 | ProxyPass "/_/mail/api/events" "ws://mailpit:8025/_/mail/api/events"
16 | ProxyPassReverse "/_/mail/api/events" "ws://mailpit:8025/_/mail/api/events"
17 |
18 | ProxyPass "/_/mail/" "http://mailpit:8025/_/mail/"
19 | ProxyPassReverse "/_/mail/" "http://mailpit:8025/_/mail/"
20 |
--------------------------------------------------------------------------------
/bin/moodle-docker-wait-for-db:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | thisfile=$( readlink "${BASH_SOURCE[0]}" ) || thisfile="${BASH_SOURCE[0]}"
5 | basedir="$( cd "$( dirname "$thisfile" )/../" && pwd -P )"
6 |
7 | if [ -z "$MOODLE_DOCKER_DB" ];
8 | then
9 | echo 'Error: $MOODLE_DOCKER_DB is not set'
10 | exit 1
11 | fi
12 |
13 | if [ "$MOODLE_DOCKER_DB" = "mssql" ];
14 | then
15 | $basedir/bin/moodle-docker-compose exec -T db /wait-for-mssql-to-come-up.sh
16 | elif [ "$MOODLE_DOCKER_DB" = "oracle" ];
17 | then
18 | until $basedir/bin/moodle-docker-compose logs db | grep -q 'DATABASE IS READY TO USE!';
19 | do
20 | echo 'Waiting for oracle to come up...'
21 | sleep 15
22 | done
23 | else
24 | sleep 10
25 | fi
26 |
--------------------------------------------------------------------------------
/tests/app-test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5 |
6 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
7 | export MOODLE_DOCKER_BROWSER=chrome
8 | export MOODLE_DOCKER_DB=pgsql
9 |
10 | if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
11 | then
12 | MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
13 | else
14 | MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
15 | fi
16 |
17 | if [ "$SUITE" = "app" ] || [ "$SUITE" = "app-development" ];
18 | then
19 | testcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/run.php --tags=@app&&@moodledocker"
20 | else
21 | echo "Error, unknown suite '$SUITE'"
22 | exit 1
23 | fi
24 |
25 | echo "Running: $testcmd"
26 | $basedir/$testcmd
27 |
--------------------------------------------------------------------------------
/tests/behat-setup.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
4 |
5 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
6 |
7 | if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
8 | then
9 | MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
10 | else
11 | MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
12 | fi
13 |
14 | if [ "$SUITE" = "behat" ];
15 | then
16 | initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/init.php"
17 | else
18 | echo "Error, unknown suite '$SUITE'"
19 | exit 1
20 | fi
21 |
22 | echo "Pulling docker images"
23 | $basedir/bin/moodle-docker-compose pull
24 | echo "Starting up container"
25 | $basedir/bin/moodle-docker-compose up -d
26 | echo "Waiting for DB to come up"
27 | $basedir/bin/moodle-docker-wait-for-db
28 | echo "Running: $initcmd"
29 | $basedir/$initcmd
30 |
--------------------------------------------------------------------------------
/assets/web/apache2_faildumps.conf:
--------------------------------------------------------------------------------
1 |
2 | Options +Indexes
3 | Require all granted
4 |
5 |
6 |
7 | FallbackResource disabled
8 |
9 |
10 | Alias /_/faildumps /var/www/behatfaildumps
11 |
12 | # Set the handler to use for files whose extension ends in `.php`.
13 | # This is a workaround for https://github.com/docker-library/php/issues/1576
14 | # The FallbackResource is a default Handler action which is only used if a Handler has not already been applied.
15 | # The docker/php image sets the handler unconditionally for any file whose name matches `.php`.
16 | # This configuration block unsets the default handler, and instead only applies it if the file exists.
17 |
18 | SetHandler none
19 |
20 | SetHandler application/x-httpd-php
21 |
22 |
23 |
--------------------------------------------------------------------------------
/assets/appbehattests/app.feature:
--------------------------------------------------------------------------------
1 | @javascript @app @moodledocker
2 | Feature: The app starts in behat
3 | In order to test that the app it working properly
4 | As moodle-docker
5 | I need a way to verify this
6 |
7 | Scenario: Start the app
8 | Given the following "users" exist:
9 | | username | firstname | lastname | email |
10 | | student1 | Student | 1 | student1@example.com |
11 | And the following "courses" exist:
12 | | fullname | shortname | category |
13 | | Course 1 | C1 | 0 |
14 | And the following "course enrolments" exist:
15 | | user | course | role |
16 | | student1 | C1 | student |
17 | And the following "activities" exist:
18 | | activity | course | idnumber | name | intro |
19 | | label | C1 | label1 | Label 1 | It worked great |
20 | When I entered the course "Course 1" as "student1" in the app
21 | Then I should find "It worked great" in the app
22 |
--------------------------------------------------------------------------------
/base.yml:
--------------------------------------------------------------------------------
1 | services:
2 | webserver:
3 | image: "moodlehq/moodle-php-apache:${MOODLE_DOCKER_PHP_VERSION}"
4 | depends_on:
5 | - db
6 | volumes:
7 | - "${MOODLE_DOCKER_WWWROOT}:/var/www/html"
8 | - "${ASSETDIR}/web/apache2_faildumps.conf:/etc/apache2/conf-enabled/moodle-faildump.conf"
9 | environment:
10 | MOODLE_DOCKER_RUNNING: 1
11 | MOODLE_DOCKER_DBNAME: moodle
12 | MOODLE_DOCKER_DBUSER: moodle
13 | MOODLE_DOCKER_DBPASS: "m@0dl3ing"
14 | MOODLE_DOCKER_BROWSER: firefox
15 | MOODLE_DOCKER_WEB_HOST: "${MOODLE_DOCKER_WEB_HOST}"
16 | MOODLE_DOCKER_TIMEOUT_FACTOR: "${MOODLE_DOCKER_TIMEOUT_FACTOR}"
17 | exttests:
18 | image: moodlehq/moodle-exttests
19 | volumes:
20 | - "${ASSETDIR}/exttests/apache2_ports.conf:/etc/apache2/ports.conf"
21 | - "${ASSETDIR}/exttests/apache2.conf:/etc/apache2/sites-enabled/000-default.conf"
22 | selenium:
23 | image: "selenium/standalone-firefox${MOODLE_DOCKER_SELENIUM_SUFFIX:-}:${MOODLE_DOCKER_BROWSER_TAG}"
24 | volumes:
25 | - "${MOODLE_DOCKER_WWWROOT}:/var/www/html:ro"
26 |
--------------------------------------------------------------------------------
/tests/phpunit-setup.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
4 |
5 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
6 |
7 | if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
8 | then
9 | MOODLE_PHPUNIT_CLI_ROOT="public/admin/tool/phpunit/cli"
10 | else
11 | MOODLE_PHPUNIT_CLI_ROOT="admin/tool/phpunit/cli"
12 | fi
13 |
14 | if [ "$SUITE" = "phpunit" ];
15 | then
16 | initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_PHPUNIT_CLI_ROOT}/init.php"
17 | elif [ "$SUITE" = "phpunit-full" ];
18 | then
19 | export MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES=true
20 | export MOODLE_DOCKER_MLBACKEND=true
21 | initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_PHPUNIT_CLI_ROOT}/init.php"
22 | else
23 | echo "Error, unknown suite '$SUITE'"
24 | exit 1
25 | fi
26 |
27 | echo "Pulling docker images"
28 | $basedir/bin/moodle-docker-compose pull
29 | echo "Starting up container"
30 | $basedir/bin/moodle-docker-compose up -d
31 | echo "Waiting for DB to come up"
32 | $basedir/bin/moodle-docker-wait-for-db
33 | echo "Running: $initcmd"
34 | $basedir/$initcmd
35 |
--------------------------------------------------------------------------------
/.gitpod/setup-env.sh:
--------------------------------------------------------------------------------
1 | # Initialize variables to get Moodle code.
2 | if [ -z "$MOODLE_REPOSITORY" ];
3 | then
4 | export MOODLE_REPOSITORY=https://github.com/moodle/moodle.git
5 | fi
6 | if [ -z "$MOODLE_BRANCH" ];
7 | then
8 | export MOODLE_BRANCH=main
9 | fi
10 |
11 | if [ -z "$CLONEALL" ];
12 | then
13 | FASTCLONE='--depth 1'
14 | else
15 | FASTCLONE=""
16 | fi
17 |
18 | # Clone Moodle repository.
19 | cd "${GITPOD_REPO_ROOT}" && git clone ${FASTCLONE} --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle
20 |
21 | if [ -d "moodle/public" ];
22 | then
23 | MOODLE_PUBLIC_ROOT="moodle/public"
24 | else
25 | MOODLE_PUBLIC_ROOT="moodle"
26 | fi
27 |
28 | # Download the data file (if given). It will be used to generate some data.
29 | if [ -n "$DATAFILE" ];
30 | then
31 | wget -O ${MOODLE_PUBLIC_ROOT}/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}"
32 | fi
33 |
34 | # Install adminer.
35 | if [ -n "$INSTALLADMINER" ];
36 | then
37 | cat << EOF > local.yml
38 | services:
39 |
40 | adminer:
41 | image: adminer:latest
42 | restart: always
43 | ports:
44 | - 8080:8080
45 | depends_on:
46 | - "db"
47 | EOF
48 | fi
49 |
--------------------------------------------------------------------------------
/assets/exttests/apache2.conf:
--------------------------------------------------------------------------------
1 |
2 | # The ServerName directive sets the request scheme, hostname and port that
3 | # the server uses to identify itself. This is used when creating
4 | # redirection URLs. In the context of virtual hosts, the ServerName
5 | # specifies what hostname must appear in the request's Host: header to
6 | # match this virtual host. For the default virtual host (this file) this
7 | # value is not decisive as it is used as a last resort host regardless.
8 | # However, you must set it for any further virtual host explicitly.
9 | #ServerName www.example.com
10 |
11 | ServerAdmin webmaster@localhost
12 | DocumentRoot /var/www/html
13 |
14 | # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
15 | # error, crit, alert, emerg.
16 | # It is also possible to configure the loglevel for particular
17 | # modules, e.g.
18 | #LogLevel info ssl:warn
19 |
20 | ErrorLog ${APACHE_LOG_DIR}/error.log
21 | CustomLog ${APACHE_LOG_DIR}/access.log combined
22 |
23 | # For most configuration files from conf-available/, which are
24 | # enabled or disabled at a global level, it is possible to
25 | # include a line for only one particular virtual host. For example the
26 | # following line enables the CGI configuration for this host only
27 | # after it has been globally disabled with "a2disconf".
28 | #Include conf-available/serve-cgi-bin.conf
29 |
30 |
31 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
32 |
--------------------------------------------------------------------------------
/tests/integration-test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5 |
6 | export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
7 | export MOODLE_DOCKER_DB=pgsql
8 |
9 | echo "Checking that PHP CLI is available"
10 |
11 | out=$("${basedir}/bin/moodle-docker-compose" exec -T webserver php -r 'echo "Up!";')
12 | if [[ ! "$out" =~ 'Up!' ]]; then
13 | echo "Error: PHP CLI isn't available"
14 | exit 1
15 | fi
16 |
17 | echo "Checking that the web server is up"
18 |
19 | if ! curl -s -f 'http://localhost:8000' > /dev/null; then
20 | echo "Error: Webserver not available in port 8000"
21 | exit 1
22 | fi
23 |
24 | echo "Checking that the Moodle site is ready to install"
25 |
26 | out=$(curl -s -L 'http://localhost:8000')
27 | if ! grep -qz 'Installation | Moodle ' <<< "$out"; then
28 | echo "Error: Moodle site not ready to install"
29 | exit 1
30 | fi
31 |
32 | echo "Checking that mailpit is up"
33 |
34 | if ! curl -s -f -L 'http://localhost:8000/_/mail' > /dev/null; then
35 | echo "Error: Mailpit not available @ http://localhost:8000/_/mail"
36 | exit 1
37 | fi
38 |
39 | echo "Checking that mailpit is using existing JS and CSS files"
40 |
41 | out=$(curl -s -L 'http://localhost:8000/_/mail')
42 | js=$(grep -oP '(?<=