Skip to content
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

MDK ❤️ Moodle docker containers #157

Open
danpoltawski opened this issue Jul 5, 2017 · 5 comments
Open

MDK ❤️ Moodle docker containers #157

danpoltawski opened this issue Jul 5, 2017 · 5 comments

Comments

@danpoltawski
Copy link
Contributor

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 setup a dev machine, a developer installs mdk and docker/docker-compose and thats it
  • You do not run a local webserver1, php version, database, solr etc
  • You operate mdk in the same way as now, locally from your host machine
  • The git checkouts are in your local filesystem and mounted into the containers
  • You can run something like mdk environment db mssql to switch to mssql or mdk environment php php71 to switch to php71

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

  • I think we need to strip mdk of all it's local assumptions and properly make mdk aware of the idea of containers - I have thought if we could fudge this by changing the phpcmd to some docker exec call, but it's probably not sufficient
  • The existing pgsql/mysqli concepts in mdk sit akwardly with this. It would be great if mssql could be just as much a 'first class citizen'
  • Handling persistancy/moodledata - Persistance, for 'manual' testing moodlehq/moodle-docker#10 I have't really considered how this might work
  • What do we do with the node environment, perhaps this deserved to be a container, I haven't considered this
  • Multiple instances running at the same time, is something I haven't really considered properly on the docker side

Any thoughts?

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

@danpoltawski
Copy link
Contributor Author

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
Copy link
Owner

FMCorz commented Jul 6, 2017

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
Copy link
Contributor Author

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
Copy link
Owner

FMCorz commented Jul 6, 2017

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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants