Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Latest commit

 

History

History
92 lines (66 loc) · 2.29 KB

install_without_docker.md

File metadata and controls

92 lines (66 loc) · 2.29 KB

Running without Docker

For developing its useful to start/stop the services individually.

Dependencies when not using Docker

The shop and service are depended on the following components:

  • Divolte-collector
  • Elasticsearch (brew install elasticsearch)
  • Kafka (brew install kafka)
  • Redis (brew install redis)

Make sure the components are running:

Start Redis redis-server /usr/local/etc/redis.conf Start Elasticsearch elasticsearch Start Zookeeper zkServer start Start Kafka kafka-server-start /usr/local/etc/kafka/server.properties

Collect Python dependencies:

mkvirtualenv shop --python=python3
workon shop
pip install requests tornado

Configuration

create a config.json file with the following optional configuration items:

{
  "elasticsearch_hosts" : ["127.0.0.1"],
  "elasticsearch_port": 9300,
  "elasticsearch_cluster_name": "shop"
}

Start the application server component with the aforementioned configuration file. If no config file is specified, the following defaults will be used:

{
  "elasticsearch_hosts" : ["127.0.0.1"],
  "elasticsearch_port": 9300,
  "elasticsearch_cluster_name": "elasticsearch"
}

java -jar target/shop-service-0.1-SNAPSHOT.jar server config.json

Building the catalog

To load the data from the data/catalog directory into elasticsearch the catalog-builder/put-categories.py script can be used.

python put-catagories.py \
  ../data/categories/animals.json \
  ../data/categories/architecture.json \
  ../data/categories/cars.json \
  ../data/categories/cities.json \
  ../data/categories/flowers.json \
  ../data/categories/landscape.json \
  ../data/categories/nautical.json

Running the webapp

test -f flask_secret || head -c 48 /dev/random | base64 > flask_secret
python webapp.py --port 9011 --secret "$(cat flask_secret)"

Note: the --secret parameter specifies Flask's session Cookie Secret.

Running the top pick service

The consumer

brew install snappy
pip install avro-python3 kafka redis numpy python-snappy lz4 tornado-redis

cd top-pick-service
python consumer.py --schema ../divolte/schema/src/main/resources/ShopEventRecord.avsc \
  --client toppick-client --group toppick-group

python bandit_service.py