if es index exists no index rebuild
This commit is contained in:
parent
c80eaf980b
commit
8c4de19d45
@ -3,6 +3,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
: "${ELASTICSEARCH_HOST:=zammad-elasticsearch}"
|
: "${ELASTICSEARCH_HOST:=zammad-elasticsearch}"
|
||||||
|
: "${ELASTICSEARCH_PORT:=9200}"
|
||||||
: "${MEMCACHED_HOST:=zammad-memcached}"
|
: "${MEMCACHED_HOST:=zammad-memcached}"
|
||||||
: "${POSTGRESQL_HOST:=zammad-postgresql}"
|
: "${POSTGRESQL_HOST:=zammad-postgresql}"
|
||||||
: "${POSTGRESQL_USER:=postgres}"
|
: "${POSTGRESQL_USER:=postgres}"
|
||||||
@ -56,20 +57,22 @@ if [ "$1" = 'zammad-init' ]; then
|
|||||||
|
|
||||||
echo "changing settings..."
|
echo "changing settings..."
|
||||||
# es config
|
# es config
|
||||||
bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:9200')"
|
bundle exec rails r "Setting.set('es_url', 'http://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')"
|
||||||
|
|
||||||
if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASS}" ]; then
|
if [ -n "${ELASTICSEARCH_USER}" ] && [ -n "${ELASTICSEARCH_PASS}" ]; then
|
||||||
bundle exec rails r "Setting.set('es_user', \"${ELASTICSEARCH_USER}\")"
|
bundle exec rails r "Setting.set('es_user', \"${ELASTICSEARCH_USER}\")"
|
||||||
bundle exec rails r "Setting.set('es_password', \"${ELASTICSEARCH_PASS}\")"
|
bundle exec rails r "Setting.set('es_password', \"${ELASTICSEARCH_PASS}\")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
until (echo > /dev/tcp/${ELASTICSEARCH_HOST}/9200) &> /dev/null; do
|
until (echo > /dev/tcp/${ELASTICSEARCH_HOST}/${ELASTICSEARCH_PORT}) &> /dev/null; do
|
||||||
echo "zammad railsserver waiting for elasticsearch server to be ready..."
|
echo "zammad railsserver waiting for elasticsearch server to be ready..."
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "rebuilding es searchindex..."
|
if [ -n "$(curl -s ${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_cat/indices |grep zammad)" ]; then
|
||||||
bundle exec rake searchindex:rebuild
|
echo "rebuilding es searchindex..."
|
||||||
|
bundle exec rake searchindex:rebuild
|
||||||
|
fi
|
||||||
|
|
||||||
# chown everything to zammad user
|
# chown everything to zammad user
|
||||||
chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR}
|
chown -R ${ZAMMAD_USER}:${ZAMMAD_USER} ${ZAMMAD_DIR}
|
||||||
|
Loading…
Reference in New Issue
Block a user