|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Comes from the parent image |
| 4 | +./start-services |
| 5 | + |
| 6 | +if [ -n "$URL" ] && [ "$URL" != "http://localhost/" ]; then |
| 7 | + echo "Updating Base URL" |
| 8 | + magerun2 config:store:set web/unsecure/base_url $URL |
| 9 | + magerun2 config:store:set web/secure/base_url $URL |
| 10 | + magerun2 config:store:set web/unsecure/base_link_url $URL |
| 11 | + magerun2 config:store:set web/secure/base_link_url $URL |
| 12 | + magerun2 cache:flush |
| 13 | +fi |
| 14 | + |
| 15 | +# Allow to set the commands in an environment variable |
| 16 | +if [[ ! -z "${CUSTOM_ENTRYPOINT_COMMAND}" ]]; then |
| 17 | + echo "${CUSTOM_ENTRYPOINT_COMMAND}" > custom-entrypoint.sh |
| 18 | +fi |
| 19 | + |
| 20 | +if [ -f custom-entrypoint.sh ]; then |
| 21 | + bash ./custom-entrypoint.sh |
| 22 | +fi |
| 23 | + |
| 24 | +if [ "$FLAT_TABLES" = "true" ]; then |
| 25 | + echo "Enabling Flat Tables" |
| 26 | + magerun2 config:store:set catalog/frontend/flat_catalog_category 1 |
| 27 | + magerun2 config:store:set catalog/frontend/flat_catalog_product 1 |
| 28 | + php bin/magento cache:flush |
| 29 | + php bin/magento indexer:reindex |
| 30 | +fi |
| 31 | + |
| 32 | +if [ "$DISABLE_2FA" = "true" ] && grep -q Magento_TwoFactorAuth "app/etc/config.php"; then |
| 33 | + echo "Disabling Two Factor Authentication" |
| 34 | + php bin/magento module:disable Magento_TwoFactorAuth -f |
| 35 | +fi |
| 36 | + |
| 37 | +while sleep 5; do |
| 38 | + ps aux |grep elasticsearch |grep -q -v grep |
| 39 | + ELASTICSEARCH_STATUS=$? |
| 40 | + ps aux |grep mysqld_safe |grep -q -v grep |
| 41 | + MYSQL_STATUS=$? |
| 42 | + ps aux |grep php |grep -q -v grep |
| 43 | + PHP_STATUS=$? |
| 44 | + |
| 45 | + if [ $ELASTICSEARCH_STATUS -ne 0 -o $MYSQL_STATUS -ne 0 -o $PHP_STATUS -ne 0 ]; then |
| 46 | + echo "One of the processes has already exited." |
| 47 | + exit 1 |
| 48 | + fi |
| 49 | +done |
0 commit comments