Allow starting without Elasticsearch. (#171)

* Allow starting without Elasticsearch.

* Document running without Elasticsearch in the README.md.
This commit is contained in:
Jakub Gocławski 2020-09-14 16:11:41 +02:00 committed by GitHub
parent 83438a63a4
commit cf3fd9c090
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 23 deletions

View File

@ -40,6 +40,12 @@ Like this, you can add your `docker-compose.prod.yml` to a branch of your Git re
* RANCHER_URL=http://RANCHER_HOST:8080 rancher-compose --env-file=.env up
## Running without Elasticsearch
Elasticsearch is an optional, but strongly recommended dependency for Zammad. More details can be found in the [documentation](https://docs.zammad.org/en/latest/prerequisites/software.html#elasticsearch-optional). There are however certain scenarios when running without Elasticsearch may be desired, e.g. for very small teams, for teams with limited budget or as a temporary solution for an unplanned Elasticsearch downtime or planned cluster upgrade.
Elasticsearch is enabled by default in the example `docker-compose.yml` file. It is also by default required to run the "zammad-init" command. Disabling Elasticsearch is possible by setting a special environment variable: `ELASTICSEARCH_ENABLED=false` for the `zammad-init` container and removing all references to Elasticsearch everywhere else: the `zammad-elasticsearch` container, it's volume and links to it.
## Upgrading
### From =< 3.3.0-12

View File

@ -3,6 +3,7 @@
set -e
: "${AUTOWIZARD_JSON:=''}"
: "${ELASTICSEARCH_ENABLED:=true}"
: "${ELASTICSEARCH_HOST:=zammad-elasticsearch}"
: "${ELASTICSEARCH_PORT:=9200}"
: "${ELASTICSEARCH_SCHEMA:=http}"
@ -77,6 +78,9 @@ if [ "$1" = 'zammad-init' ]; then
# es config
echo "changing settings..."
if [ "${ELASTICSEARCH_ENABLED}" == "false" ]; then
bundle exec rails r "Setting.set('es_url', '')"
else
bundle exec rails r "Setting.set('es_url', '${ELASTICSEARCH_SCHEMA}://${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}')"
bundle exec rails r "Setting.set('es_index', '${ELASTICSEARCH_NAMESPACE}')"
@ -101,6 +105,7 @@ if [ "$1" = 'zammad-init' ]; then
echo "rebuilding es searchindex..."
bundle exec rake searchindex:rebuild
fi
fi
# chown everything to zammad user
chown -R "${ZAMMAD_USER}":"${ZAMMAD_USER}" "${ZAMMAD_DIR}"