Browse Source

Troca para SolrCloud

pull/2100/head
Edward Ribeiro 7 years ago
parent
commit
b1225e574b
  1. 7
      docker-compose.yml
  2. 7
      docker_solr_init.py
  3. 21
      sapl/settings.py
  4. BIN
      solr/sapl_configset/conf/saplConfigSet.zip

7
docker-compose.yml

@ -11,16 +11,17 @@ services:
volumes:
- sapldb_data:/var/lib/postgresql/data/
ports:
- "5432:5432"
- "5433:5432"
saplsolr:
image: solr:7.4-alpine
restart: always
command: bin/solr start -c -f
volumes:
- solr_data:/opt/solr/server/solr
- solr_configsets:/opt/solr/server/solr/configsets
ports:
- "8983:8983"
- "8984:8983"
sapl:
image: interlegis/sapl:3.1.106-ALPHA
@ -35,6 +36,8 @@ services:
EMAIL_HOST: smtp.dominio.net
EMAIL_HOST_USER: usuariosmtp
EMAIL_HOST_PASSWORD: senhasmtp
SOLR_CORE: sapl_bento_goncalves
SOLR_HOST: 10.1.10.192
SOLR_URL: http://saplsolr:8983/solr/sapl
TZ: America/Sao_Paulo
volumes:

7
docker_solr_init.py

@ -89,14 +89,15 @@ if __name__ == '__main__':
args = sys.argv
if len(args) < 2:
print("Usage: python3 docker_solr_init.py <core name> <host>")
print("Usage: python3 docker_solr_init.py <core name> <address>")
sys.exit(-1)
core = args[1]
client = SolrClient()
if len(args) == 3:
hostname = args[2]
client = SolrClient(address=hostname)
address = args[2]
client = SolrClient(address=address)
if not client.exists_core(core):
print("Core '%s' doesn't exists. Creating a new one..." % core)

21
sapl/settings.py

@ -101,10 +101,27 @@ HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
SEARCH_BACKEND = 'haystack.backends.whoosh_backend.WhooshEngine'
SEARCH_URL = ('PATH', PROJECT_DIR.child('whoosh'))
USE_SOLR = config('USE_SOLR', cast=bool, default=False)
SOLR_URL = config('SOLR_URL', cast=str, default='')
if SOLR_URL:
SOLR_HOST = config('SOLR_HOST', cast=str, default='localhost')
SOLR_CORE = config('SOLR_CORE', cast=str, default='sapl')
if USE_SOLR:
SEARCH_BACKEND = 'haystack.backends.solr_backend.SolrEngine'
SEARCH_URL = ('URL', config('SOLR_URL', cast=str))
if SOLR_URL:
SEARCH_URL = ('URL', SOLR_URL)
elif SOLR_HOST and SOLR_CORE:
SEARCH_URL = ('URL', 'http://{}:8983/solr/{}'.format(SOLR_HOST, SOLR_CORE))
# elif SOLR_HOST:
# SEARCH_URL = ('URL', 'http://{}:8983/solr/sapl'.format(SOLR_HOST))
# elif SOLR_CORE:
# SEARCH_URL = ('URL', 'http://localhost:8983/solr/sapl'.format(SOLR_CORE))
else:
SEARCH_URL = ('URL', 'http://localhost:8983/solr/sapl')
print("Solr URL: {}".format(SEARCH_URL[1]))
# ...or for multicore...
# 'URL': 'http://127.0.0.1:8983/solr/mysite',

BIN
solr/sapl_configset/conf/saplConfigSet.zip

Binary file not shown.
Loading…
Cancel
Save