-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add better support for multiple concurrent container setups #55
Comments
Hi Alex, Too much automation means a rigorous CLI to manage it while use this env var let the user still use the "plain" commands (given she/he has understood the simple logic behind that env var): though an automation would be nice, I'm keen to go ahead in documenting that env var plus at least one use case where it could fail. TIA, |
Let me suggest another approach, which you can use or just get some inspiration from: https://gitlab.com/docker-scripts/ds |
TNX for sharing 👍, @dashohoxha. AFAIK this repo should address a dev/test env, which IMHO requires a bit of knowledge to step into the components to look for failures and a full automation could not be the best solution, not to mention that this repo could be the base for several other automations, including CI. HTH, |
Thanks for your opinion @scara. |
I agree we need to support this use case (and there have been steps towards it like avoiding allocation of ports and so on) but I haven't thought deeply about how to achieve it. One of my primary goals for creating this project was for simplifying the simple case when a developer wants to test their code on an 'alien' environment and can just spin it up without too much effort. It's key to me that we keep that in mind when thinking about how to achieve the more complex use case. I think we've got to a good point of the 'spin up a quick test environment' side of things and I agree that to evolve this further we need to support this case and think more about persistence and non-disposable environments. See FMCorz/mdk#157 for some other thoughts i've had around this. |
Hi! Congrats for this repository. I need to test my plugins among several Moodle versions quickly. So I needed to test that my changes work ok on several Moodle versions. I discovered this option From a practical point of view, you will see all containers started this way with a prefix name Nothing else is required to change. It works like a charm for me. Hoping this helps. Jordi |
Hi, just reading these old issues and trying to make some to advance... Maybe the doc changes proposed by @jpahullo @ #79 are enough for providing that multiple support while keeping things simple (unmodified in fact). And done? Or is there any drawback/restriction with the use of I've not tried, but for me it looks simple and good enough to have the multiple thing available in general. |
Hi @stronk7 , I can report that we have been using The trick is still just to set From my point of view, #79 would be the way to go to solve this issue without adding any further automated support for multiple containers. Cheers, |
Hi! Thanks for your words. Today I have updated my PR with the latest version of the Is there something else I can do to promote that issue being done and accepted? This way we could solve two issues at once. Last time, I was updating the PR several times and CI failed all the time but for other aspects not related to the minimal code changed (nothing about Moodle, but docker). Just let me know. Thanks for your time. Jordi |
Closing this now, the use of COMPOSER_PROJECT_NAME has been documented @ #79. |
With this project, you can currently build and spin up one container setup aka. Moodle instance which will get its configuration from the MOODLE_DOCKER_* environment variables and will be named after the name of the directory where this repository was cloned into.
So, if you cloned this repository into
~/moodle-docker
and runbin/moodle-docker-compose up -d
, you will have four containers namedIf you run
bin/moodle-docker-compose up -d
a second time, docker-compose only checks if the service configuration or images were changed after the containers' creation (see https://docs.docker.com/compose/reference/up/) and does recreate a container if needed. But it does not spin up another container setup aka. Moodle instance like you might expect.If you want now to run multiple container setups concurrently, for example if you want to test the same Moodle codebase on two different DBMS concurrently or if you want to test two plugin versions concurrently, this isn't officially supported by this project and you are on your own.
Luckily, you can define the container prefix for docker-compose. To test the same Moodle codebase on two different DBMS, you can run these commands in two different terminals:
Terminal 1:
Terminal 2:
This will spin up two Moodle instances on Port 8000 and 8001 concurrently. Unfortunately, this approach isn't really bullet-proof. You will have to set the correct environment variables everytime you run a bin/moodle-docker-compose command to target the correct Moodle instance. And you will have to have one terminal open per Moodle instance to prevent conflicts of the environment variables.
So: How about adding official support for multiple concurrent container setups?
If you say "YES!", we should think about useful implementation approachs. There may be simple approachs and there might be more sophisticated approachs like @Dagefoerde already built in his https://github.com/Dagefoerde/Moodledocker project.
Thanks,
Alex
The text was updated successfully, but these errors were encountered: