diff --git a/bitnami/mysql/8.0/debian-12/Dockerfile b/bitnami/mysql/8.0/debian-12/Dockerfile index 1c1a297efc58e..4f06b2304f302 100644 --- a/bitnami/mysql/8.0/debian-12/Dockerfile +++ b/bitnami/mysql/8.0/debian-12/Dockerfile @@ -7,11 +7,11 @@ ARG TARGETARCH LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2024-07-25T07:50:27Z" \ + org.opencontainers.image.created="2024-08-24T08:49:47Z" \ org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/mysql/README.md" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="8.0.39-debian-12-r2" \ + org.opencontainers.image.ref.name="8.0.39-debian-12-r3" \ org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/mysql" \ org.opencontainers.image.title="mysql" \ org.opencontainers.image.vendor="Broadcom, Inc." \ @@ -28,7 +28,7 @@ SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"] RUN install_packages ca-certificates curl gcc-11 libaio1 libcom-err2 libgcc-s1 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libsasl2-2 libssl3 libstdc++6 libtinfo6 libtirpc3 procps psmisc RUN mkdir -p /tmp/bitnami/pkg/cache/ ; cd /tmp/bitnami/pkg/cache/ ; \ COMPONENTS=( \ - "ini-file-1.4.7-2-linux-${OS_ARCH}-debian-12" \ + "ini-file-1.4.7-3-linux-${OS_ARCH}-debian-12" \ "mysql-8.0.39-0-linux-${OS_ARCH}-debian-12" \ ) ; \ for COMPONENT in "${COMPONENTS[@]}"; do \ diff --git a/bitnami/mysql/8.0/debian-12/docker-compose-replication.yml b/bitnami/mysql/8.0/debian-12/docker-compose-replication.yml new file mode 100644 index 0000000000000..3dda285752f58 --- /dev/null +++ b/bitnami/mysql/8.0/debian-12/docker-compose-replication.yml @@ -0,0 +1,53 @@ +# Copyright Broadcom, Inc. All Rights Reserved. +# SPDX-License-Identifier: APACHE-2.0 + +version: '2.1' + +services: + mysql-master: + image: docker.io/bitnami/mysql:8.0 + ports: + - '3306' + volumes: + - 'mysql_master_data:/bitnami/mysql/data' + environment: + - MYSQL_REPLICATION_MODE=master + - MYSQL_REPLICATION_USER=repl_user + - MYSQL_USER=my_user + - MYSQL_DATABASE=my_database + # ALLOW_EMPTY_PASSWORD is recommended only for development. + - ALLOW_EMPTY_PASSWORD=yes + - MYSQL_ROOT_PASSWORD=my_root_password + healthcheck: + test: ['CMD', '/opt/bitnami/scripts/mysql/healthcheck.sh'] + interval: 15s + timeout: 5s + retries: 6 + + mysql-slave: + image: docker.io/bitnami/mysql:8.0 + ports: + - '3306' + depends_on: + - mysql-master + environment: + - MYSQL_REPLICATION_MODE=slave + - MYSQL_REPLICATION_USER=repl_user + - MYSQL_USER=my_user + - MYSQL_DATABASE=my_database + - MYSQL_MASTER_HOST=mysql-master + - MYSQL_MASTER_PORT_NUMBER=3306 + - MYSQL_MASTER_ROOT_PASSWORD=my_root_password + # ALLOW_EMPTY_PASSWORD is recommended only for development. + - ALLOW_EMPTY_PASSWORD=yes + # In case of missing binary files on master, use `true` to reset those binary files. Creating a previous backup is recommended. + - MYSQL_REPLICATION_SLAVE_DUMP=false + healthcheck: + test: ['CMD', '/opt/bitnami/scripts/mysql/healthcheck.sh'] + interval: 15s + timeout: 5s + retries: 6 + +volumes: + mysql_master_data: + driver: local diff --git a/bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json b/bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json index 96853b219b167..098d6406acfe7 100644 --- a/bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json +++ b/bitnami/mysql/8.0/debian-12/prebuildfs/opt/bitnami/.bitnami_components.json @@ -3,7 +3,7 @@ "arch": "amd64", "distro": "debian-12", "type": "NAMI", - "version": "1.4.7-2" + "version": "1.4.7-3" }, "mysql": { "arch": "amd64", diff --git a/bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh b/bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh index e329fbac8ef69..e25f74fa53859 100644 --- a/bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh +++ b/bitnami/mysql/8.0/debian-12/rootfs/opt/bitnami/scripts/libmysql.sh @@ -527,96 +527,6 @@ mysql_start_bg() { fi } -######################## -# Ensure a db user exists with the given password for the '%' host -# Globals: -# DB_* -# Flags: -# -p|--password - database password -# -u|--user - database user -# --auth-plugin - authentication plugin -# --use-ldap - authenticate user via LDAP -# --host - database host -# --port - database host -# Arguments: -# $1 - database user -# Returns: -# None -######################### -mysql_ensure_user_exists() { - local -r user="${1:?user is required}" - local password="" - local auth_plugin="" - local use_ldap="no" - local hosts - local auth_string="" - # For accessing an external database - local db_host="" - local db_port="" - - # Validate arguments - shift 1 - while [ "$#" -gt 0 ]; do - case "$1" in - -p|--password) - shift - password="${1:?missing database password}" - ;; - --auth-plugin) - shift - auth_plugin="${1:?missing authentication plugin}" - ;; - --use-ldap) - use_ldap="yes" - ;; - --host) - shift - db_host="${1:?missing database host}" - ;; - --port) - shift - db_port="${1:?missing database port}" - ;; - *) - echo "Invalid command line flag $1" >&2 - return 1 - ;; - esac - shift - done - if is_boolean_yes "$use_ldap"; then - auth_string="identified via pam using '$DB_FLAVOR'" - elif [[ -n "$password" ]]; then - if [[ -n "$auth_plugin" ]]; then - auth_string="identified with $auth_plugin by '$password'" - else - auth_string="identified by '$password'" - fi - fi - debug "creating database user \'$user\'" - - local -a mysql_execute_cmd=("mysql_execute") - local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") - if [[ -n "$db_host" && -n "$db_port" ]]; then - mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") - mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") - fi - - "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <&2 + return 1 + ;; + esac + shift + done + if is_boolean_yes "$use_ldap"; then + auth_string="identified via pam using '$DB_FLAVOR'" + elif [[ -n "$password" ]]; then + if [[ -n "$auth_plugin" ]]; then + auth_string="identified with $auth_plugin by '$password'" + else + auth_string="identified by '$password'" + fi + fi + debug "creating database user \'$user\'" + + local -a mysql_execute_cmd=("mysql_execute") + local -a mysql_execute_print_output_cmd=("mysql_execute_print_output") + if [[ -n "$db_host" && -n "$db_port" ]]; then + mysql_execute_cmd=("mysql_remote_execute" "$db_host" "$db_port") + mysql_execute_print_output_cmd=("mysql_remote_execute_print_output" "$db_host" "$db_port") + fi + + local mysql_create_user_cmd + [[ "$DB_FLAVOR" = "mariadb" ]] && mysql_create_user_cmd="create or replace user" || mysql_create_user_cmd="create user if not exists" + "${mysql_execute_cmd[@]}" "mysql" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD" <=10.11 + local mysql_version="" + local major_version="" + local minor_version="" + mysql_version="$(mysql_get_version)" + major_version="$(get_sematic_version "${mysql_version}" 1)" + minor_version="$(get_sematic_version "${mysql_version}" 2)" + if [[ "${major_version}" -gt 10 ]] || [[ "${major_version}" -eq 10 && "${minor_version}" -eq 11 ]]; then + opts+=("--skip-ssl") + fi + fi fi echo "${opts[@]:-}" }