I'm preparing a set of docker images for Moodle development to simplify testing setups and ensure that developers can quickly setup testing environment for various aspects of Moodle core development. I'm not the first person to do this and probably won't be the last, but I want to make a solid reusable base which at least can get adoption in Moodle HQ. Now that Microsoft have Microsoft SQL Server running on Linux this is particularly compelling as we can cover all DB engines.
My goals at this stage are:
- Focus on developers/testers, not any other use cases (i.e. production use)
- Keep the do one thing in each docker container mantra and keep it possible for people to use the individual containers as they wish
- Be as 'plug and play' as possible (ideally no manual configuration)
My rough plan of things to do from here:
- Add a
docker composeconfiguration to be able to bring up all containers communicating with each other easily
- Script the 'make this moodle.git checkout be available'
- Add containers for all our other optional integrations like memached, redis, ldap etc
- Consider the multiple-php thing a bit better
But really I am posting because I have hit an impasse about the best approach and I am sure there are others in the community who have used docker in anger much more than me, so trying to solicit opinions (/experiences).
A key question is how best to expose the Moodle codebase to docker. Given an existing moodle.git checkout, my idea is that the developer can run one command and then get that codebase running with access to all services. But there are a few things causing me indecision about direction:
- Mounting the code directory into the php container seems the natural solution, but can cause performance issues on some platforms - particularly my platform, mac. If I want to say run automated tests, perhaps a 'copy' of the code directory is fine, to run the tests and get the result
- The config.php will want to be overridden for the docker environment, it might be different to the host OS. So just mounting it might not be a good solution here.
- Initially I was thinking of just exposing php-fpm, but perhaps its a better experience to expose php+apache
- If exposing php+apache, i was thinking you would run the cli tools just using
docker execinto the container
Do you have any insight? Comments very welcome!