Setting up an external database for use with MagicBox
The MagicBox is a transient thing; it lasts only until the container is stopped. Users must configure an external database if they wish for their world to persist.
For utility we will use a MySQL container for this purpose. The assumtption is made that mysql-client is installed on the host machine.
$ docker pull mysql:latest
Spin up our new mysql server. Choose your own root password here.
$ docker run --name mysql -p 3306:3306 -v mysql_volume:/var/lib/mysql/ -d -e "MYSQL_ROOT_PASSWORD=ROOTPASS" mysql
Copy the mb.data/magicbanesql.conf file making the following edits.
- Set your own password
- Change localhost to the wildcard. (Allows remote access)
Excute these instructions on the new mysql server
$ mysql -u root -p < mbremotesql.conf
Now log onto your Magicbox instance and dump the database with ./mbdump.sh
Move that file onto the host either via mb.conf or docker cp. Restore the database to your new mysql instance.
$ mysql -u magicbox -p < mbdump.sql
Edit a copy of magicbane.conf file reflecting your new database settings and place inside the shared ~/mb.conf folder on the host.
Restart your container.
tail console_login
You should see the login server booting from your new external database. Your world will now for to persist!