mirror of
https://github.com/bitnami/containers.git
synced 2026-03-21 15:29:05 +08:00
`mysql` client fails when it is started from the docker run command line due to missing `my.cnf`. To workaround this issue, we populate the `conf/` volume from a `cont-init.d/01-initialize-configs` scripts.
34 lines
813 B
Plaintext
Executable File
34 lines
813 B
Plaintext
Executable File
#!/usr/bin/with-contenv bash
|
|
set -e
|
|
source $BITNAMI_PREFIX/bitnami-utils.sh
|
|
|
|
print_welcome_page
|
|
|
|
mkdir -p $BITNAMI_APP_DIR/tmp
|
|
chown -R $BITNAMI_APP_USER:$BITNAMI_APP_USER $BITNAMI_APP_DIR/tmp || true
|
|
|
|
if [ ! -d $BITNAMI_APP_VOL_PREFIX/data/mysql ]; then
|
|
|
|
PROGRAM_OPTIONS="$PROGRAM_OPTIONS --init-file=/tmp/init_mysql.sql"
|
|
|
|
initialize_database
|
|
|
|
create_custom_database
|
|
|
|
create_mysql_user
|
|
|
|
configure_replication
|
|
|
|
print_app_credentials $BITNAMI_APP_NAME $MARIADB_USER `print_mysql_password` `print_mysql_database`
|
|
else
|
|
print_container_already_initialized $BITNAMI_APP_NAME
|
|
fi
|
|
|
|
chown -R $BITNAMI_APP_USER:$BITNAMI_APP_USER \
|
|
$BITNAMI_APP_VOL_PREFIX/conf/ \
|
|
$BITNAMI_APP_VOL_PREFIX/logs/ \
|
|
$BITNAMI_APP_VOL_PREFIX/data/ || true
|
|
|
|
wait_and_tail_logs &
|
|
exec mysqld.bin $PROGRAM_OPTIONS $EXTRA_OPTIONS
|