Sign inSign up

venatorfox/moodle

By venatorfox

•Updated over 6 years ago

Moodle with container plugin install support via docker -e. Red Hat/CentOS SCL. s6 Overlay.

Image
3

10K+

venatorfox/moodle repository overview

Pulls on Docker Hub Stars on Docker Hub GitHub Open Issues License: MIT

Supported tags and respective Dockerfile links

Depreciated builds are not recommended, as they are EOL.

⁠NOTICE: The container overhaul to CentOS⁠ changes the location of moodledata. It is now located in /var/moodledata. Please update persistent mounts if upgrading. This is as of the MOODLE_37_STABLE build. Depreciated builds (3.4.1+ and below) use /var/www/moodledata.

Now with plugin support via docker -e!

⁠How to use this image

Example: To startup a super basic, unconfigured local install with default values, no ssl.

Create a docker network moodle-network

docker network create moodle-network

Start a postgres server instance from the official postgres repository

| If mysql is desired, use the 2nd example further below.

docker run --rm -d --name moodle-postgres \
           --network moodle-network \
           --env POSTGRES_USER=moodle \
           --env POSTGRES_PASSWORD=moodle \
           --env POSTGRES_DB=moodle \
           postgres:11.4

Then start a venatorfox/moodle instance, expose port 80.

docker run --rm -d --name some-moodle \
           --network moodle-network \
           --env MOODLE_WWWROOT=http://localhost \
           --publish 80:80 \
           venatorfox/moodle:MOODLE_38_STABLE
⁠MySQL Variant

Example: Same thing as above, but for mySQL instead of Postgres. Postgres is however recommended as per Moodle docs⁠. Please note that brand new installs of MySQL 8 will require a workaround⁠ to avoid authentication issues. Upgrades from MySQL 5 to 8 carries over the workaround.

Create a docker network moodle-network

docker network create moodle-network
docker run --rm -d --name moodle-mysql \
           --network moodle-network \
           --env MYSQL_ROOT_PASSWORD=moodle \
           --env MYSQL_USER=moodle \
           --env MYSQL_PASSWORD=moodle -env \
           --MYSQL_DATABASE=moodle \
           mysql:5.7.27

Then start a venatorfox/moodle instance, change dbtype settings, expose port 80.

docker run --rm -d --name some-moodle \
           --network moodle-network \
           --env MOODLE_WWWROOT=http://localhost \
           --env MOODLE_DBTYPE=mysqli \
           --env MOODLE_DBHOST=moodle-mysql \
           --env MOODLE_DBPORT=3306 \
           --publish 80:80 \
           venatorfox/moodle:MOODLE_38_STABLE

If this is a new db install, grab some covfefe and wait until the webserver starts (indicated by [services.d] done in the log). Visit the site at Visit the site at http://localhost⁠, default username (if nothing was configured via --env) is "admin" and password "password". #superSecure

See below for available runtime environment variables for a more specific configuration, such as plugin installation.

Volumes should be mounted for the moodledata and the database for persistant storage. The moodledata directory is located at /var/moodledata. Please remember to do this so no data loss occurs! The container should be pulled and re-created as version updates from Moodle occur often.

The Moodle config.php will be created at run and baked into the Moodle Core Install. Like all of the other Moodle files, the config.php will be ephemeral, please do not edit it directly. Should changes be made, simply destroy the container and run it again with the desired runtime environment variables.

⁠Runtime Environment Variables

All customizations can be done via the following environment variables. It is recommended to set them properly and not use default values. (Unless you want limits at 1M & no SSL, with your admin password being password (Can you not, kthx)).

Ephemeral variables can be changed on existing installations via container rebuild as they are in the moodle container and have no relation to the database.

VariableDefault ValueDescriptionEphemeral
NGINX_MAX_BODY_SIZE1MMaximum allowed body size for NGINXTRUE
NGINX_KEEPALIVE_TIMEOUT65View the NGINX docs⁠ for more informationTRUE
NGINX_SSL_SESSION_CACHEnoneThis container is designed to have some SSL proxy/LB put in front of it on 80. Internal SSL can however still be tuned if snakeoil 443 is desired for whatever reason. NGINX docs⁠TRUE
NGINX_SSL_SESSION_TIMEOUT5mNGINX docs⁠TRUE
PHPFPM_UPLOAD_MAX_FILESIZE2MMaximum allowed upload filesize for PHP-FPMTRUE
PHPFPM_POST_MAX_SIZE8MMaximum size of post data allowed for PHP-FPMTRUE
PHPFPM_MAX_EXECUTION_TIME30Maximum execution time for php scriptsTRUE
PHPFPM_OPCACHE_MEMORY_CONSUMPTION128View the Moodle OPcache⁠ docs for more informationTRUE
PHPFPM_OPCACHE_MAX_ACCELERATED_FILES4000View the Moodle OPcache⁠ docs for more informationTRUE
CRON_MOODLE_INTERVAL15Interval for Moodle Cron in MinutesTRUE
MOODLECFG_SSLPROXYfalseSet to true if an SSL proxy container is put infront of the Moodle install, such as HAProxy with SSL termination; An example will be presented in the below docker compose filesTRUE
MOODLE_LANGen------FALSE
MOODLE_WWWROOThttp://localhost⁠Use https:// any type of SSL solutionTRUE
MOODLE_DATAROOT/var/moodledataThis is internal, it should never change from the default value /var/moodledata.TRUE
MOODLE_DBTYPEpgsqlChange to mysqli if using MySQLFALSE
MOODLE_DBHOSTmoodle-postgresChange to something like moodle-mysql if using MySQLFALSE
MOODLE_DBNAMEmoodle------TRUE
MOODLE_DBUSERmoodle------TRUE
MOODLE_DBPASSmoodle------TRUE
MOODLE_DBPORT5432Change to 3306 if using MySQLTRUE
MOODLE_PREFIXmdl_------FALSE
MOODLE_FULLNAMESome Moodle Site Full Name------FALSE
MOODLE_SHORTNAMESome Moodle Site Short Name------FALSE
MOODLE_SUMMARYSome Moodle Summary------FALSE
MOODLE_ADMINUSERadmin------FALSE
MOODLE_ADMINPASSpassword------FALSE
MOODLE_ADMINEMAIL[email protected]⁠------FALSE
MOODLECFG_TEMPDIR$MOODLE_DATAROOT/tempGenerally should not be changed from the default value. This must be common in a clustered deployment. View the Moodle Server cluster⁠ docs for more informationTRUE
MOODLECFG_CACHEDIR$MOODLE_DATAROOT/cacheGenerally should not be changed from the default value. This must be common in a clustered deployment. View the Moodle Server cluster⁠ docs for more informationTRUE
MOODLECFG_LOCALCACHEDIR$MOODLE_DATAROOT/localcacheGenerally should not be changed from the default value. Does not need to be common in a clustered deployment. Point towards fast storage. View the Moodle Server cluster⁠ docs for more informationTRUE
MOODLECFG_REVERSEPROXYfalseSet to true if the container is accessed via different base URL, This will prevent redirection loop if the container behind a proxy which strips the urlTRUE
MOODLECFG_SESSION_HANDLER_CLASSfileChange the session handler. Valid values are file, memcached, or redis. View the Moodle Session handling⁠ docs for more informationTRUE
MOODLECFG_SESSION_MEMCACHED_SAVE_PATHsome-memcached:11211Ignored if session handling is not memcachedTRUE
MOODLECFG_SESSION_MEMCACHED_PREFIXmemc.sess.keyIgnored if session handling is not memcachedTRUE
MOODLECFG_SESSION_MEMCACHED_ACQUIRE_LOCK_TIMEOUT120Ignored if session handling is not memcachedTRUE
MOODLECFG_SESSION_REDIS_HOSTsome-redisIgnored if session handling is not redisTRUE
MOODLECFG_SESSION_REDIS_PORT6379Ignored if session handling is not redisTRUE
MOODLECFG_SESSION_REDIS_DATABASE0Ignored if session handling is not redisTRUE
MOODLECFG_SESSION_REDIS_PREFIXIgnored if session handling is not redisTRUE
MOODLECFG_SESSION_REDIS_ACQUIRE_LOCK_TIMEOUT120Ignored if session handling is not redisTRUE
MOODLECFG_SESSION_REDIS_LOCK_EXPIRE7200Ignored if session handling is not redisTRUE
INSTALL_PLUGIN_URLSEnter a list of plugin URLS, seperated by spaces. As URL's often change with new versions hosted by Moodle, it is recommended to download from Moodle and host internally to ensure they stay available. Do NOT change the basename of the URL or filename if doing this.TRUE
⁠More Complex Examples

Some more complex (ie. with SSL termination, Plugins, etc...) setup examples are located in the README.md within the examples directory⁠.

NOTE: Clustered deployments must have an existing install (database). If a new install, start with 1 replica, and then increase after the install. If you don't do this, multiple replicas will try to install Moodle simultaneously into the same database which will not result in a good time. Recommended to read the Moodle Server cluster⁠ docs before deploying this in any clustered/orchestrated solution such as K8's.

⁠Maintenance

Please Create an issue⁠ if needed.

Tag summary

Content type

Image

Digest

Size

315.7 MB

Last updated

over 6 years ago

docker pull venatorfox/moodle