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