usc-isi-i2 / dig-sandpaper

MIT License
4 stars 3 forks source link

dig-sandpaper

travis ci

Docker deployment instructions

docker run -it -P uscisii2:digsandpaper

docker run -it -v config:/etc/sandpaper/config -P uscisii2:digsandpaper

docker run -it -v config:/etc/sandpaper/config -P uscisii2:digsandpaper bin/start.sh --config config/your-custom-config.json --host 0.0.0.0

docker run -d -p 9876:9876 uscisii2:digsandpaper curl -XGET localhost:9876

Development instructions

It is highly suggested you create a conda environment or virtual environment before installing digsandpaper

conda-env create --name sandpaperenv requests
source activate sandpaperenv
virtualenv sandpaperenv
. sandpaperenv/bin/activate

myDIG integration

The myDIG service provides a convenient web interface for configuring and interacting with sandpaper.

If myDIG is properly setup with a project, you can configure sandpaper to configure itself using myDIG at runtime.

bin/start.sh --host 0.0.0.0 \
                --config config/sandpaper.json \
                --mydigurl http://USER:PASSWORD@mydig:9879 \
                --project myproject \
                --endpoint https://elasticsearch:9200

If you want sandpaper to connect to the sample index specified by the myDIG project add the --sample flag

bin/start.sh --host 0.0.0.0 \
                --config config/sandpaper.json \
                --mydigurl http://USER:PASSWORD@mydig:9879 \
                --project myproject \
                --endpoint https://elasticsearch:9200 \
                --sample

If you want to iterate on a separate or earlier index, add the --index flag

bin/start.sh --host 0.0.0.0 \
                --config config/sandpaper.json \
                --mydigurl http://USER:PASSWORD@mydig:9879 \
                --project myproject \
                --endpoint https://elasticsearch:9200 \
                --index myoldindex

If you need to work with sandpaper from the command line outside of the myDIG interface, you can have it create an index, load some documents, and configure itself using cURL in three easy steps.

First tell dig-sandpaper to create a mapping for a given project at the myDIG url and use it to create an index at an elasticsearch endpoint

curl -XPUT "http://localhost:9876/mapping?url=http%3A%2F%2FUSER%3APASSWORD%40myDIG%3A9879&project=myproject&index=myindex&endpoint=http%3A//elasticsearch%3A9200"

Second, send some jsonlines documents out put by ETK of type ads to dig-sandpaper to add at the appropriate index and endpoint

curl  -H "Content-Type: application/json"  -XPOST --data-binary @project_etk_output.jl "localhost:9876/indexing?index=myindex&endpoint=http%3A//elasticsearch%3A9200&type=ads" 

Third, tell dig-sandpaper to reconfigure itself using the project at the myDIG url and use the index at the elasticsearch endpoint

curl -XPOST "localhost:9876/config?url=http%3A%2F%2FUSER%3APASSWORD%40mydig%3A9879&project=myproject&index=myindex&endpoint=http%3A//elasticsearch%3A9200&type=ads" 

You should now be able to issue a query using the bin/query.sh script.