DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
#!/bin/sh
|
2022-09-22 15:38:09 +02:00
|
|
|
#
|
|
|
|
# Moodle configuration script
|
|
|
|
#
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
set -eo pipefail
|
|
|
|
|
2022-09-22 15:38:09 +02:00
|
|
|
# Check that the database is available
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
echo "Waiting for $database:$port to be ready"
|
|
|
|
while ! nc -w 1 $DB_HOST $DB_PORT; do
|
|
|
|
# Show some progress
|
|
|
|
echo -n '.';
|
|
|
|
sleep 1;
|
|
|
|
done
|
|
|
|
echo "$database is ready"
|
2022-09-22 15:38:09 +02:00
|
|
|
# Give it another 3 seconds.
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
sleep 3;
|
|
|
|
|
|
|
|
|
2022-09-22 15:38:09 +02:00
|
|
|
# Check if the config.php file exists
|
|
|
|
if [ ! -f /var/www/html/config.php ]; then
|
|
|
|
# TODO: Why is this image even using the src/rootfs dir? Just for cron?
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
curl --location https://github.com/moodle/moodle/archive/$MOODLE_VERSION.tar.gz | tar xz --strip-components=1 -C /var/www/html/
|
|
|
|
cp /isinstalled.php /var/www/html/admin/cli/
|
|
|
|
chown nobody:root /var/www/html -R
|
|
|
|
|
|
|
|
echo "Generating config.php file..."
|
|
|
|
ENV_VAR='var' php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/install.php \
|
|
|
|
--lang=$MOODLE_LANGUAGE \
|
|
|
|
--wwwroot=$SITE_URL \
|
|
|
|
--dataroot=/var/www/moodledata/ \
|
|
|
|
--dbtype=$DB_TYPE \
|
|
|
|
--dbhost=$DB_HOST \
|
|
|
|
--dbname=$DB_NAME \
|
|
|
|
--dbuser=$DB_USER \
|
|
|
|
--dbpass=$DB_PASS \
|
|
|
|
--dbport=$DB_PORT \
|
|
|
|
--prefix=$DB_PREFIX \
|
|
|
|
--fullname="$MOODLE_SITENAME" \
|
|
|
|
--shortname="$MOODLE_SHORTSITENAME" \
|
|
|
|
--adminuser=$MOODLE_USERNAME \
|
|
|
|
--adminpass=$MOODLE_PASSWORD \
|
|
|
|
--adminemail=$MOODLE_EMAIL \
|
|
|
|
--non-interactive \
|
|
|
|
--agree-license \
|
|
|
|
--skip-database
|
|
|
|
|
|
|
|
if [ "$SSLPROXY" = 'true' ]; then
|
|
|
|
sed -i '/require_once/i $CFG->sslproxy=true;' /var/www/html/config.php
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2022-09-22 15:38:09 +02:00
|
|
|
# Check if the database is already installed
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
if php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/isinstalled.php ; then
|
|
|
|
|
|
|
|
echo "Installing database..."
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/install_database.php \
|
|
|
|
--lang=$MOODLE_LANGUAGE \
|
|
|
|
--adminuser=$MOODLE_USERNAME \
|
|
|
|
--adminpass=$MOODLE_PASSWORD \
|
|
|
|
--adminemail=$MOODLE_EMAIL \
|
|
|
|
--fullname="$MOODLE_SITENAME" \
|
|
|
|
--shortname="$MOODLE_SHORTSITENAME" \
|
|
|
|
--agree-license
|
|
|
|
|
|
|
|
echo "Configuring settings..."
|
2022-09-22 15:38:09 +02:00
|
|
|
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=slasharguments --set=0
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtophp --set=/usr/bin/php
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtodu --set=/usr/bin/du
|
2022-09-22 15:38:09 +02:00
|
|
|
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=aspellpath --set=/usr/bin/aspell
|
|
|
|
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtodot --set=/usr/bin/dot
|
|
|
|
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtogs --set=/usr/bin/gs
|
|
|
|
# php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=pathtopython --set=/usr/bin/python3
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=enableblogs --set=0
|
|
|
|
|
|
|
|
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=smtphosts --set=$SMTP_HOST:$SMTP_PORT
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=smtpuser --set=$SMTP_USER
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=smtppass --set=$SMTP_PASSWORD
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=smtpsecure --set=$SMTP_PROTOCOL
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=noreplyaddress --set=$MOODLE_MAIL_NOREPLY_ADDRESS
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/cfg.php --name=emailsubjectprefix --set=$MOODLE_MAIL_PREFIX
|
|
|
|
|
2022-09-22 15:38:09 +02:00
|
|
|
elif false; then
|
|
|
|
echo "Upgrading moodle..."
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/maintenance.php --enable
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/upgrade.php --non-interactive --allow-unstable
|
|
|
|
php -d max_input_vars=$max_input_vars /var/www/html/admin/cli/maintenance.php --disable
|
|
|
|
fi
|
DD education workspace
DD is the education workspace generated within the framework of Xnet's
Democratic Digitalisation Plan. It has been created and powered by Xnet,
families and promoting centres, IsardVDI, 3iPunt, MaadiX, eXO.cat,
Evilham and funded by the Directorate for Democratic Innovation, the
Barcelona City Council's Digital Innovation Commissioner, Social Economy
Commissioner, in collaboration with the Barcelona Education Consortium,
aFFaC and AirVPN.
DD can be used freely as long as this footer is included and the AGPLv3
license (https://www.gnu.org/licenses/agpl-3.0.en.html) is respected.
Trobareu meś informació en català a la documentació:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.ca/).
Más información en castellano en la documentación:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/index.es/).
More info in English in the documentation:
[https://dd.digitalitzacio-democratica.xnet-x.net/docs/](https://dd.digitalitzacio-democratica.xnet-x.net/docs/).
We thank the help of Miriam Carles, Cristian Ruiz, Anna Francàs,
Christopher Millard.
2022-07-10 12:15:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|