Skip to content

Commit

Permalink
[bitnami/mariadb] Release 11.2.2-debian-11-r2 (#54810)
Browse files Browse the repository at this point in the history
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
  • Loading branch information
bitnami-bot authored Jan 16, 2024
1 parent d603d15 commit 1b9e728
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 12 deletions.
6 changes: 3 additions & 3 deletions bitnami/mariadb/11.2/debian-11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ ARG TARGETARCH

LABEL com.vmware.cp.artifact.flavor="sha256:1e1b4657a77f0d47e9220f0c37b9bf7802581b93214fff7d1bd2364c8bf22e8e" \
org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \
org.opencontainers.image.created="2023-12-20T08:29:43Z" \
org.opencontainers.image.created="2024-01-16T14:50:05Z" \
org.opencontainers.image.description="Application packaged by VMware, Inc" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="11.2.2-debian-11-r1" \
org.opencontainers.image.ref.name="11.2.2-debian-11-r2" \
org.opencontainers.image.title="mariadb" \
org.opencontainers.image.vendor="VMware, Inc." \
org.opencontainers.image.version="11.2.2"
Expand All @@ -26,7 +26,7 @@ SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"]
RUN install_packages ca-certificates curl libaio1 libaudit1 libcap-ng0 libcrypt1 libgcc-s1 libicu67 liblzma5 libncurses6 libpam0g libssl1.1 libstdc++6 libtinfo6 libxml2 procps psmisc zlib1g
RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \
COMPONENTS=( \
"ini-file-1.4.6-4-linux-${OS_ARCH}-debian-11" \
"ini-file-1.4.6-5-linux-${OS_ARCH}-debian-11" \
"mariadb-11.2.2-0-linux-${OS_ARCH}-debian-11" \
) ; \
for COMPONENT in "${COMPONENTS[@]}"; do \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"arch": "amd64",
"distro": "debian-11",
"type": "NAMI",
"version": "1.4.6-4"
"version": "1.4.6-5"
},
"mariadb": {
"arch": "amd64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi

script=$1
exit_code="${2:-96}"
fail_if_not_present="${3:-y}"
fail_if_not_present="${3:-n}"

if test -f "$script"; then
sh $script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,49 @@ pid_file=${DB_PID_FILE}
EOF
}

########################
# Make a dump on master database and update slave database
# Globals:
# DB_*
# Arguments:
# None
# Returns:
# None
#########################
mysql_exec_initial_dump() {
info "MySQL dump master data start..."
mysql -h "$DB_MASTER_HOST" -P "$DB_MASTER_PORT_NUMBER" -u "$DB_MASTER_ROOT_USER" -p"$DB_MASTER_ROOT_PASSWORD" -e 'RESET MASTER;'

databases=("mysql")
if [ -n "$DB_DATABASE" ]; then
databases+=("$DB_DATABASE")
fi
for DB in "${databases[@]}"; do
info "Start dump process database $DB"
if [[ $DB = @(information_schema|performance_schema|sys) ]]; then
info "Skipping default table $DB to be imported"
continue
fi
DUMP_FILE="$DB_DATA_DIR/dump_$DB.sql"
if mysqldump --verbose -h "$DB_MASTER_HOST" -P "$DB_MASTER_PORT_NUMBER" -u "$DB_MASTER_ROOT_USER" -p"$DB_MASTER_ROOT_PASSWORD" "$DB" > "$DUMP_FILE"; then
info "Finish dump database $DB"
info "Ensure database exists $DB"
mysql -u "$DB_MASTER_ROOT_USER" <<EOF
create database if not exists $DB;
EOF
info "Start import dump database $DB"
mysql_execute "$DB" < "$DUMP_FILE"
info "Finish import dump database $DB"
else
info "Error creating dump"
fi
info "Remove dump file"
rm -f "$DUMP_FILE"
info "Finish dump process database $DB"
done
info "MySQL dump master data finish..."
}

########################
# Migrate old custom configuration files
# Globals:
Expand All @@ -194,6 +237,11 @@ mysql_configure_replication() {
while ! echo "select 1" | mysql_remote_execute "$DB_MASTER_HOST" "$DB_MASTER_PORT_NUMBER" "mysql" "$DB_MASTER_ROOT_USER" "$DB_MASTER_ROOT_PASSWORD"; do
sleep 1
done

if [[ "$DB_REPLICATION_SLAVE_DUMP" = "true" ]]; then
mysql_exec_initial_dump
fi

debug "Replication master ready!"
debug "Setting the master configuration"
mysql_execute "mysql" <<EOF
Expand Down
55 changes: 48 additions & 7 deletions bitnami/mariadb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ Trademarks: This software listing is packaged by Bitnami. The respective tradema
docker run --name mariadb -e ALLOW_EMPTY_PASSWORD=yes bitnami/mariadb:latest
```

### Docker Compose

```console
curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/mariadb/docker-compose.yml > docker-compose.yml
docker-compose up -d
```

**Warning**: These quick setups are only intended for development environments. You are encouraged to change the insecure default credentials and check out the available configuration options in the [Configuration](#configuration) section for a more secure deployment.

## Why use Bitnami Images?
Expand Down Expand Up @@ -175,6 +168,48 @@ docker-compose up -d

## Configuration

### Environment variables

#### Customizable environment variables

| Name | Description | Default Value |
|-----------------------------------|---------------------------------------------------------------------------------------------------------------------------|---------------|
| `ALLOW_EMPTY_PASSWORD` | Allow MariaDB access without any password. | `no` |
| `MARIADB_ROOT_USER` | MariaDB database root user. | `root` |
| `MARIADB_MASTER_PORT_NUMBER` | Port number for the MariaDB master node. | `3306` |
| `MARIADB_MASTER_ROOT_USER` | MariaDB database root user of the master host. | `root` |
| `MARIADB_MASTER_DELAY` | MariaDB database replication delay. | `0` |
| `MARIADB_SKIP_TEST_DB` | Whether to skip creating the test database. | `no` |
| `MARIADB_CLIENT_ENABLE_SSL` | Whether to force SSL for connections to the MariaDB database. | `no` |
| `MARIADB_CLIENT_EXTRA_FLAGS` | Whether to force SSL connections with the "mysql" CLI tool. Useful for applications that rely on the CLI instead of APIs. | `no` |
| `MARIADB_STARTUP_WAIT_RETRIES` | Number of retries waiting for the database to be running. | `300` |
| `MARIADB_STARTUP_WAIT_SLEEP_TIME` | Sleep time between retries waiting for the database to be running. | `2` |
| `MARIADB_ENABLE_SLOW_QUERY` | Whether to enable slow query logs. | `0` |
| `MARIADB_LONG_QUERY_TIME` | How much time, in seconds, defines a slow query. | `10.0` |

#### Read-only environment variables

| Name | Description | Value |
|---------------------------------|--------------------------------------------------------------|---------------------------------|
| `DB_FLAVOR` | SQL database flavor. Valid values: `mariadb` or `mysql`. | `mariadb` |
| `DB_BASE_DIR` | Base path for MariaDB files. | `${BITNAMI_ROOT_DIR}/mariadb` |
| `DB_VOLUME_DIR` | MariaDB directory for persisted files. | `${BITNAMI_VOLUME_DIR}/mariadb` |
| `DB_DATA_DIR` | MariaDB directory for data files. | `${DB_VOLUME_DIR}/data` |
| `DB_BIN_DIR` | MariaDB directory where executable binary files are located. | `${DB_BASE_DIR}/bin` |
| `DB_SBIN_DIR` | MariaDB directory where service binary files are located. | `${DB_BASE_DIR}/sbin` |
| `DB_CONF_DIR` | MariaDB configuration directory. | `${DB_BASE_DIR}/conf` |
| `DB_LOGS_DIR` | MariaDB logs directory. | `${DB_BASE_DIR}/logs` |
| `DB_TMP_DIR` | MariaDB directory for temporary files. | `${DB_BASE_DIR}/tmp` |
| `DB_CONF_FILE` | Main MariaDB configuration file. | `${DB_CONF_DIR}/my.cnf` |
| `DB_PID_FILE` | MariaDB PID file. | `${DB_TMP_DIR}/mysqld.pid` |
| `DB_SOCKET_FILE` | MariaDB Server socket file. | `${DB_TMP_DIR}/mysql.sock` |
| `DB_DAEMON_USER` | Users that will execute the MariaDB Server process. | `mysql` |
| `DB_DAEMON_GROUP` | Group that will execute the MariaDB Server process. | `mysql` |
| `MARIADB_DEFAULT_PORT_NUMBER` | Default port number to use for the MariaDB Server service. | `3306` |
| `MARIADB_DEFAULT_CHARACTER_SET` | Default MariaDB character set. | `utf8mb4` |
| `MARIADB_DEFAULT_BIND_ADDRESS` | Default MariaDB bind address. | `0.0.0.0` |
| `MARIADB_DISABLE_SERVICE` | Whether to disable the MariaDB service by default. | `no` |

### Initializing a new instance

When the container is executed for the first time, it will execute the files with extensions `.sh`, `.sql` and `.sql.gz` located at `/docker-entrypoint-startdb.d`.
Expand Down Expand Up @@ -729,6 +764,12 @@ $ docker-compose up -d
* All volumes have been merged at `/bitnami/mariadb`. Now you only need to mount a single volume at `/bitnami/mariadb` for persistence.
* The logs are always sent to the `stdout` and are no longer collected in the volume.

## Using `docker-compose.yaml`

Please be aware this file has not undergone internal testing. Consequently, we advise its use exclusively for development or testing purposes. For production-ready deployments, we highly recommend utilizing its associated [Bitnami Helm chart](https://github.com/bitnami/charts/tree/main/bitnami/mariadb).

If you detect any issue in the `docker-compose.yaml` file, feel free to report it or contribute with a fix by following our [Contributing Guidelines](https://github.com/bitnami/containers/blob/main/CONTRIBUTING.md).

## Contributing

We'd love for you to contribute to this container. You can request new features by creating an [issue](https://github.com/bitnami/containers/issues) or submitting a [pull request](https://github.com/bitnami/containers/pulls) with your contribution.
Expand Down

0 comments on commit 1b9e728

Please # to comment.