mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-30 14:13:43 +01:00
2cedfff4b3
This change reworked the vmware/harbor-db image to build it on top of vmware/mariadb-photon. Also made minor change in the entrypoint script of mariadb image to execute upgrade script during bootstrap, and fix a file permission issue in the bootstrap scripts.
29 lines
796 B
Bash
Executable File
29 lines
796 B
Bash
Executable File
#!/bin/bash
|
|
set +e
|
|
if [ ! -f /var/lib/mysql/created_in_mariadb.flag ]; then
|
|
echo "Maria DB flag not found, the DB was created in mysql image, running upgrade..."
|
|
mysqld >/dev/null 2>&1 &
|
|
pid="$!"
|
|
for i in {30..0}; do
|
|
mysqladmin -uroot -p$MYSQL_ROOT_PASSWORD processlist >/dev/null 2>&1
|
|
if [ $? = 0 ]; then
|
|
break
|
|
fi
|
|
echo 'Waiting for MySQL start...'
|
|
sleep 1
|
|
done
|
|
if [ "$i" = 0 ]; then
|
|
echo >&2 'MySQL failed to start.'
|
|
exit 1
|
|
fi
|
|
set -e
|
|
mysql_upgrade -p$MYSQL_ROOT_PASSWORD
|
|
echo 'Finished upgrading'
|
|
if ! kill -s TERM "$pid" || ! wait "$pid"; then
|
|
echo >&2 'Failed to stop MySQL for upgrading.'
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "DB was created in Maria DB, skip upgrade."
|
|
fi
|