From f011db317ef64e84b2c8696007415829d292ba61 Mon Sep 17 00:00:00 2001 From: andryyy Date: Fri, 16 Nov 2018 22:48:28 +0100 Subject: [PATCH] [SOGo] Wait for updated db schema before bootstrapping --- data/Dockerfiles/sogo/bootstrap-sogo.sh | 11 +++++++++++ docker-compose.yml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/data/Dockerfiles/sogo/bootstrap-sogo.sh b/data/Dockerfiles/sogo/bootstrap-sogo.sh index f111bb03..dd9901a7 100755 --- a/data/Dockerfiles/sogo/bootstrap-sogo.sh +++ b/data/Dockerfiles/sogo/bootstrap-sogo.sh @@ -13,6 +13,17 @@ do sleep 3 done +# Wait for updated schema +DBV_NOW=$(mysql --socket=/var/run/mysqld/mysqld.sock -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT version FROM versions;" -BN) +DBV_NEW=$(grep -oE '\$db_version = .*;' init_db.inc.php | sed 's/$db_version = //g;s/;//g' | cut -d \" -f2) +while [[ ${DBV_NOW} != ${DBV_NEW} ]]; do + echo "Waiting for schema update..." + DBV_NOW=$(mysql --socket=/var/run/mysqld/mysqld.sock -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT version FROM versions;" -BN) + DBV_NEW=$(grep -oE '\$db_version = .*;' init_db.inc.php | sed 's/$db_version = //g;s/;//g' | cut -d \" -f2) + sleep 5 +done +echo "DB schema is ${DBV_NOW}" + # Recreate view mysql --socket=/var/run/mysqld/mysqld.sock -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "DROP VIEW IF EXISTS sogo_view" diff --git a/docker-compose.yml b/docker-compose.yml index ace28d13..d0d04e95 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -138,7 +138,7 @@ services: - phpfpm sogo-mailcow: - image: mailcow/sogo:1.42 + image: mailcow/sogo:1.43 build: ./data/Dockerfiles/sogo environment: - DBNAME=${DBNAME}