From 7d5c865ea30e1ccae4a97b27d556b92640e9d776 Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Thu, 30 Oct 2014 21:08:26 -0400 Subject: [PATCH] ElasticSearch for VMs. --- Makefile | 1 + salt/elasticsearch/init.sls | 24 ++++++++++++++++++++++++ salt/system/init.sls | 1 + salt/top.sls | 1 + settings_local.py-template | 4 +++- 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 salt/elasticsearch/init.sls diff --git a/Makefile b/Makefile index 0a1d9c9..a0d02b2 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,7 @@ vagrant: @vagrant ssh -c '$(pm) syncdb;' @$(ssh-vagrant) '$(pm) migrate;' @$(ssh-vagrant) '$(pm) backfill_api_keys' + @$(ssh-vagrant) '$(pm) rebuild_index --noinput' .PHONY: assets, \ db, \ diff --git a/salt/elasticsearch/init.sls b/salt/elasticsearch/init.sls new file mode 100644 index 0000000..e627341 --- /dev/null +++ b/salt/elasticsearch/init.sls @@ -0,0 +1,24 @@ +elasticsearch-file: + file.managed: + - name: /tmp/elasticsearch-1.3.4.deb + - source: https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.deb + - unless: test -d /usr/local/elasticsearch/bin + - source_hash: sha1=6a4b6a12825f141245bb581c76052464d17de874 + +elasticsearch-install: + cmd: + - cwd: /tmp + - names: + - dpkg -i elasticsearch-1.3.4.deb + - unless: test -d /usr/local/elasticsearch/bin + - run + - require: + - file: elasticsearch-file + +elasticsearch: + service: + - running + - enable: True + - reload: True + - require: + - file: elasticsearch-file diff --git a/salt/system/init.sls b/salt/system/init.sls index 9ee48e1..a71d31e 100644 --- a/salt/system/init.sls +++ b/salt/system/init.sls @@ -22,3 +22,4 @@ system: - mercurial - python-dev - tree + - openjdk-7-jdk diff --git a/salt/top.sls b/salt/top.sls index 31c605c..47019bf 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -5,6 +5,7 @@ base: - ssh - users - fish + - elasticsearch - postgresql - nginx - supervisor diff --git a/settings_local.py-template b/settings_local.py-template index 3c79652..d8684c2 100644 --- a/settings_local.py-template +++ b/settings_local.py-template @@ -27,6 +27,8 @@ DATABASES = { } HAYSTACK_CONNECTIONS = { 'default': { - 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine', + 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine', + 'URL': 'http://127.0.0.1:9200/', + 'INDEX_NAME': 'haystack', }, }