Page MenuHomePhabricator

MySQL/MariaDB images for development environments
Open, MediumPublic

Description

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/550708 / MediaWiki-Docker originally used the Bitnami MySQL image because it allows you to use environment variables in the docker-compose file to easily setup database replication. The version of that patch which is likely to land just uses SQLite at the moment, but we'd like to provide our own MySQL/MariaDB images in dev-images.

Event Timeline

I think this is probably valid in the general case. It'd probably be wise to control all the base images for a basic dev setup.

(This has been lurking in the back of my mind for a while, thanks for filing the task.)

We could also use this with the wmde wikibase docker images which are currently on github and docker hub but that will be moving to gerrit and the build pipeline (tasks to come)
(well, if it were not a dev image)

brennen renamed this task from mysql/mariadb images to MySQL/MariaDB images for development environments.Feb 20 2020, 6:57 PM
brennen triaged this task as Medium priority.
brennen added a project: MediaWiki-Docker.
brennen updated the task description. (Show Details)

It seems that a non-sqlite image is a requirement if you want to do development that touches on Parsoid via Restbase (so, VisualEditor / DiscussionTools stuff mostly), because of clashing database locks.

It seems that a non-sqlite image is a requirement if you want to do development that touches on Parsoid via Restbase (so, VisualEditor / DiscussionTools stuff mostly), because of clashing database locks.

👍 I think we should switch to MySQL as the default setup. I think it wouldn't be very hard to make our own MySQL image (if we want to do that) or we could use the official mariadb image from Docker Hub. It would be more work to have a simple primary/replica set up that's managed via environment variables like the Bitnami image, and that could be done in a second phase of work.

brennen added a subscriber: jeena.

Yeah, on the whole I think this seems like it would solve more problems than it creates.

cc: @jeena

so, should we just go with https://hub.docker.com/_/mariadb (and if so, which version specifically?) or should we build off our base image in releng/dev-images and install mariadb, do our own setup / config, etc?

It seems that a non-sqlite image is a requirement if you want to do development that touches on Parsoid via Restbase (so, VisualEditor / DiscussionTools stuff mostly), because of clashing database locks.

👍 I think we should switch to MySQL as the default setup. I think it wouldn't be very hard to make our own MySQL image (if we want to do that) or we could use the official mariadb image from Docker Hub. It would be more work to have a simple primary/replica set up that's managed via environment variables like the Bitnami image, and that could be done in a second phase of work.

Sorry, I take this back. I don't think we should make it the default, because of the way docker-compose files are processed. For example, considering a docker-compose.yml file like this one:

version: '3.7'
services:
  mediawiki:
    user: "${MW_DOCKER_UID}:${MW_DOCKER_GID}"
  mariadb-main:
    image: 'mariadb:latest'

If the developer wants to use SQLite or Postgres as their DB, they'll have a MariaDB container needlessly running and which cannot be removed from the service definitions via the docker-compose.override.yml file.

So, maybe a better way forward is to do something we've talked about for a while now, which is have some kind of mw docker init command that would prompt you to pick your version of PHP and database backend, at which point you could choose from SQLite, MySQL or Postgres, and mw docker install would handle using the proper arguments to install.php instead of our existing script in /docker/install.sh that assumes SQLite will be used.

Having an easy and somewhat-official way to get a mediawiki+mysql instance running is what's needed. Whether it's the default or not doesn't really matter, I think, so long as we're fairly up-front about what the trade-offs are. (E.g. I think that DEVELOPERS.md should have an "only choose sqlite if..." disclaimer.)

I initially didn't want to clutter up the docker-compose file in core, but then thought if most devs need to use MySQL then having it as the default would be good.
So I think either way is fine as long as we make it easy to set up as @DLynch mentioned.

Having an easy and somewhat-official way to get a mediawiki+mysql instance running is what's needed. Whether it's the default or not doesn't really matter, I think, so long as we're fairly up-front about what the trade-offs are. (E.g. I think that DEVELOPERS.md should have an "only choose sqlite if..." disclaimer.)

We do have https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/Alternative_databases but yeah it would be nice to make this easier and more up front for people.

I initially didn't want to clutter up the docker-compose file in core, but then thought if most devs need to use MySQL then having it as the default would be good.
So I think either way is fine as long as we make it easy to set up as @DLynch mentioned.

I think most devs would want MySQL but to keep the core configuration as extensible as possible, I think we should use the override file to set that up, and that's where the mw utility could help IMHO.

but yeah it would be nice to make this easier and more up front for people.

I'm somewhat motivated by my team affiliation to argue for the configurations where it's possible to use VisualEditor being the defaults, admittedly. :D

If the developer wants to use SQLite or Postgres as their DB, they'll have a MariaDB container needlessly running and which cannot be removed from the service definitions via the docker-compose.override.yml file.

This will be solved by the mwdd (mediawiki-docker-dev) style approach that can be done with mw-cli