Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker revamp #19

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
b292b6d
Add docker compose for kibana and elasticsearch
heyqule Aug 22, 2019
4aef0a3
Merge remote-tracking branch 'upstream/master'
heyqule Aug 22, 2019
8ee20b8
Add support for multiple set of nltk tokens. Controls by --index
heyqule Aug 23, 2019
9dca234
Fequency adjustment
heyqule Aug 23, 2019
74e6b36
Fully automate the build with docker
heyqule Aug 25, 2019
53408c9
Add support to bypass fetching stock price outside of regular hours.
heyqule Aug 26, 2019
d5393e7
Fix time display
heyqule Aug 26, 2019
4dc0238
Optimization
heyqule Aug 26, 2019
b7cda28
Fix hour() error
heyqule Aug 26, 2019
a8bf22a
Fix Cache Cleaning issue
heyqule Aug 27, 2019
aea6a59
Change startup.sh to startup.sample.sh
heyqule Aug 27, 2019
64ddc35
Add Curl to python instance for cleaning purposes.
heyqule Aug 27, 2019
004c17c
Clean cache
heyqule Aug 28, 2019
3cd6de0
Change Kibana template
heyqule Aug 28, 2019
fde9181
Move news out of original sentiment script
heyqule Aug 29, 2019
92a9447
Break down News SA
heyqule Aug 29, 2019
4205c8c
remove exposed ports
heyqule Aug 29, 2019
ff5a8cf
Elasticsearch / Kibana 7.3 change
heyqule Aug 31, 2019
e310886
Add ndjson importer
heyqule Aug 31, 2019
10502c8
Add ndjson importer
heyqule Aug 31, 2019
7675154
Remove kibana 5.6 export
heyqule Aug 31, 2019
c2a7010
Fix kibana importer
heyqule Sep 2, 2019
cb42d10
Update Copyright
heyqule Sep 2, 2019
fd9fe56
Change to wt
heyqule Sep 2, 2019
3a3b452
Change Mapping to 7.3 format
heyqule Sep 2, 2019
f3c1895
Disable twitter sentiment stream in start.sh
heyqule Sep 2, 2019
e6c9f1b
Rename original py to og.py
heyqule Sep 2, 2019
3fc49a6
Change config handling
heyqule Sep 8, 2019
e86efe7
Fix twitter
heyqule Sep 9, 2019
5f1d87f
Since it's single node insance, disable replica
heyqule Sep 9, 2019
3e862ec
Refactors
heyqule Sep 9, 2019
84c6324
Minor Import script adjustment
heyqule Sep 9, 2019
4cd6af4
Index structure change
heyqule Sep 9, 2019
622eae1
Fix message body
heyqule Sep 9, 2019
baa9d5f
Optimiaztion
heyqule Sep 10, 2019
040887b
Add delay before fetching from elasticsearch .
heyqule Sep 10, 2019
56901dc
Kibana change
heyqule Sep 10, 2019
abbc740
Kibana - remove legend
heyqule Sep 10, 2019
a6002ac
Add kibana listener
heyqule Sep 10, 2019
c6cf17b
Revert ndjson
heyqule Sep 10, 2019
bda22a4
Attempt to fix stock price operant error
heyqule Sep 10, 2019
b7226d4
Fix elastic mapping
heyqule Sep 11, 2019
5cde9c9
Add delay for Seek Alpha
heyqule Sep 11, 2019
c3431c4
Add delay for Seek Alpha
heyqule Sep 11, 2019
d086bc6
- Separate sentiment for message and title
heyqule Sep 14, 2019
f84a379
- Kibana adjustment
heyqule Sep 14, 2019
60e06fc
- Config adjustment
heyqule Sep 14, 2019
0d7c7a4
- Improve Kibana dashboard
heyqule Sep 17, 2019
fb6bea1
- Improve Kibana Dashboard
heyqule Sep 22, 2019
097c774
- Additonal Readme change
heyqule Sep 22, 2019
efc7387
- Fix kibana tmp folder issue
heyqule Sep 22, 2019
175dd61
- Minor change to spawn timers
heyqule Sep 22, 2019
a178733
Minor Refactor
heyqule Sep 24, 2019
9c55d3d
Merge branch 'master' into master
shirosaidev Oct 11, 2019
6f38025
Fix issue found by shaggy63
heyqule Oct 12, 2019
5d17a6c
Merge remote-tracking branch 'origin/master'
heyqule Oct 12, 2019
646b0d9
Disable unnecessary exposed ports
heyqule Oct 12, 2019
b985410
Add copyright blocks to non-py files
heyqule Oct 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ ENV/
# mkdocs documentation
/site

#Custom files
data/
config.py
.git
.idea
twitteruserids.txt

# mypy
.mypy_cache/
.DS_Store
11 changes: 11 additions & 0 deletions Python.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3

WORKDIR /usr/src/app

ADD requirements.txt ./requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

RUN [ "python", "-c", "import nltk; nltk.download('punkt')" ]

ENTRYPOINT ["sh","startup.sh"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,10 @@ optional arguments:
-q, --quiet Run quiet with no message output
-V, --version Prints version and exits
```

### HOWTO DOCKER
- Change config.py
- Change startup.sh to include your tickers
- run docker-compose up
- ???
- Profit
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ./docker-compose.yml

version: '3'

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.16
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- ./data:/usr/share/elasticsearch/data
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
nproc:
soft: 2048
hard: 2048
#expose this for local dev only!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when this is exposed permanently?

#ports:
# - "9200:9200"
kibana:
image: docker.elastic.co/kibana/kibana:5.6.16
depends_on:
- elasticsearch
ports:
- "5601:5601"
python3:
build:
context: ./
dockerfile: Python.Dockerfile
depends_on:
- elasticsearch
volumes:
- ./src:/usr/src/app
114 changes: 114 additions & 0 deletions kibana_exports/amd_export.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
[
{
"_id": "amd-stock-dashboard",
"_type": "dashboard",
"_source": {
"title": "amd_dashboard",
"hits": 0,
"description": "",
"panelsJSON": "[{\"col\":1,\"id\":\"amd-stock-visualization-2\",\"panelIndex\":1,\"row\":3,\"size_x\":3,\"size_y\":3,\"type\":\"visualization\"},{\"col\":9,\"id\":\"amd-stock-visualization-4\",\"panelIndex\":2,\"row\":3,\"size_x\":4,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"columns\":[\"author\",\"location\",\"message\",\"polarity\",\"subjectivity\",\"sentiment\"],\"id\":\"amd-stock-search\",\"panelIndex\":3,\"row\":6,\"size_x\":12,\"size_y\":4,\"sort\":[\"date\",\"desc\"],\"type\":\"search\"},{\"col\":1,\"id\":\"amd-stock-visualization-5\",\"panelIndex\":4,\"row\":10,\"size_x\":12,\"size_y\":4,\"type\":\"visualization\"},{\"col\":4,\"id\":\"amd-stock-visualization-3\",\"panelIndex\":5,\"row\":3,\"size_x\":5,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"amd-stock-visualization-1\",\"panelIndex\":6,\"row\":1,\"size_x\":12,\"size_y\":2,\"type\":\"visualization\"}]",
"optionsJSON": "{\"darkTheme\":true}",
"uiStateJSON": "{\"P-2\":{\"vis\":{\"legendOpen\":true}},\"P-6\":{\"vis\":{\"defaultColors\":{\"0 - 1\":\"rgb(0,104,55)\"}}}}",
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[{\"query\":{\"match_all\":{}}}],\"highlightAll\":true,\"version\":true}"
}
}
},
{
"_id": "amd-stock-search",
"_type": "search",
"_source": {
"title": "amd_savesearch",
"description": "",
"hits": 0,
"columns": [
"author",
"location",
"message",
"polarity",
"subjectivity",
"sentiment"
],
"sort": [
"date",
"desc"
],
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"amd\",\"highlightAll\":true,\"version\":true,\"query\":{\"match_all\":{}},\"filter\":[{\"meta\":{\"index\":\"amd\",\"negate\":false,\"disabled\":false,\"alias\":null,\"type\":\"phrase\",\"key\":\"_type\",\"value\":\"tweet\"},\"query\":{\"match\":{\"_type\":{\"query\":\"tweet\",\"type\":\"phrase\"}}},\"$state\":{\"store\":\"appState\"}}]}"
}
}
},
{
"_id": "amd-stock-visualization-1",
"_type": "visualization",
"_source": {
"title": "amd_polarity",
"visState": "{\"title\":\"amd_polarity\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"gauge\",\"gauge\":{\"verticalSplit\":false,\"autoExtend\":false,\"percentageMode\":false,\"gaugeType\":\"Metric\",\"gaugeStyle\":\"Full\",\"backStyle\":\"Full\",\"orientation\":\"vertical\",\"colorSchema\":\"Green to Red\",\"gaugeColorMode\":\"None\",\"useRange\":false,\"colorsRange\":[{\"from\":0,\"to\":1}],\"invertColors\":false,\"labels\":{\"show\":true,\"color\":\"black\"},\"scale\":{\"show\":false,\"labels\":false,\"color\":\"#333\",\"width\":2},\"type\":\"simple\",\"style\":{\"fontSize\":\"24\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\"},\"extendRange\":false}},\"aggs\":[{\"id\":\"5\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"1\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"polarity\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"median\",\"schema\":\"metric\",\"params\":{\"field\":\"polarity\",\"percents\":[50]}},{\"id\":\"2\",\"enabled\":true,\"type\":\"min\",\"schema\":\"metric\",\"params\":{\"field\":\"polarity\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"max\",\"schema\":\"metric\",\"params\":{\"field\":\"polarity\"}}],\"listeners\":{}}",
"uiStateJSON": "{\"vis\":{\"defaultColors\":{\"0 - 1\":\"rgb(0,104,55)\"}}}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"amd\",\"query\":{\"match_all\":{}},\"filter\":[]}"
}
}
},
{
"_id": "amd-stock-visualization-2",
"_type": "visualization",
"_source": {
"title": "amd_sentinel",
"visState": "{\"title\":\"amd_sentinel\",\"type\":\"pie\",\"params\":{\"addLegend\":true,\"addTooltip\":true,\"isDonut\":false,\"legendPosition\":\"bottom\",\"type\":\"pie\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"sentiment.keyword\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}}],\"listeners\":{}}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"amd\",\"query\":{\"match_all\":{}},\"filter\":[]}"
}
}
},
{
"_id": "amd-stock-visualization-3",
"_type": "visualization",
"_source": {
"title": "amd_stockprice",
"visState": "{\"title\":\"amd_stockprice\",\"type\":\"line\",\"params\":{\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100},\"title\":{\"text\":\"date per 30 seconds\"}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Avg of price_last\"}}],\"seriesParams\":[{\"show\":\"true\",\"type\":\"line\",\"mode\":\"normal\",\"data\":{\"label\":\"Avg of price_last\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"showCircles\":true},{\"show\":true,\"mode\":\"normal\",\"type\":\"line\",\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"data\":{\"id\":\"3\",\"label\":\"Avg of price_high\"},\"valueAxis\":\"ValueAxis-1\"},{\"show\":true,\"mode\":\"normal\",\"type\":\"line\",\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"data\":{\"id\":\"4\",\"label\":\"Avg of price_low\"},\"valueAxis\":\"ValueAxis-1\"}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"bottom\",\"times\":[],\"addTimeMarker\":false,\"type\":\"line\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"price_last\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"date\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"price_high\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"price_low\"}}],\"listeners\":{}}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"amd\",\"query\":{\"match_all\":{}},\"filter\":[{\"meta\":{\"index\":\"amd\",\"negate\":false,\"disabled\":false,\"alias\":null,\"type\":\"phrase\",\"key\":\"_type\",\"value\":\"stock\"},\"query\":{\"match\":{\"_type\":{\"query\":\"stock\",\"type\":\"phrase\"}}},\"$state\":{\"store\":\"appState\"}}]}"
}
}
},
{
"_id": "amd-stock-visualization-4",
"_type": "visualization",
"_source": {
"title": "amd_tweets",
"visState": "{\"title\":\"amd_tweets\",\"type\":\"line\",\"params\":{\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100},\"title\":{\"text\":\"date per 30 seconds\"}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Count\"}}],\"seriesParams\":[{\"show\":\"true\",\"type\":\"line\",\"mode\":\"normal\",\"data\":{\"label\":\"Count\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"interpolate\":\"linear\"}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"bottom\",\"times\":[],\"addTimeMarker\":false,\"type\":\"line\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{\"customLabel\":\"\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"date\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"index\":\"amd\",\"query\":{\"match_all\":{}},\"filter\":[]}"
}
}
},
{
"_id": "amd-stock-visualization-5",
"_type": "visualization",
"_source": {
"title": "amd_wordcloud",
"visState": "{\n \"title\": \"amd_wordcloud\",\n \"type\": \"tagcloud\",\n \"params\": {\n \"scale\": \"linear\",\n \"orientation\": \"single\",\n \"minFontSize\": 14,\n \"maxFontSize\": 36,\n \"type\": \"tagcloud\"\n },\n \"aggs\": [\n {\n \"id\": \"1\",\n \"enabled\": true,\n \"type\": \"count\",\n \"schema\": \"metric\",\n \"params\": {}\n },\n {\n \"id\": \"2\",\n \"enabled\": true,\n \"type\": \"terms\",\n \"schema\": \"segment\",\n \"params\": {\n \"field\": \"message.keyword\",\n \"size\": 25,\n \"order\": \"desc\",\n \"orderBy\": \"1\"\n }\n }\n ],\n \"listeners\": {}\n}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\n \"index\": \"amd\",\n \"query\": {\n \"match_all\": {}\n },\n \"filter\": []\n}"
}
}
}
]
Loading