FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

MDK ❤️ Moodle docker containers #157

Open danpoltawski opened 7 years ago

danpoltawski commented 7 years ago

This is an issue when I want to try and discuss ideas for integrating https://github.com/danpoltawski/docker-moodle and mdk as closely as possible.

Let me start with a sort of 'ideal' vision of how I picture it working:

To get us to that vision is tricky, especially with the existing way things are supported:

Any thoughts?

1 Well, we might want to do this for developer convienenicence reasons, but conceptually not required.

danpoltawski commented 7 years ago

Another thing to be thinking about with this - keeping it generic enough so that for real production Moodle installs which are using containers, mdk could hook in and use those production containers.

FMCorz commented 7 years ago

I agree with all of it, except for:

You can run something like mdk environment db mssql to switch to mssql or mdk environment php php71 to switch to php71

I understand that by design MDK and Composer do things differently. Although MDK appears tied to a database engine, it isn't except for the install command (and backup which is minor enough). The rest, is basically just handling git and various CLI stuff.

What I'm trying to achieve is being to run MDK under any PHP version, simulatenously. This means that the database and moodledata remains the same, only the compiler changes. This seems to be possible in Docker if we assume that the database container instance is shared amongst them, just like you'd share a database server locally.

The hard part is to tell MDK that when you're running mdk purge you want to use the PHP7 binary, not any other one. I feel like switching to an MDK environment will reduce the effectiveness of being able to work on multiple PHP version at the same time. I almost feel that we're going with an environment specific setting, then instances should be tied to a PHP version too, and have their own docker stuff tied to it.

I don't know if I expressed myself well, but I do agree that changes to MDK must be made, and I'm happy to see that happening. I'd just like to keep MDK a user-friendly tool, which works with minimal configuration, and where its behaviour is expected and understandable.

danpoltawski commented 7 years ago

It seems like you are resistant to changing the db environment, but want the php environment changable, but i'm not sure I understand why you think one should be 'set in stone' and the other not.

FMCorz commented 7 years ago

I'm not. The DB environment is set in Moodle's config.php, and locks how the instance works for that matter. But if we're going for containers, I'd be happy to be able to re-use the same database just to avoid recreating the same content over and over while the only thing that I'm interested in changing is PHP.

Perhaps we have different needs, or perhaps mine are not a good idea. Surely there are many reasons why fiddling with multiple PHP, on the same database (perhaps even at the same time) is a terrible idea!

Going back to containers, if we could find a way to keep the containers working with the host's config.php, then it'd already be nice. And I could find a way for me to run MDK in a container a bit like the environment you talked about.

I'll have to think more about my requirements...

danpoltawski commented 7 years ago

Well, I think we can support both with the same set of images, but with the docker-compose situation what I was trying to do was make it as quick as possible to get a a testing environment going to support weird and whacky situations (e.g. you fix a SQL bug and want to do a quick test on oracle), and not worry about selenium and that kind of stuff.

Going back to containers, if we could find a way to keep the containers working with the host's config.php,

One thought i've had is config.php becoming something like:

if (getenv('MOODLE_DOCKER_DBTYPE')) {
    // Basically include https://github.com/danpoltawski/docker-moodle/blob/master/config.docker-template.php
} else {
   // Use the mdk vars
}

But I suspect that might cause mdk chaos.