shirosaidev / stocksight

Stock market analyzer and predictor using Elasticsearch, Twitter, News headlines and Python natural language processing and sentiment analysis
https://shirosaidev.github.io/stocksight/
Apache License 2.0
2.12k stars 463 forks source link

Error when pulling ElasticSearch Port from config.js via Docker-Compose #22

Closed StephanSalas closed 4 years ago

StephanSalas commented 4 years ago

System Information: OS: Windows 10 Professional Docker Version: 19.0.8 Python Version: 3.7.2

Expected Behavior:

  1. pull down https://github.com/shirosaidev/stocksight/releases/tag/v0.1-b.10 source code.
  2. set config.py elasticsearch_host with the altered container name: "stocksight-01-b10_elasticsearch_1"
  3. set the other config values as appropriate
  4. docker-compose build, docker-compose up
  5. docker exec -it stocksight-01-b10_stocksight_1 bash
  6. run a command to pull back data into kibana (i.e. python sentiment.py -s TSLA -k 'Elon Musk',Musk,Tesla,SpaceX --debug)
  7. The command runs successfully and relevant data is pulled into your kibana instance

Actual Behavior

  1. pull down https://github.com/shirosaidev/stocksight/releases/tag/v0.1-b.10 source, code.
  2. set config.py as with the altered container name: stocksight-01-b10_elasticsearch_1
  3. set the other config values as appropriate
  4. docker-compose build, docker-compose up
  5. docker exec -it stocksight-01-b10_stocksight_1 bash
  6. run a command to pull back data into kibana (i.e. python sentiment.py -s TSLA -k 'Elon Musk',Musk,Tesla,SpaceX --debug)
  7. the command yields the following error: "name 'elasticsearch_port' is not defined stocksight", even though it is clearly defined in the config.yml as 9200 as it should be.

Temporary Resolution I hard-coded the port on line 800 of sentiment.py: es = Elasticsearch(hosts=[{'host': elasticsearch_host, 'port': 9200}],

This seemed to fix the issue for my docker setup. I'm not sure why it's not pulling that port number from the config.yml on my end, but it seems to pull the other config.json imported variables just fine. I suspect is might have something to do with variables named similarly in different places, but I haven't done analysis to conclude that's exactly the problem.

I will try to do submit pull request if I get a moment to look into this and find a more permanent resolution.

shirosaidev commented 4 years ago

In config.py, set these two lines to:

elasticsearch_host = "elasticsearch"
elasticsearch_port = 9200
shirosaidev commented 4 years ago

I think you missed step 2 https://github.com/shirosaidev/stocksight#how-to-use

copy config.py.sample to config.py

config.py is the config file for stocksight

StephanSalas commented 4 years ago

@shirosaidev I think I mistyped that port environment variable, but my eyes didn't catch it. Sorry for the confusion on that one.

On the flipside, any features that you're looking to fulfill in the future? I'm an experienced software engineer in Java/Python, working in the financial services sector on data infrastructure.

shirosaidev commented 4 years ago

dm me @shirosai on the stocksight Slack workspace after you've tried out stocksight and have any new feature ideas.