moodlehq / moodle-docker

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

Support exposing database port to local client #222

Closed paulholden closed 2 years ago

paulholden commented 2 years ago

Something that can automate the following in a cross-DB compatible manner:

$ git diff
diff --git a/db.mysql.yml b/db.mysql.yml
index 368785f..ccb28af 100644
--- a/db.mysql.yml
+++ b/db.mysql.yml
@@ -17,3 +17,5 @@ services:
       MYSQL_USER: moodle
       MYSQL_PASSWORD: "m@0dl3ing"
       MYSQL_DATABASE: moodle
+    ports:
+      - 127.0.0.1:33066:3306

Which would allow a client to connect to the running database from the host

scara commented 2 years ago

Hi @paulholden, I'd suggest an approach like the one used for the web port:https://github.com/moodlehq/moodle-docker/blob/cf06e9a656ef4829d9830bc6031880903ce5b94c/webserver.port.yml#L6-L7

This will help people like me whose Docker Engine is not in the same machine but in another host i.e. 1.2.3.4: and not 127.0.0.1:.

HTH, Matteo

skodak commented 2 years ago

see https://github.com/moodlehq/moodle-docker/pull/226

stronk7 commented 2 years ago

Closing this coz #226 implements it and has landed.

Ciao :-)