[PHP-FPM] Trigger mysql_upgrade
parent
40500ae5b9
commit
04b699a3c7
|
@ -20,6 +20,7 @@ RUN apk add -U --no-cache autoconf \
|
|||
imagemagick \
|
||||
imagemagick-dev \
|
||||
imap-dev \
|
||||
jq \
|
||||
libjpeg-turbo \
|
||||
libjpeg-turbo-dev \
|
||||
libmemcached-dev \
|
||||
|
|
|
@ -14,10 +14,24 @@ until [[ $(redis-cli -h redis-mailcow PING) == "PONG" ]]; do
|
|||
sleep 2
|
||||
done
|
||||
|
||||
# Set a default release format
|
||||
|
||||
if [[ -z $(redis-cli --raw -h redis-mailcow GET Q_RELEASE_FORMAT) ]]; then
|
||||
redis-cli --raw -h redis-mailcow SET Q_RELEASE_FORMAT raw
|
||||
fi
|
||||
|
||||
# Check of mysql_upgrade
|
||||
|
||||
CONTAINER_ID=
|
||||
CONTAINER_ID=$(curl --silent --insecure https://dockerapi/containers/json | jq -r ".[] | {name: .Config.Labels[\"com.docker.compose.service\"], id: .Id}" | jq -rc "select( .name | tostring | contains(\"mysql-mailcow\")) | .id")
|
||||
if [[ ! -z ${CONTAINER_ID} ]]; then
|
||||
SQL_UPGRADE_RETURN=$(curl --silent --insecure -XPOST https://dockerapi/containers/${CONTAINER_ID}/exec -d '{"cmd":"system", "task":"mysql_upgrade"}' --silent -H 'Content-type: application/json' | jq -r .type)
|
||||
if [[ ${SQL_UPGRADE_RETURN} == 'warning' ]]; then
|
||||
echo "MySQL applied an upgrade, restarting PHP-FPM..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Trigger db init
|
||||
echo "Running DB init..."
|
||||
php -c /usr/local/etc/php -f /web/inc/init_db.inc.php
|
||||
|
|
Loading…
Reference in New Issue