Skip to content

A Dockerfile that installs the latest Moodle, Apache, PHP, MySQL and SSH

Notifications You must be signed in to change notification settings

misi/docker-moodle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-moodle

A Dockerfile that installs the latest Moodle, Apache and PHP. This uses the official MySQL images from Docker Hub.

Installation

git clone https://github.com/up2university/docker-moodle.git
cd docker-moodle

Create .env to specify local details, e.g.,

MYSQL_ROOT_PASSWORD=MyMy5QLPas$word
MOODLE_PASSWORD=MyM00Dl3Pas$word
VIRTUAL_HOST=my-moodle-host.my-moodle-domain
CERT_EMAIL=email.to.use.f@r.letsencrypt

and create a directory /data/moodle-mysql to hold the MySQL DB persistently.

Then run

docker-compose build

Usage

To spawn a new instance of Moodle:

docker-compose build
docker-compose up

You can visit the following URL in a browser to get started:

http://my-moodle-host.my-moodle-domain/

Thanks to sergiogomez, eugeneware and ricardoamaro for their Dockerfiles.

SSL certificates

By default a self-signed certificate is created. It is enough for local instances.

Setting up a public instance do the following:

docker-compose exec moodle bash

rm /etc/apache2/sites-enabled/default-ssl.conf
rm -r /etc/letsencrypt/live
/certbot-setup.sh
exit

docker-compose restart moodle

To renew the certificate later just run the /certbot-setup.sh within the container.

Build images

Build the app and push images to Docker Hub:

branch=$(git rev-parse --abbrev-ref HEAD)
docker build -t up2university/moodle-mysql:${branch} mysql
docker push up2university/moodle-mysql:${branch}
docker build -t up2university/moodle:${branch} moodle
docker push up2university/moodle:${branch}

Deployment

For the first time put .env file on the host and add GIT_BRANCH=master, specifying which git branch should be deployed on the host.

On deploy upload docker-compose-deploy.yml to the host and run the following there:

docker-compose -f docker-compose-deploy.yml pull
docker-compose -f docker-compose-deploy.yml up -d

About

A Dockerfile that installs the latest Moodle, Apache, PHP, MySQL and SSH

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 95.8%
  • Shell 4.2%