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

Add Docker Images for running Haystack #85

Merged
merged 4 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'
services:
haystack-api:
image: "deepset/haystack-api-cpu:0.2.0"
Copy link
Member

Choose a reason for hiding this comment

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

How about naming the image "deepset/haystack-cpu:0.2.0" without the "api"? Is there anything specific for the API in it? We might also re-use it for training / eval ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that sounds good. The CMD for the image is specific to the API, but that can easily be moved to docker-compose.yml and run_docker_gpu.sh.

ports:
- 8000:8000
environment:
# see haystack/api/config.py for additional variables to configure.
# load reader model from transformers' model hub.
- READER_MODEL_PATH=deepset/roberta-base-squad2
- DB_HOST=elasticsearch
restart: always

elasticsearch:
# This demo image contains Game of Thrones Wikipedia articles indexed.
# For starting a new Elasticsearch instance, replace image with "elasticsearch:7.6.1".
image: "deepset/elasticsearch-game-of-thrones"
environment:
- discovery.type=single-node
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# FARM pre-0.4.3
-e git://github.com/deepset-ai/FARM.git@ecee40e34781394a805c7dde14e6cc2570372798#egg=farm
farm==0.4.3
fastapi
uvicorn
gunicorn
Expand Down
11 changes: 11 additions & 0 deletions run_docker_gpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Run Haystack API(on GPU) and Elasticsearch using Docker.
#
# docker-compose doesn't support GPUs in the current version. As a workaround,
# this script runs haystack-api and Elasticsearch Docker Images separately.
#
# To use GPU with Docker, ensure nvidia-docker(https://github.com/NVIDIA/nvidia-docker) is installed.

docker run -d -p 9200:9200 -e "discovery.type=single-node" elasticsearch:7.6.1
# wait for Elasticsearch server to start
sleep 30
docker run --net=host --gpus all -e READER_MODEL_PATH=deepset/roberta-base-squad2 -d deepset/haystack-api-gpu:0.2.0