Skip to content
Closed
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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Moodle - Course Management System
Moodle 5.x - Course Management System
=================================

`Moodle`_ is a popular e-learning software platform, also known as a
Expand Down
8 changes: 8 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
turnkey-moodle5-18.1 (1) turnkey; urgency=low

* Install latest upstream version of Moodle 5.x: 5.1+ (as of today,
download via git branch MOODLE_501_STABLE).

* Set correct permissions and creating (eventually) missing folders.


turnkey-moodle-18.0 (1) turnkey; urgency=low

* Install latest upstream version of Moodle: 4.3.0+ (as of today,
Expand Down
49 changes: 26 additions & 23 deletions conf.d/main
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#!/bin/bash -ex

# REFERENCE: https://docs.moodle.org/501/en/Git_for_Administrators

MOODLE_BRANCH="MOODLE_501_STABLE"

# Determine Moodle version from branch
if [[ "$MOODLE_BRANCH" == *"MOODLE_4"* ]]; then
MOODLE_VERSION="4"
elif [[ "$MOODLE_BRANCH" == *"MOODLE_5"* ]]; then
MOODLE_VERSION="5"
else
MOODLE_VERSION="5"
fi

WEBROOT=/var/www/moodle
DATAROOT=/var/www/moodledata
MOOSHROOT=/var/www/moosh
DATAROOT=/var/moodledata

DB_NAME=moodle
DB_USER=moodle
Expand Down Expand Up @@ -34,26 +46,18 @@ a2enmod headers
sed -Ei "/max_input_vars/ s|^;?(max_input_vars =).*|\1 5000|" /etc/php/8.2/apache2/php.ini
sed -Ei "/max_input_vars/ s|^;?(max_input_vars =).*|\1 5000|" /etc/php/8.2/cli/php.ini

cd $(dirname $MOOSHROOT)
git clone https://github.com/tmuras/moosh.git
cd $MOOSHROOT
chown -R www-data:www-data $MOOSHROOT
if [[ -n "$GITHUB_USER_TOKEN" ]]; then
turnkey-composer config github-oauth.github.com $GITHUB_USER_TOKEN
else
echo "WARNING: GITHUB_USER_TOKEN not set, build may fail" >&2
fi
turnkey-composer install
ln -s $MOOSHROOT/moosh.php /usr/local/bin/moosh
# download latest moodle with git
git clone git://git.moodle.org/moodle.git $WEBROOT
cd $WEBROOT
git branch --track $MOODLE_BRANCH origin/$MOODLE_BRANCH
git checkout $MOODLE_BRANCH

# download latest moodle with moosh, then unpack
cd $(dirname $WEBROOT)
moosh download-moodle
tar -C $(dirname $WEBROOT) -zxf moodle-*.tgz
rm -f moodle-*.tgz
chown -R root:root $WEBROOT
# create the data folder to ser permissions
mkdir $DATAROOT

# using UncleDan script to fix permissions
/usr/bin/moodle-perms-bookworm.sh --fix

cd $WEBROOT
php admin/cli/install.php \
--chmod=750 \
--lang=en \
Expand All @@ -74,9 +78,8 @@ php admin/cli/install.php \
--non-interactive \
--agree-license

chown -R www-data:www-data $DATAROOT
chown -R www-data:www-data /var/www/moodle/theme
chown root:www-data $WEBROOT/config.php
# reset permissions using UncleDan script just in case...
/usr/bin/moodle-perms-bookworm.sh --fix

## tweak config

Expand Down
6 changes: 3 additions & 3 deletions overlay/etc/apache2/sites-available/moodle.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ErrorDocument 403 /error/index.php?code=404
<VirtualHost *:80>
UseCanonicalName Off
ServerAdmin webmaster@localhost
DocumentRoot /var/www/moodle/
DocumentRoot /var/www/moodle/public/
RewriteEngine On
RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{REMOTE_ADDR} !=127.0.0.1
Expand All @@ -19,7 +19,7 @@ ErrorDocument 403 /error/index.php?code=404
<VirtualHost *:443>
SSLEngine on
ServerAdmin webmaster@localhost
DocumentRoot /var/www/moodle/
DocumentRoot /var/www/moodle/public/
RewriteEngine On
RewriteRule "(\/vendor\/)" - [F]
RewriteRule "(\/node_modules\/)" - [F]
Expand All @@ -38,7 +38,7 @@ ErrorDocument 403 /error/index.php?code=404
RewriteRule "(\/behat\/)" - [F]
</VirtualHost>

<Directory /var/www/moodle/>
<Directory /var/www/moodle/public/>
Options +FollowSymLinks -Indexes
AllowOverride All
Require all granted
Expand Down
Loading