-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from kialo/moodle-4.5
Moodle 4.5 development setup
- Loading branch information
Showing
14 changed files
with
125 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
moodle/ | ||
moodle_mod/ | ||
.env | ||
|
||
## Bundle | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# See https://moodledev.io/general/development/policies/php for the list of available PHP versions. | ||
# Different versions of Moodle require different versions of PHP. | ||
ARG PHP_VERSION="8.1" | ||
|
||
FROM moodlehq/moodle-php-apache:${PHP_VERSION} | ||
|
||
# See https://moodledev.io/general/releases for the list of available versions. | ||
# See https://github.com/moodle/moodle/branches for the available branches. | ||
# Branch names follow the pattern MOODLE_XYZ_STABLE, e.g. MOODLE_404_STABLE for Moodle 4.4. | ||
# main is the default and most up-to-date branch, it includes upcoming versions before they are stable. | ||
ARG MOODLE_BRANCH="main" | ||
ENV MOODLE_BRANCH=${MOODLE_BRANCH} | ||
|
||
RUN git clone git://git.moodle.org/moodle.git /var/www/html --depth=1 --branch ${MOODLE_BRANCH} | ||
|
||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
COPY config.php /var/www/html/config_kialo.php | ||
|
||
ENTRYPOINT ["entrypoint.sh"] | ||
CMD ["apache2-foreground"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
// phpcs:ignoreFile | ||
// Custom Moodle configuration. Is appended to Moodle's own config.php. | ||
|
||
global $CFG; | ||
|
||
// Allow arbitrary hostname (by default it's hardcoded). | ||
if (empty($_SERVER['HTTP_HOST'])) { | ||
$_SERVER['HTTP_HOST'] = '127.0.0.1:8080'; | ||
} | ||
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { | ||
$CFG->wwwroot = 'https://' . $_SERVER['HTTP_HOST']; | ||
} else { | ||
$CFG->wwwroot = 'http://' . $_SERVER['HTTP_HOST']; | ||
} | ||
|
||
//========================================================================= | ||
// PHPUNIT SUPPORT | ||
//========================================================================= | ||
$CFG->phpunit_prefix = 'phpu_'; | ||
$CFG->phpunit_dataroot = '/var/www/moodledata/phpunit'; | ||
$CFG->phpunit_directorypermissions = 02777; // optional | ||
$CFG->phpunit_profilingenabled = true; // optional to profile PHPUnit runs. | ||
|
||
//========================================================================= | ||
// Custom settings for development | ||
//========================================================================= | ||
|
||
// Force a debugging mode regardless the settings in the site administration | ||
@error_reporting(E_ALL | E_STRICT); // NOT FOR PRODUCTION SERVERS! | ||
@ini_set('display_errors', '1'); // NOT FOR PRODUCTION SERVERS! | ||
$CFG->debug = (E_ALL | E_STRICT); // === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS! | ||
$CFG->debugdisplay = 1; // NOT FOR PRODUCTION SERVERS! | ||
|
||
// Make sure that the temp directories are not deleted during the backup process. Allows easier testing of the backup process. | ||
$CFG->keeptempdirectoriesonbackup = true; | ||
|
||
require_once(__DIR__ . '/lib/setup.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Install Moodle. See https://docs.moodle.org/404/en/Installing_Moodle#Command_line_installer | ||
chown -R www-data /var/www/html | ||
su - www-data -s /bin/bash -c "php /var/www/html/admin/cli/install.php --non-interactive --agree-license --allow-unstable --wwwroot=$MOODLE_HOST --dataroot=/var/www/moodledata --dbtype=mariadb --dbhost=$MOODLE_DATABASE_HOST --dbname=moodle --dbuser=moodle --dbport=$MOODLE_DATABASE_PORT_NUMBER --fullname=Moodle --shortname=moodle --adminuser=user --adminpass=$MOODLE_PASSWORD [email protected] [email protected]" | ||
|
||
# Amend the config.php file to include our own config for development. | ||
# The line should be added before the last line "require_once(__DIR__ . '/lib/setup.php');". | ||
sed -i '/require_once/i\require_once(__DIR__ . "/config_kialo.php");' /var/www/html/config.php | ||
|
||
exec /usr/local/bin/moodle-docker-php-entrypoint "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,6 @@ | ||
# Ensure this script is executed in the same folder | ||
cd "$(dirname "$0")" | ||
|
||
# Ensure the directory exists | ||
mkdir -p ./moodle/mod/kialo | ||
|
||
# syncs the content of the development version of this plugin to the copy in the docker moodle installation (/moodle/mod/kialo) | ||
rsync -atm --delete --delete-excluded --exclude={'/development','/.[!.]*'} .. ./moodle/mod/kialo | ||
rsync -atm --delete --delete-excluded --exclude={'/development','/.[!.]*'} .. ./moodle_mod | ||
echo "Synced plugin." | ||
|
||
cp config/config.php moodle/config.php | ||
echo "Synced config.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# needs to run once initially and again whenever new tests are added | ||
docker exec -i development-moodle-1 /bin/bash -c "cd /bitnami/moodle; php admin/tool/phpunit/cli/init.php" | ||
docker exec -i mod_kialo-moodle-1 /bin/bash -c "cd /var/www/html; php admin/tool/phpunit/cli/init.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# Ensure files are up-to-date | ||
./sync.sh | ||
|
||
# Run the tests | ||
docker exec -i development-moodle-1 /bin/bash -c "cd /bitnami/moodle; vendor/bin/phpunit --testsuite core_privacy_testsuite --filter kialo" | ||
docker exec -i mod_kialo-moodle-1 /bin/bash -c "cd /var/www/html; vendor/bin/phpunit --testsuite core_privacy_testsuite --filter kialo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# Ensure files are up-to-date | ||
./sync.sh | ||
|
||
# Run the tests | ||
docker exec -i development-moodle-1 /bin/bash -c "cd /bitnami/moodle; vendor/bin/phpunit --testsuite mod_kialo_testsuite" | ||
docker exec -i mod_kialo-moodle-1 /bin/bash -c "cd /var/www/html; vendor/bin/phpunit --testsuite mod_kialo_testsuite" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Ensure files are up-to-date | ||
./sync.sh | ||
|
||
# Run a specific test file (path relative to mod/kialo/tests) | ||
# Example: ./tests-run.sh classes/mod_kialo_test.php | ||
docker exec -i development-moodle-1 /bin/bash -c "cd /bitnami/moodle; vendor/bin/phpunit mod/kialo/tests/$1" | ||
docker exec -i mod_kialo-moodle-1 /bin/bash -c "cd /var/www/html; vendor/bin/phpunit mod/kialo/tests/$1" |