MariaDB / mariadb_kernel

A MariaDB Jupyter kernel
BSD 3-Clause "New" or "Revised" License
30 stars 20 forks source link

Ability to start a server for testing purposes #19

Closed robertbindar closed 3 years ago

robertbindar commented 3 years ago

We already have the feature in place, but it would be cool to make it bulletproof by creating a testing datadir via mysql_install_db and other aditional options to make the testing server instance not dependent on user's mariadb configuration files.

jonakarl commented 3 years ago

(Following up on the email thread) While in no way bullet proof we have created a simple wrapper that does this:

#!/bin/bash
set -e

# --rpm  seams to do no harm (maybe reconsider in future) but remove some warnings.
mysql_install_db --skip-test-db --rpm &> /dev/null

# Start mysqld with the supplied options (if any)
exec -a $0 mysqld $*

Pros

Cons:

  1. Require a "non default" .my.cnf (setting the user and pid /socket to a place where user jovyan can r/w)
  2. Require a "non default" mariadb_config.json (use jovyan as user and point to the wrapper for starting mysqld)
  3. If the database is created and for some reason the default user (jovyan) is changed, at a later time, to some other username, it will not be possible to login to the db.

I think the Cons could be overcome with:

  1. Make the server start function call mysqld with command line arguments pid and datadir (the client section maybe is not needed if we fix 3
  2. Make the start server function also call the mysql_install_db script (will make it dependent on that script always is available)
  3. Change so that when we create the db we instead of login in with socket auth (for the jovyan user) we use normal login with, ie the root user and empty password (I saw that you enabled that in your binder config but for me it never worked when I tried)
jonakarl commented 3 years ago

I think #25 close this issue or are we missing something still?

robertbindar commented 3 years ago

Nope, we got all that this issue was supposed to track.