From 3d2a73474f9f7cbcb7f045bf91be0f955115baf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Wed, 19 Feb 2020 23:08:11 +0100 Subject: [PATCH] added possibility to purge es index --- containers/zammad/docker-entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/containers/zammad/docker-entrypoint.sh b/containers/zammad/docker-entrypoint.sh index b37344f..4a36d6f 100755 --- a/containers/zammad/docker-entrypoint.sh +++ b/containers/zammad/docker-entrypoint.sh @@ -7,6 +7,7 @@ set -e : "${ELASTICSEARCH_PORT:=9200}" : "${ELASTICSEARCH_SCHEMA:=http}" : "${ELASTICSEARCH_SSL_VERIFY:=true}" +: "${ELASTICSEARCH_PURGE:=false}" : "${MEMCACHED_HOST:=zammad-memcached}" : "${MEMCACHED_PORT:=11211}" : "${POSTGRESQL_HOST:=zammad-postgresql}" @@ -98,6 +99,12 @@ if [ "$1" = 'zammad-init' ]; then else SSL_SKIP_VERIFY="" 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 echo "rebuilding es searchindex..." bundle exec rake searchindex:rebuild