Installation instructions for development enviroments.
The holmes-api requires the following tools to work:
- MySQL
- Python
- python-pip
- Redis
The holmes-api software has a Makefile to help with common tasks. To install, just type:
make setup
To install data/migrations:
make drop data
To run:
make run
To test:
make test
To test without migrations:
make redis_test unit
Holmes supports ElasticSearch for faster searches on big databases.
After having ES properly installed and configured, optionally run:
make elasticsearch # to start the ES server as daemon
To shut it down later, run:
make kill_elasticsearch # to kill the ES server daemon
Bear in mind that, for testing purposes, overriding these variables is optional.
To set it as the default search provider:
SEARCH_PROVIDER = 'holmes.search_providers.elastic.ElasticSearchProvider'
Or if authentication is required (see [OAuth 2.0] below):
SEARCH_PROVIDER = 'holmes.search_providers.elastic.ElasticOverOAuthSearchProvider'
If -- and only if -- ES runs on a host and/or port other than localhost:9200, set one of or both the following variables accordingly:
ELASTIC_SEARCH_HOST = 'HOST' # hostname or IP address
ELASTIC_SEARCH_PORT = PORT # default is 9200
Should you need or want to use a different index name, just set it at your own will:
ELASTIC_SEARCH_INDEX = 'INDEX' # name of the index
Prior to running the API, setup the index and optionally index all the active reviews:
make elasticsearch_setup # to create the index
make elasticsearch_index # to index all active reviews (optional, may take too long)
Tests expect elasticsearch to be running on the default port 9200. The index name is holmes-test
. So, to test:
make test # this creates the test index for you
or
make elasticsearch_drop_test # to delete the test index
make elasticsearch_setup_test # to create the test index
make unit # to run unit tests
Happy contributing!