Skip to content

Commit

Permalink
Test build for #1024
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevicenzi authored and SUSE Update Bot committed Apr 16, 2024
1 parent 92b617f commit 8b2d474
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 2 deletions.
74 changes: 72 additions & 2 deletions mariadb-image/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
# The openSUSE Tumbleweed MariaDB Server Container image
# MariaDB Server Container Image

MariaDB Server container based on the openSUSE Tumbleweed Base Container Image.
MariaDB is one of the most popular database servers in the world. It's made by the original developers of MySQL and guaranteed to stay open source.

## How to use this image

By default, the image launches MariaDB with the same configuration as the one
that comes with SUSE Linux Enterprise Server. The differences are that logging is
sent to stdout and binding to `localhost` is disabled.

The only environment variable that is required to start the container is the MariaDB root password.

```ShellSession
$ podman run -it --rm -p 3306:3306 -e MARIADB_ROOT_PASSWORD=my-password registry.suse.com/suse/mariadb:latest
```

or:

```ShellSession
$ podman run -it --rm -p 3306:3306 -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 registry.suse.com/suse/mariadb:latest
```

## Volumes

The default data directory location is `/var/lib/mysql`.

We encourage users of the MariaDB images to use one of the following options:

* Use a named volume using the container manager to manage the storage of your database data by writing the database files to disk on the host system using its own internal volume management. This is the default and is easy and fairly transparent to the user. The downside is that the files may be hard to locate for tools and applications that run directly on the host system, i.e. outside containers.
* Create a data directory on the host system (outside the container) and mount this to a directory visible from inside the container. This places the database files in a known location on the host system, and makes it easy for tools and applications on the host system to access the files. The downside is that the user needs to make sure that the directory exists, and that e.g. directory permissions and other security mechanisms on the host system are set up correctly.

To mount a host directory as a volume for you data simply run:

```ShellSession
$ podman run -it --rm -v /my/own/datadir:/var/lib/mysql:Z -p 3306:3306 -e MARIADB_ROOT_PASSWORD=my-password registry.suse.com/suse/mariadb:latest
```

The `-v /my/own/datadir:/var/lib/mysql:Z` part of the command mounts the `/my/own/datadir` directory from the underlying host system as `/var/lib/mysql` inside the container, where MariaDB by default will write its data files.

## Environment Variables

One of `MARIADB_RANDOM_ROOT_PASSWORD`, `MARIADB_ROOT_PASSWORD_HASH`, `MARIADB_ROOT_PASSWORD` or `MARIADB_ALLOW_EMPTY_ROOT_PASSWORD` (or equivalents, including `*_FILE`), is required.

All other environment variables are optional.

The complete list of environment variables is documented on MariaDB's Knowledge Base [MariaDB Server Docker Official Image Environment Variables](https://mariadb.com/kb/en/mariadb-server-docker-official-image-environment-variables/).

## Health, Liveness and Readiness

There's no explicit health checks added to the container image. However, you can use the `healthcheck.sh` script to choose from a (non-exhaustive) list of tests to check for whatever you consider health/liveness/readiness.

If there is no database initialized when the container starts, then a default database will be created. This means that incoming connections will not be accepted until the initialization completes. Use the `healthcheck.sh` script to check for container readiness.

To learn about `healthcheck.sh`, how to use it and which exact tests are provided check MariaDB's Knowledge Base [Using Healthcheck.sh](https://mariadb.com/kb/en/using-healthcheck-sh/).

## Usage against an existing database

If you start your MariaDB container instance with a data directory that already contains a database (specifically, a MySQL subdirectory), no environment variables that control initialization will be needed or examined, and no pre-existing databases will be changed.

The only exception is the `MARIADB_AUTO_UPGRADE` environment variable, that if set, might cause `mysql_upgrade` or `mariadb-upgrade` to run, which might change the system tables.

## Backups and Restores

Backing up and restoring databases is important in containers too. The documentation on how to do this can be found on the MariaDB Knowledge Base [Container Backup and Restoration](https://mariadb.com/kb/en/container-backup-and-restoration/).

## Licensing
`SPDX-License-Identifier: MIT`

The build recipe and this documentation is licensed as MIT.
The container itself contains various software components under various open source licenses listed in the associated
Software Bill of Materials (SBOM).

This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/).
6 changes: 6 additions & 0 deletions mariadb-image/_service
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@
<param name="package">mariadb</param>
<param name="parse-version">minor</param>
</service>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">README.md</param>
<param name="regex">%%mariadb_version%%</param>
<param name="package">mariadb</param>
<param name="parse-version">minor</param>
</service>
</services>

0 comments on commit 8b2d474

Please sign in to comment.