From 901d15f7aebe6e0bb0d144b02f99a77afe88e678 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Sat, 9 Dec 2023 11:07:54 +0100
Subject: [PATCH] ENH: add useful config for running mariadb in docker

---
 .docker/docker-compose.yml | 23 +++++++++++++++++++++++
 README_SETUP.md            | 12 ++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 .docker/docker-compose.yml

diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml
new file mode 100644
index 0000000..1a63292
--- /dev/null
+++ b/.docker/docker-compose.yml
@@ -0,0 +1,23 @@
+version: '3.6'
+services:
+  sqldb:
+    image: mariadb:10.5
+    volumes:
+      - type: volume
+        source: "caosdb-sqldata"
+        target: /var/lib/mysql
+    environment:
+      MYSQL_ROOT_PASSWORD: caosdb1234
+    networks:
+      # available on port 3306, host name 'sqldb'
+      - caosnet
+    ports:
+      - 3306:3306
+
+
+# A well-defined network for caosdb
+volumes:
+    caosdb-sqldata:
+networks:
+  caosnet:
+    driver: bridge
diff --git a/README_SETUP.md b/README_SETUP.md
index 95f975d..4eb3ec0 100644
--- a/README_SETUP.md
+++ b/README_SETUP.md
@@ -87,6 +87,18 @@ with the then current version of the stored entities.
     * Alternatively, to run the tests in a containerized MariaDB instance, run `make test-docker`,
       followed by `make test-docker-stop`.
 
+
+### Running in a Docker Container
+You can use `.docker/docker-compose.yml` to start a docker container
+(`docker-compose -f .docker/docker-compose.yml up -d`) that runs
+mariadb and you can connect to it with 
+`mariadb -h localhost -P3306 -u caosdb -prandom1234 caosdb`. You need appropriate
+settings in `.config`.
+Due to [a Bug](https://gitlab.com/linkahead/linkahead-mariadbbackend/-/issues/33)
+`MYSQL_CMD="mariadb -h localhost -P3306"` and
+`DATABASE_USER_HOST_LIST=%,`
+
+
 ### Troubleshooting
 
 #### MySQL has failing tests
-- 
GitLab