mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-16 11:51:47 +01:00
Move DB migrator image to be based on Maria DB on photon
This commit is contained in:
parent
24e74c4495
commit
ad585499a0
@ -1,16 +1,11 @@
|
||||
FROM mysql:5.6
|
||||
FROM vmware/mariadb-photon:10.2.8
|
||||
|
||||
MAINTAINER bhe@vmware.com
|
||||
|
||||
RUN sed -i -e 's/us.archive.ubuntu.com/archive.ubuntu.com/g' /etc/apt/sources.list
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -y curl python python-pip git python-mysqldb
|
||||
|
||||
RUN pip install alembic
|
||||
|
||||
RUN mkdir -p /harbor-migration
|
||||
RUN tdnf distro-sync || echo \
|
||||
&& tdnf install -y mariadb-devel python2 python2-devel python-pip gcc\
|
||||
linux-api-headers glibc-devel binutils zlib-devel openssl-devel \
|
||||
&& pip install mysqlclient alembic \
|
||||
&& tdnf clean all \
|
||||
&& mkdir -p /harbor-migration
|
||||
|
||||
WORKDIR /harbor-migration
|
||||
|
||||
|
@ -30,7 +30,7 @@ script_location = migration_harbor
|
||||
# are written from script.py.mako
|
||||
# output_encoding = utf-8
|
||||
|
||||
sqlalchemy.url = mysql://$DB_USR:$DB_PWD@localhost:3306/registry
|
||||
sqlalchemy.url = mysql://$DB_USR:$DB_PWD@localhost:3306/registry?unix_socket=/var/run/mysqld/mysqld.sock
|
||||
|
||||
# Logging configuration
|
||||
[loggers]
|
||||
|
@ -8,8 +8,6 @@ fi
|
||||
|
||||
source ./alembic.tpl > ./alembic.ini
|
||||
|
||||
WAITTIME=60
|
||||
|
||||
DBCNF="-hlocalhost -u${DB_USR}"
|
||||
|
||||
#prevent shell to print insecure message
|
||||
@ -44,24 +42,21 @@ fi
|
||||
echo 'Trying to start mysql server...'
|
||||
DBRUN=0
|
||||
mysqld &
|
||||
for i in $(seq 1 $WAITTIME); do
|
||||
echo "$(/usr/sbin/service mysql status)"
|
||||
if [[ "$(/usr/sbin/service mysql status)" =~ "not running" ]]; then
|
||||
sleep 1
|
||||
else
|
||||
DBRUN=1
|
||||
for i in {60..0}; do
|
||||
mysqladmin -u$DB_USR -p$DB_PWD processlist >/dev/null 2>&1
|
||||
if [ $? = 0 ]; then
|
||||
break
|
||||
fi
|
||||
echo 'Waiting for MySQL start...'
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [[ $DBRUN -eq 0 ]]; then
|
||||
if [ "$i" = 0 ]; then
|
||||
echo "timeout. Can't run mysql server."
|
||||
if [[ $1 = "test" ]]; then
|
||||
echo "test failed."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $1 = "test" ]]; then
|
||||
echo "test passed."
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user