-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunMoodle.sh
executable file
·71 lines (55 loc) · 2.61 KB
/
runMoodle.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# run ocis server before doing this
# sudo rm -rf moodle
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
# sudo rm -rf moodle-docker
cp -r moodle-repository_ocis/tests/behat moodle/repository/ocis/tests
git clone https://github.com/moodlehq/moodle-docker.git
cd moodle-docker
WWW_PATH=/home/sabin/www/moodle-ui-test-setup
export MOODLE_DOCKER_WWWROOT=/home/sabin/www/moodle-ui-test-setup/moodle
export MOODLE_DOCKER_DB=pgsql
export MOODLE_DOCKER_PHP_VERSION=8.1
export MOODLE_DOCKER_WEB_HOST=host.docker.internal
export MOODLE_DOCKER_WEB_PORT=8000
export MOODLE_DOCKER_SELENIUM_VNC_PORT=5900
export MOODLE_DOCKER_BROWSER=chrome:94.0
cp ../config.php $MOODLE_DOCKER_WWWROOT/config.php
cat > local.yml <<'EOF'
services:
webserver:
extra_hosts:
- host.docker.internal:host-gateway
environment:
MOODLE_DISABLE_CURL_SECURITY: "true" # optional, but useful for testing on localhost or host.docker.internal
MOODLE_OCIS_URL: "https://host.docker.internal:9200" # optional, used to create OAuth 2 services and repository instance during installation
MOODLE_OCIS_CLIENT_ID: "xdXOt13JKxym1B1QcEncf2XDkLAexMBFwiT9j6EfhhHFJhs2KM9jbjTmf8JBXE69" # optional, used to create OAuth 2 services and repository instance during installation
MOODLE_OCIS_CLIENT_SECRET: "UBntmLjC2yYCeHwsyj73Uwo9TAaecAetRwMw0xYcvNL9yRdLSUi0hUAHfvCHFeFh" # optional, used to create OAuth 2 services and repository instance during installation
EOF
if [[ "$1" == "down" ]];then
bin/moodle-docker-compose down -v
exit 0
fi
mkdir -p traefik/configs traefik/certificates
cat >> traefik/configs/tls.yml <<'EOF'
tls:
stores:
default:
defaultCertificate:
certFile: /certificates/server.crt
keyFile: /certificates/server.key
EOF
WWW_PATH=/home/sabin/www/moodle-ui-test-setup
# allow container to access docker host via 'host.docker.internal'
cp $MOODLE_DOCKER_WWWROOT/repository/ocis/tests/local.example.yml local.yml
bin/moodle-docker-compose up -d
bin/moodle-docker-compose cp ../../ocis.crt webserver:/usr/local/share/ca-certificates/
bin/moodle-docker-compose cp traefik/certificates/server.crt webserver:/usr/local/share/ca-certificates/
bin/moodle-docker-compose exec webserver update-ca-certificates
bin/moodle-docker-compose cp ../../ocis.crt selenium:/usr/local/share/ca-certificates/
bin/moodle-docker-compose cp traefik/certificates/server.crt selenium:/usr/local/share/ca-certificates/
bin/moodle-docker-compose exec selenium update-ca-certificates
bin/moodle-docker-wait-for-db
# Initialize behat environment
bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php