Skip to contentSkip to conversation

Use MariaDB instead of MySQL.

PATCH New Tim Orling 1 participant 1 message Oct 20

lore
Share & tools
lore

Tim Orling

author
#0 lore raw

PATCH 1/1 Use MariaDB instead of MySQL.

errors.yoctoproject.org runs MariaDB, and layerindex-web uses mariadb:lts too, so its dumps import as they are. Django and mysqlclient support both. The MariaDB image has no mysqladmin, so use its healthcheck.sh.

AI-Generated: Claude Opus 5.5

---
 .devcontainer/devcontainer.json      | 4 ++--
 .devcontainer/docker-compose.dev.yml | 2 +-
 README                               | 2 +-
 docker-compose.prod.yaml             | 4 ++--
 docker-compose.staging.yaml          | 4 ++--
 docker-compose.yaml                  | 5 ++---
 docker/run-tests.sh                  | 6 +++---
 7 files changed, 13 insertions(+), 14 deletions(-)
.devcontainer/devcontainer.json +2 -2
index 9d8ef1e..5b2f1c6 100644
@@ -1,5 +1,5 @@
 {
-  "name": "error-report-web (Django + MySQL)",
+  "name": "error-report-web (Django + MariaDB)",
   "dockerComposeFile": [
     "../docker-compose.yaml",
     "docker-compose.dev.yml"
@@ -41,7 +41,7 @@
             "previewLimit": 50,
             "server": "db",
             "port": 3306,
-            "driver": "MySQL",
+            "driver": "MariaDB",
             "name": "errorreport",
             "database": "errorreport",
             "username": "errorreport",
.devcontainer/docker-compose.dev.yml +1 -1
index 32aa685..6b73bd3 100644
@@ -1,5 +1,5 @@
 # Devcontainer override for docker-compose.yaml: runserver on the mounted
-# workspace, MySQL port unpublished (no clash with other dev DBs), no nginx.
+# workspace, MariaDB port unpublished (no clash with other dev DBs), no nginx.
 services:
   backend:
     command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
README +1 -1
index 7539329..63f3776 100644
@@ -44,7 +44,7 @@ For more information on error reporting and log collection see: http://www.yocto
 Docker
 ------
 
-docker-compose.yaml runs a development setup: MySQL, the application in
+docker-compose.yaml runs a development setup: MariaDB, the application in
 gunicorn, and nginx serving it on http://localhost:8080. Its settings are in
 .env.dev.app and .env.dev.db, which hold development-only values.
 
docker-compose.prod.yaml +2 -2
index 582f76c..576590d 100644
@@ -1,14 +1,14 @@
 # Prod: nginx with Let's Encrypt TLS in front of gunicorn. See README.
 services:
   db:
-    image: mysql:8.4
+    image: mariadb:lts
     restart: unless-stopped
     volumes:
       - data:/var/lib/mysql
     env_file:
       - .env.prod.db
     healthcheck:
-      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
+      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
       timeout: 20s
       retries: 10
 
docker-compose.staging.yaml +2 -2
index 908bbb7..704fcf0 100644
@@ -1,14 +1,14 @@
 # Staging: nginx with Let's Encrypt TLS in front of gunicorn. See README.
 services:
   db:
-    image: mysql:8.4
+    image: mariadb:lts
     restart: unless-stopped
     volumes:
       - data:/var/lib/mysql
     env_file:
       - .env.staging.db
     healthcheck:
-      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
+      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
       timeout: 20s
       retries: 10
 
docker-compose.yaml +2 -3
index 9f0a735..d5339ab 100644
@@ -1,6 +1,6 @@
 services:
   db:
-    image: mysql:8.4
+    image: mariadb:lts
     container_name: error_report_web_db
     restart: always
     volumes:
@@ -10,8 +10,7 @@ services:
     ports:
       - "3306:3306"
     healthcheck:
-      # TCP: MySQL's init-time server only listens on the socket.
-      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
+      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
       timeout: 20s
       retries: 10
   
docker/run-tests.sh +3 -3
index be1faeb..4e7913b 100755
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Run the tests in the app image against a throwaway MySQL. Used by CI.
+# Run the tests in the app image against a throwaway MariaDB. Used by CI.
 #
 # SPDX-License-Identifier: MIT
 
@@ -17,8 +17,8 @@ trap 'docker rm -f $DB >/dev/null; docker network rm $NET >/dev/null' EXIT
 # Root so Django can create the test database; testingpw isn't a secret.
 docker run -d --name $DB --network $NET --network-alias db \
     -e MYSQL_ROOT_PASSWORD=testingpw -e MYSQL_DATABASE=errorreport \
-    mysql:8.4 >/dev/null
-until docker exec $DB mysql -h127.0.0.1 -uroot -ptestingpw -e 'SELECT 1' >/dev/null 2>&1; do
+    mariadb:lts >/dev/null
+until docker exec $DB healthcheck.sh --connect --innodb_initialized >/dev/null 2>&1; do
     if [ "$(docker inspect -f '{{.State.Running}}' $DB)" != true ]; then
         docker logs $DB | tail -5; exit 1
     fi
Signature · 1 line
2.56.0