Sign inSign up

alessmicro/mariadb

By alessmicro

Updated over 1 year ago

Image
Databases & storage
0

523

alessmicro/mariadb repository overview

This is a rebuild of the bitnami/mariadb container, the only updates they give is LTS. It's based on the Dockerfile and is intended for development or testing purposes. All the environment variables are setup the same way as official Bitnami Container.

Important: These are not sutiable or allowed for production Usage. Bitnami Does have some different tags and versions available, on enterprise support, please use those for regular updates also the official mariadb container is also nice, or else kindly use the Dockerfile and build your own as building is fun also.

  • This container is built from Scratch it uses same bitnami initialization scripts. The base was chosen as Oracle Linux 9 which is a derivative of RHEL with enterprise support. Rocky Linux and Almalinux is not chosen due to Oracle Linux having enterprise grade stability and support and RHEL base is not used due to lots of packages are under Subscription Repos which are needed to build and run MySQL server, Even if we built it with RHEL we would not be able to redistribute the containers and Build it yourself container is much complicated in non RHEL Hosts. So Oracle Linux stayed a strong Contender for Database Systems and Other Applications which need enterprise grade stability and larger non subscription package repositories and also redistributable when RHEL/RPM ABI/Binary Compatiblity is needed.

  • The Dockerfiles are build from base files. So you can modify the software version numbers as you want, They are used as Version Macros in Dockerfile, then maybe some minor changes needed in Dockerfile to build most versions of the software with ease and peace.

Testing Features: Now on Testing tag we have certain new features available at Dockerfile . New Docker Env Variables. The backups are non-blocking. These are full backups. If you have multi gigs of data. you will not be using this. We may make incremental backups available in future, but that is not in our timeline currently.

MARIADB_ENABLE_BACKUP  # default no if set yes it would enable auto backup everyday at 2 AM UTC via percona xtrabackup
MARIADB_BACKUP_USER #username for MySQL backup runner account
MARIADB_BACKUP_PASSWORD # password for MySQL backup runner account. Use a strong password on all passwords or it would have login errors

The backup Directory needs to be mounted at "/bitnami/backups". There are certain times where all rootless containers from bitnami show permission denied on directory write. To fix it use chmod 775 on mariadb_data_dir and mariadb_backup_dir if you are mounting a directory. Do not make the dirs first. Let the container exit after error then set permissions and run them again.

The backup format is mbstream with timestamps. if you want to restore the backup in this container. we have functionality to restore it also. Make a clean container and let it install the database then shell into the container

#check if you are 1001. to not have issues with permissions. don't restore as root.
whoami
     #shell in the container
supervisorctl stop mysql
     # remove the data in bitnami initialized dir
rm -rfv /bitnami/mariadb/data/*
     #Go to your mounted backup dir then. restore path should be bitnami mariadb official data dir
mbstream -xv -C /path/to/restore < /path/local/DB.xbstream
mariadb-backup prepare --target-dir /path/to/restore
     #Then we start the mysql again
supervisorctl start mysql
     #exit the container and see the logs or you can shell into
     #mysql server with mysqlsh or mysql or mariadb and check it.
     #I have not known any docker based environment that supports these
     #So we have these here.

On first run it creates the backup user automatically for new installations with environment variables enabled properly. if you migrated your server then you might want to create the backup user with Mariadb Official suggested guide.

   #as bitnami official container scripts do not resolve hostnames for mariadb we need to create the user at '%' as opposed to official mariadb instuctions to create it in localhost. this has no real bad effect as you might in future want to have replication and have a seperate container for backups
CREATE USER 'yourbackupuser'@'%' IDENTIFIED BY 'yourbackuppasword';
GRANT RELOAD, PROCESS, LOCK TABLES, BINLOG MONITOR ON *.* TO 'yourbackupuser'@'%';
GRANT CREATE, INSERT ON mysql.mariadb_backup_history TO 'yourbackupuser'@'%';

Then make sure to define the Environment variables in docker compose or in your container run command. IT IS NECCESSARY. cron job reads it from env variable to execute periodic backups. so if you change the password or user later. it would change the backup runner username and password.

MARIADB_ENABLE_BACKUP=yes
MARIADB_BACKUP_USER=your_newly_created_user
MARIADB_BACKUP_PASSWORD=your_newly_created_password

If you have enabled backups and set up everything but you don't want to run the backups anymore for any reason? or maybe you have everything set up then you choose to do manual backups. you can simply set

MARIADB_ENABLE_BACKUP=no

and it will not execute periodic backups . you can simply re enable by setting it to yes.

On first run you might want to test if the backups working or not by executing.

/opt/bitnami/scripts/backup.sh

it should create a backup like this

backup-20250506-034109.mbstream

in you backup directory.

Tag summary

Content type

Image

Digest

sha256:1b70d2151

Size

458.5 MB

Last updated

over 1 year ago

docker pull alessmicro/mariadb:11.4-ol9-arm64-testing