Skip to content

Commit

Permalink
[FAB-5434] Fix mysql config in fvt image
Browse files Browse the repository at this point in the history
Ubuntu 16.04.1 recently updated the default
mysql-server package to version 5.7.19.
This is causing fvt tests in CI to fail
on x86_64 (s390x uses Debian Jessie which
uses mysql 5.5.55 so is not affected).

This change is based on work in the
mysql images available on Dockerhub.
The change basically dismisses the
postInstall config and initializes
the database and sets the password
when the image starts up.

Change-Id: Ia8cb6a7faa77a5712a8ebf4d061215186c491e5e
Signed-off-by: Gari Singh <[email protected]>
  • Loading branch information
mastersingh24 committed Jul 23, 2017
1 parent b9e8a8e commit bc2b642
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions images/fabric-ca-fvt/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@

POSTGRES_PORT=5432
MYSQL_PORT=3306
MYSQL_VERSION=`mysqld --version|awk '{print $3}'`
LDAP_PORT=389
PORTS=($POSTGRES_PORT $MYSQL_PORT $LDAP_PORT)

timeout=12
su postgres -c 'postgres -D /usr/local/pgsql/data' &
# we need to check the version of mysql as behavior has changed with 5.7.19+
if [[ $MYSQL_VERSION == 5.7* ]] ;
then
echo "detected mysql version ${MYSQL_VERSION}"
rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
&& chmod 777 /var/run/mysqld
mysqld --initialize-insecure
fi

/usr/bin/mysqld_safe --sql-mode=STRICT_TRANS_TABLES &
/etc/init.d/slapd start &

Expand All @@ -24,4 +35,11 @@ for port in ${PORTS[*]}; do
done
done

if [[ $MYSQL_VERSION == 5.7* ]] ;
then
# Set mysql root password
sleep 3
mysqladmin -u root password mysql
fi

exec "$@"

0 comments on commit bc2b642

Please sign in to comment.