Skip to content

Commit

Permalink
Merge pull request #326 from requix/check_elasticsearch_connection
Browse files Browse the repository at this point in the history
Check Elasticsearch connection before setup:install
  • Loading branch information
markshust committed Jan 29, 2021
2 parents 60d4c29 + 2ad86e2 commit 72b3351
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion compose/bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set -o errexit
source env/db.env
BASE_URL=${1:-magento2.test}

ES_HOST=elasticsearch
ES_PORT=9200

bin/stop

docker-compose -f docker-compose.yml up -d
Expand All @@ -21,6 +24,14 @@ echo "Forcing reinstall of composer deps to ensure perms & reqs..."
bin/clinotty composer global require hirak/prestissimo
bin/clinotty composer update

echo "Waiting for connection to Elasticsearch..."
bin/clinotty timeout 30 bash -c "
until curl --silent --output /dev/null http://$ES_HOST:$ES_PORT/_cat/health?h=st; do
printf '.'
sleep 5
done"
[ $? != 0 ] && echo "Failed to connect to Elasticsearch" && exit

bin/clinotty bin/magento setup:install \
--db-host=$MYSQL_HOST \
--db-name=$MYSQL_DATABASE \
Expand Down Expand Up @@ -53,7 +64,8 @@ bin/clinotty bin/magento setup:install \
--session-save-redis-log-level=4 \
--session-save-redis-db=2 \
--search-engine=elasticsearch7 \
--elasticsearch-host=elasticsearch \
--elasticsearch-host=$ES_HOST \
--elasticsearch-port=$ES_PORT \
--use-rewrites=1

echo "Turning on developer mode.."
Expand Down

0 comments on commit 72b3351

Please sign in to comment.