Giter VIP home page Giter VIP logo

sclorg / mariadb-container Goto Github PK

View Code? Open in Web Editor NEW
31.0 12.0 65.0 429 KB

MariaDB container images based on Red Hat Software Collections and intended for OpenShift and general usage. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.

Home Page: http://softwarecollections.org

License: Apache License 2.0

Shell 82.36% Makefile 0.46% Dockerfile 8.02% Python 9.17%
rhel openshift centos mariadb container docker mysql database fedora

mariadb-container's Introduction

MariaDB SQL Database Server Docker Image

Build and push images to Quay.io registry

Images available on Quay are:

This repository contains Dockerfiles for MariaDB images for OpenShift and general usage. Users can choose between RHEL, Fedora and CentOS Stream based images.

MariaDB container is very similar to the MySQL container available at https://github.com/sclorg/mysql-container.

For more information about using these images with OpenShift, please see the official OpenShift Documentation.

For more information about contributing, see the Contribution Guidelines. For more information about concepts used in these podman images, see the Landing page.

Versions

MariaDB versions currently provided are:

RHEL versions currently supported are:

  • RHEL8
  • RHEL9

CentOS versions currently supported are:

  • CentOS Stream 9
  • CentOS Stream 10

Installation

  • RHEL8 based image

    These images are available in the Red Hat Container Catalog. To download it run:

    $ podman pull registry.access.redhat.com/rhel8/mariadb-105
    

    To build a RHEL8 based MariaDB image, you need to run Docker build on a properly subscribed RHEL machine.

    $ git clone --recursive https://github.com/sclorg/mariadb-container.git
    $ cd mariadb-container
    $ git submodule update --init
    $ make build TARGET=rhel8 VERSIONS=10.5
    

For using other versions of MariaDB, just replace the 10.5 value by particular version in the commands above.

Note: while the installation steps are calling podman, you can replace any such calls by docker with the same arguments.

Notice: By omitting the VERSIONS parameter, the build/test action will be performed on all provided versions of MariaDB, which must be specified in VERSIONS variable. This variable must be set to a list with possible versions (subdirectories).

Usage

For information about usage of Dockerfile for MariaDB 10.3, see usage documentation.

For information about usage of Dockerfile for MariaDB 10.5, see usage documentation.

For information about usage of Dockerfile for MariaDB 10.11, see usage documentation.

Test

This repository also provides a test framework, which checks basic functionality of the MariaDB image.

Users can choose between testing MariaDB based on a RHEL or CentOS image.

  • RHEL based image

    To test a RHEL8 based MariaDB image, you need to run the test on a properly subscribed RHEL machine.

    $ cd mariadb-container
    $ git submodule update --init
    $ make test TARGET=rhel8 VERSIONS=10.5
    

For using other versions of MariaDB, just replace the 10.5 value by particular version in the commands above.

Notice: By omitting the VERSIONS parameter, the build/test action will be performed on all provided versions of MariaDB, which must be specified in VERSIONS variable. This variable must be set to a list with possible versions (subdirectories).

mariadb-container's People

Contributors

alfonsoalongi avatar andrewklau avatar atodorov avatar bparees avatar caringi avatar danielhelfand avatar dependabot[bot] avatar ferrymanders avatar gabemontero avatar hhorak avatar kubco2 avatar liangxia avatar ljavorsk avatar lorbuschris avatar mohammedzee1000 avatar omron93 avatar phracek avatar pkubatrh avatar pvalena avatar ryanj avatar tomastomecek avatar vrutkovs avatar yselkowitz avatar zmiklank avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mariadb-container's Issues

Docker image fails to run on openshift

I am using "From container image" option in the openshift v4.9 GUI and using the below path to the image
registry.redhat.io/rhel8/mariadb-105:latest
and the pod fails to run

I don't see any error msgs in the pod logs.. the max I can see is this....(just info msgs)

=> sourcing 20-validate-variables.sh ...
You must either specify the following environment variables:
  MYSQL_USER (regex: '^[a-zA-Z0-9_]+$')
  MYSQL_PASSWORD (regex: '^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$')
  MYSQL_DATABASE (regex: '^[a-zA-Z0-9_]+$')
Or the following environment variable:
  MYSQL_ROOT_PASSWORD (regex: '^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$')
Or both.
Optional Settings:
  MYSQL_LOWER_CASE_TABLE_NAMES (default: 0)
  MYSQL_LOG_QUERIES_ENABLED (default: 0)
  MYSQL_MAX_CONNECTIONS (default: 151)
  MYSQL_FT_MIN_WORD_LEN (default: 4)
  MYSQL_FT_MAX_WORD_LEN (default: 20)
  MYSQL_AIO (default: 1)
  MYSQL_KEY_BUFFER_SIZE (default: 32M or 10% of available memory)
  MYSQL_MAX_ALLOWED_PACKET (default: 200M)
  MYSQL_TABLE_OPEN_CACHE (default: 400)
  MYSQL_SORT_BUFFER_SIZE (default: 256K)
  MYSQL_READ_BUFFER_SIZE (default: 8M or 5% of available memory)
  MYSQL_INNODB_BUFFER_POOL_SIZE (default: 32M or 50% of available memory)
  MYSQL_INNODB_LOG_FILE_SIZE (default: 8M or 15% of available memory)
  MYSQL_INNODB_LOG_BUFFER_SIZE (default: 8M or 15% of available memory)

For more information, see https://github.com/sclorg/mariadb-container

Pls note that I have provided the needed env vars as mentioned above... I tried both.. providing it via secret or via deloyment env var during creation of the pod but it still fails the same way

MariaDB container doesn't remove anonymous users which causes the wildcard '%' NOT to evaluate to 'localhost'

From MariaDB Documentation the Anonymous Accounts should be removed when the database is used in production.

When this anonymous user is present, the '%' wildcard character doesn't include 'localhost' value.
This leads to the issue described in BZ#2080804

This problem is also described in this StackOverflow issue

There are two ways to fix the problem:

  1. Add 'root'@'localhost' and '$MYSQL_USER'@'localhost' users in root-common/usr/share/container-scripts/mysql/common.sh

    • This solution should be used if we don't want to remove anonymous users from the database and we leave that up to the customers that use our container
  2. Remove the anonymous user from the database (DELETE FROM mysql.user WHERE User=''; FLUSH PRIVILEGES;)

    • This could be an issue if any customer relies on having the anonymous users created and use them for some testing purposes
    • IMPORTANT -> If we decide to remove anonymous users, we need to remove them before creating our users, if anonymous users are not dropped before creating any other users, the '%' wildcard won't evaluate to 'localhost' and the bug described in linked Bugzilla won't be fixed.

Old data are not detected

MySQL and MariaDB use versions that consist of three numbers (e.g. 5.6.23). When two versions are different only in the last part, they are compatible, but when upgrading from e.g. 5.6 to 5.7, we need to consider upgrading as described in https://dev.mysql.com/doc/refman/5.7/en/upgrading-from-previous-series.html. Currently, there is no check whether the data come from a different version (incompatible) so it can happen that users by mistake change the version of the image and they can see errors or even data corruption when not using the standard upgrading scenario described in the documentation.

Fix OpenShift 4 tests

The OpenShift 4 tests are failing on image stream test suite.

The proper imagestream tag should be used.

Running image stream test for stream test/../imagestreams/mariadb-rhel.json and template test/../examples/mariadb-ephemeral-template.json
Now using project "sclorg-test-7641" on server "https://api.core-serv-ocp.hosted.psi.rdu2.redhat.com:6443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app ruby~https://github.com/sclorg/ruby-ex.git

to build a new example application in Python. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node

secret/6340056-core-services-apps-ci-pull-secret created
imagestream.image.openshift.io/mariadb created
secret/mariadb created
service/mariadb created
deploymentconfig.apps.openshift.io/mariadb created
Waiting for mariadb pod becoming ready .......................................... FAIL
NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/mariadb   ClusterIP   172.30.182.74   <none>        3306/TCP   68s

NAME                                         REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfig.apps.openshift.io/mariadb   0          1         0         config,image(mariadb:10.5)

NAME                                     IMAGE REPOSITORY                                                            TAGS                                          UPDATED
imagestream.image.openshift.io/mariadb   image-registry.openshift-image-registry.svc:5000/sclorg-test-7641/mariadb   10.3,10.3-el7,10.3-el8,10.5-el7 + 2 more...   2 minutes ago
In project sclorg-test-7641 on server https://api.core-serv-ocp.hosted.psi.rdu2.redhat.com:6443

svc/mariadb - 172.30.182.74:3306
  dc/mariadb deploys istag/mariadb:10.5 
    deployment #1 waiting on image or update

1 warning identified, use 'oc status --suggest' to see details.
Build config bc/ does not exist for some reason.
Import probably failed.
OpenShift tests for rhscl/mariadb-105-rhel7:1 failed.
make: *** [test-openshift-4] Error 1

plugin-dir set incorrectly in my-base.cnf.template

Container scripts generate /etc/my.cnf.d/base.cnf from /usr/share/container-scripts/mysql/pre-init/my-base.cnf.template, which includes:

plugin-dir = ${MYSQL_PREFIX}/lib64/mysql/plugin

However, plugins are installed by the package in /usr/lib64/mariadb/plugin, so plugins cannot be found by MariaDB. I believe this should be changed to:

plugin-dir = ${MYSQL_PREFIX}/lib64/mariadb/plugin

must specify a user that is numeric and within the range of allowed users

i make
oc new-app mariadb:10.3~https://github.com/sclorg/mariadb-container.git --name mariadb103 --context-dir=examples/extend-image --env MYSQL_OPERATIONS_USER=opuser --env MYSQL_OPERATIONS_PASSWORD=oppass --env MYSQL_DATABASE=opdb --env MYSQL_USER=user --env MYSQL_PASSWORD=pass --strategy=source

and get error 'must specify a user that is numeric and within the range of allowed users'
How i make fix this problem.

Handle file permissions in Dockerfile

When we share container sources over FTP, permissions don't need to be kept. Then it can happen that image will be build but not working, because scripts in /usr/bin need to be executable.

mysql cli cannot input utf8

Hi!

Using centos/mariadb-102-centos7 I cannot input utf8-characters in the cli:

> oc rsh mariadb-....
sh-4.2$ export LC_ALL=en_US.UTF-8
sh-4.2$ mysql -u root --default-character-set=utf8
MariaDB [(none)]>

In that prompt I now cannot enter any non-latin1-character, not directly (with keyboard) and not by copy-paste.

ERROR 1133 (28000) at line 1: Can't find any matching row in the user table

Facing this error while composing: ERROR 1133 (28000) at line 1: Can't find any matching row in the user table

mysql-container    | ---> 01:02:48     Waiting for MySQL to start ...
mysql-container    | 180524  1:02:48 [Note] /opt/rh/rh-mariadb100/root/usr/libexec/mysqld (mysqld 10.0.28-MariaDB) starting as process 29 ...
mysql-container    | 180524  1:02:48 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mysql-container    | 180524  1:02:48 [Note] InnoDB: The InnoDB memory heap is disabled
mysql-container    | 180524  1:02:48 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql-container    | 180524  1:02:48 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql-container    | 180524  1:02:48 [Note] InnoDB: Compressed tables use zlib 1.2.7
mysql-container    | 180524  1:02:48 [Note] InnoDB: Using Linux native AIO
mysql-container    | 180524  1:02:48 [Note] InnoDB: Using CPU crc32 instructions
mysql-container    | 180524  1:02:48 [Note] InnoDB: Initializing buffer pool, size = 32.0M
mysql-container    | 180524  1:02:48 [Note] InnoDB: Completed initialization of buffer pool
mysql-container    | 180524  1:02:48 [Note] InnoDB: Highest supported file format is Barracuda.
mysql-container    | 180524  1:02:48 [Note] InnoDB: 128 rollback segment(s) are active.
mysql-container    | 180524  1:02:48 [Note] InnoDB: Waiting for purge to start
mysql-container    | 180524  1:02:48 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.32-79.0 started; log sequence number 3795701817
mysql-container    | 180524  1:02:48 [Note] Plugin 'FEEDBACK' is disabled.
mysql-container    | 180524  1:02:48 [Warning] 'user' entry 'root@8678a873616c' ignored in --skip-name-resolve mode.
mysql-container    | 180524  1:02:48 [Warning] 'user' entry '@8678a873616c' ignored in --skip-name-resolve mode.
mysql-container    | 180524  1:02:48 [Warning] 'proxies_priv' entry '@% root@8678a873616c' ignored in --skip-name-resolve mode.
mysql-container    | 180524  1:02:48 [Note] /opt/rh/rh-mariadb100/root/usr/libexec/mysqld: ready for connections.
mysql-container    | Version: '10.0.28-MariaDB'  socket: '/tmp/mysql.sock'  port: 0  MariaDB Server
mysql-container    | ---> 01:02:49     MySQL started successfully
mysql-container    | => sourcing 50-passwd-change.sh ...
mysql-container    | ---> 01:02:49     Setting passwords ...
mysql-container    | ERROR 1133 (28000) at line 1: Can't find any matching row in the user table
mysql-container exited with code 1

This is my environment config:

        environment:
          - MYSQL_DATABASE=my_db
          - MYSQL_USER=my_user
          - MYSQL_PASSWORD=my_user

I'm wondering why this script is attempting to setup the password, without making sure the user already exists: root-common/usr/share/container-scripts/mysql/init/50-passwd-change.sh#L8 Maybe creating the user prior to setting password makes sense.
It worths to mention that following environment configuration works fine:

        environment:
          - MYSQL_ROOT_PASSWORD=whatever

Upgrade from centos/mariadb (5.5) to centos/mariadb-100-centos7 is missing data

I am upgrading an existing Django application that uses centos/mariadb to centos/mariadb-100-centos7.

I don't see error when firing up the new DB container but the application reports it can't find it's migrations, which looks like missing data.

Both containers mount the actual data under /var/lib/mysql. The data lives in a separate volume.

MariaDB 10.4 OpenShift image?

Are there any plans to have an officially supported MariaDB 10.4 image for OpenShift like you have for 10.1, 10.2?

On OpenShift Online Container Catalog, the link to README.md points to a symlink

On OpenShift Online Service Catalog, the link to README.md points to a symlink instead the actual README.md file. It's the same link destination pointed by the "View Documentation" hyperlink.

Screenshot from OpenShift Online Service Catalog

The link is: https://github.com/sclorg/mariadb-container/blob/master/10.1/README.md
Screenshot from GitHub page

The actual file can be found in: https://github.com/sclorg/mariadb-container/blob/master/10.1/root/usr/share/container-scripts/mysql/README.md

The same goes to mysql-container.

Pod creation fails inspite of MYSQL_ROOT_PASSWORD being present

I am trying to create a mariadb Pod that will have a db and tables pre-created.
In order to achive that, I am using a Dockerfile as below

FROM registry.redhat.io/rhel8/mariadb-105

# needed for intialization
ENV MYSQL_ROOT_PASSWORD=root
ENV MYSQL_DATABASE=qod

COPY 1_createdb.sql /tmp/
COPY 2_authors.sql /tmp/
COPY 3_genres.sql /tmp/
COPY 4_quotes_sm.sql /tmp/

COPY run.sh /usr/share/container-scripts/mysql/init/

CMD ["run-mysqld"]

My github repo is:
https://github.com/dpkshetty/qod-db/tree/v2

Inspite of MYSQL_ROOT_PASSWORD defined in the Dockerfile, the Pod fails to run and errors out with the below msg...

=> sourcing 20-validate-variables.sh ...
You must either specify the following environment variables:
  MYSQL_USER (regex: '^[a-zA-Z0-9_]+$')
  MYSQL_PASSWORD (regex: '^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$')
  MYSQL_DATABASE (regex: '^[a-zA-Z0-9_]+$')
Or the following environment variable:
  MYSQL_ROOT_PASSWORD (regex: '^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$')
Or both.
Optional Settings:
  MYSQL_LOWER_CASE_TABLE_NAMES (default: 0)
  MYSQL_LOG_QUERIES_ENABLED (default: 0)
  MYSQL_MAX_CONNECTIONS (default: 151)
  MYSQL_FT_MIN_WORD_LEN (default: 4)
  MYSQL_FT_MAX_WORD_LEN (default: 20)
  MYSQL_AIO (default: 1)
  MYSQL_KEY_BUFFER_SIZE (default: 32M or 10% of available memory)
  MYSQL_MAX_ALLOWED_PACKET (default: 200M)
  MYSQL_TABLE_OPEN_CACHE (default: 400)
  MYSQL_SORT_BUFFER_SIZE (default: 256K)
  MYSQL_READ_BUFFER_SIZE (default: 8M or 5% of available memory)
  MYSQL_INNODB_BUFFER_POOL_SIZE (default: 32M or 50% of available memory)
  MYSQL_INNODB_LOG_FILE_SIZE (default: 8M or 15% of available memory)
  MYSQL_INNODB_LOG_BUFFER_SIZE (default: 8M or 15% of available memory)

For more information, see https://github.com/sclorg/mariadb-container

10.3 image not on DockerHub

I'm getting a 404 when following the link in the 10.3 README. Looks like its not actually being uploaded to DockerHub? Is this intentional? We'd like to use the 10.3 image without having to build it and push it to our own registry.

Value of MYSQL_DEFAULTS_FILE seems to be ignored

We are trying to create a persistence container running the following command:

docker run --name persistence -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -e MYSQL_DEFAULTS_FILE=/persistence/conf/mariadb.cnf -v /home/persistence:/persistence/conf -p 3306:3306 centos/mariadb-102-centos7

We expect to see that our mariadb configuration is loaded from /persistence/conf/mariadb.cnf file, but it is not. We only see the default configuration values in the database.

Are we missing something from the command above?

Example Template Liveness/Readiness Probe Errors

The following Maria DB Templates have an incorrectly configured liveness/readiness probe:

When the probes are executed the following warning is logged in the pod:

2021-05-03 20:19:23 29 [Warning] Access denied for user 'userHFP'@'localhost' (using password: YES)
2021-05-03 20:19:27 30 [Warning] Access denied for user 'userHFP'@'localhost' (using password: YES)
2021-05-03 20:19:33 31 [Warning] Access denied for user 'userHFP'@'localhost' (using password: YES)

The probe should be two commands seperated by ; or &&:

"command": [
	"/bin/sh",
	"-i",
	"-c",
	"MYSQL_PWD=\"$MYSQL_PASSWORD\" && mysqladmin -u $MYSQL_USER ping"
]

Executing the command manually generates the following for the current probe:

sh-4.4$ MYSQL_PWD=\"$MYSQL_PASSWORD\" mysqladmin -u $MYSQL_USER ping
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'dbuser'@'localhost' (using password: YES)'

With the correction:

sh-4.4$ MYSQL_PWD=\"$MYSQL_PASSWORD\" && mysqladmin -u $MYSQL_USER ping
mysqld is alive

Encoding settings

Is there a way to set --character-set-server and --collation-server without modifying the default my.cnf file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.