moodlehq / moodle-docker

A docker environment for moodle developers
GNU General Public License v3.0
373 stars 244 forks source link

interest on having wrapping scripts? #261

Open jpahullo opened 1 year ago

jpahullo commented 1 year ago

Hi,

Would you like me to build a patch for providing wrapping scripts to start really quickly over developing with this tool?

I like to automate things, and I spotted something on another issue as part of its analysis.

In the end, I built myself this scripts set;

  1. start.sh: expects a moodle-dev.env file on the running directory (i.e., the Moodle wwwroot) with the set of all variables. Also for self-documentation. This script builds containers and an empty database. Also installs some elements inside the webserver container, like the composer.
  2. destroy.sh: expects also the moodle-dev.env file on the running directory (i.e., the Moodle wwwroot) with the set of all variables. This scripts proceeds with a docker compose down actually.
  3. restart.sh: invokes destroy.sh and start.sh, in this order.
  4. install.sh: proceeds with the non-interactive installation of the Moodle database.
  5. activate-xdebug.sh: wraps up all the process to install (if it is the first execution) and sets the xdebug module available.
  6. deactivate-xdebug.sh: wraps up the process to deactivate (not uninstall) the xdebug module.

Keep in mind that all these scripts are a wrapper of all the commands detailed in the README.md.

I could also suggest a local.yml.example that I use to bind mount data directories to the host, so that debugging and searching and validating things are really easier. Also, it helps to keep the database between docker executions.

I could make this patch easily, and then improve its content according to your proposals.

I could only provide linux scripts. If anyone could implement the windows counterparts, it would be fantastic.

Thanks for your time,

Jordi

stronk7 commented 1 year ago

Hi @jpahullo ,

while I also tend to use local scripts to easy setup and run products like this (or moodle-ci-runner, or behat itself...), I personally think that it's better to keep moodle-docker, with its "API" as currently is, not adding a new extra layer on top of it.

That way, people can continue using it exactly the same, manually or with their own wrappers (like your one or any other), and we'll try to keep it stable along the time, so all them will continue working the same (new features aside).

Of, course, I think it's a great idea to have a working wrapper, well tested and able to extract the most from moodle-docker in a nice way, so I cannot but encourage you to share it. I'm sure that there will be people for whom such a helper will be welcome. Just, as said, I don't see it bundled with moodle-docker.

Again, note that this (to keep moodle-docker sort of "pure" compose + docker environment) is just my personal opinion, I will be glad to ear from others. 100%.

Thanks for the offer, no matter the outcome, interesting initiative!

Ciao :-)

jpahullo commented 1 year ago

Hi,

Thanks for your words @stronk7. And I completely understand your position. I agree also in your reasoning.

I've published all the scripts and config files as a branch of my fork:

https://github.com/jpahullo/moodle-docker/tree/master-with-wrapper-scripts

Now I will use it locally, rebasing this master branch.

This is all what I need to do now. If anything else I need later on, I'll update them. I'm sharing them here following your suggestion, just in case someone is interested on them and find them useful too.

Thanks a lot for your time and the great work,

Jordi