added possibility to purge es index

This commit is contained in:
André Bauer 2020-02-19 23:08:11 +01:00 committed by GitHub
parent b25456ff7d
commit 3d2a73474f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ set -e
: "${ELASTICSEARCH_PORT:=9200}" : "${ELASTICSEARCH_PORT:=9200}"
: "${ELASTICSEARCH_SCHEMA:=http}" : "${ELASTICSEARCH_SCHEMA:=http}"
: "${ELASTICSEARCH_SSL_VERIFY:=true}" : "${ELASTICSEARCH_SSL_VERIFY:=true}"
: "${ELASTICSEARCH_PURGE:=false}"
: "${MEMCACHED_HOST:=zammad-memcached}" : "${MEMCACHED_HOST:=zammad-memcached}"
: "${MEMCACHED_PORT:=11211}" : "${MEMCACHED_PORT:=11211}"
: "${POSTGRESQL_HOST:=zammad-postgresql}" : "${POSTGRESQL_HOST:=zammad-postgresql}"
@ -98,6 +99,12 @@ if [ "$1" = 'zammad-init' ]; then
else else
SSL_SKIP_VERIFY="" SSL_SKIP_VERIFY=""
fi fi
if [ "${ELASTICSEARCH_PURGE}" == "true" ]; then
echo "deleting all es indicies..."
curl -XDELETE ${SSL_SKIP_VERIFY} ${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/*
fi
if ! curl -s ${SSL_SKIP_VERIFY} ${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices | grep -q zammad; then if ! curl -s ${SSL_SKIP_VERIFY} ${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices | grep -q zammad; then
echo "rebuilding es searchindex..." echo "rebuilding es searchindex..."
bundle exec rake searchindex:rebuild bundle exec rake searchindex:rebuild