From 48ba936a7b0586249afd20af38579db627efe9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Wed, 20 Jun 2018 12:16:17 +0200 Subject: [PATCH] Improved docs, docker-compose and dockerfile --- Dockerfile | 11 +------ README.md | 76 +++++++++++++++++++++++++++++++++++++--------- docker-compose.yml | 12 ++++++++ 3 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 3b3c844..777294e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1 @@ -from gsiupm/senpy:0.10.7-python2.7 - -RUN python -m nltk.downloader stopwords -RUN python -m nltk.downloader punkt -RUN python -m nltk.downloader maxent_treebank_pos_tagger -RUN python -m nltk.downloader wordnet -RUN python -m nltk.downloader omw - -ADD . /senpy-plugins - +from gsiupm/senpy:0.10.8-python2.7 \ No newline at end of file diff --git a/README.md b/README.md index d936ad7..3522327 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,75 @@ # Senpy Plugins -# Installing +# Requirements -First, install senpy from source or through pip: +Some of these plugins require licensed files to run, such as lexicons or corpora. +You can **manually download these resources and add them to the `data` folder**. - pip install senpy - -Each plugin has different requirements. -As of this writing, requirement installation is done manually for each plugin. -All requirements are specified in the .senpy file and, alternatively, in a requirements.txt file. +Most plugins will look for these resources on activation. +By default, we set the flag `--allow-fail` in senpy, so if a plugin fails to activate, the server will still run with the remaining plugins. # Running -Run with: +## Using docker - git clone https://github.com/gsi-upm/senpy-plugins-community.git - git submodule update --init --remote --recursive - senpy -f senpy-plugins-community -# Loading new plugins to gitlab +To deploy all the plugins in this repository, run: -You should have two repos, one with data files and the main repo of the plugin. -First you have to push all the data files in the data repo and the code of the plugin in the main repo. Next, you have to "link" the two repos using submodule: +``` +docker-compose up +``` +A server should now be available at `http://localhost:5000`. - git submodule add ../data/ ./data +Alternatively, you can use docker manually with the version of senpy you wish: + +``` +docker run --rm -ti -p 5000:5000 -v $PWD:/senpy-plugins gsiupm/senpy:0.10.8-python2.7 +``` + +Note that some versions are untested. + +## Manually + +First, install senpy from source or through pip: + +``` +pip install senpy +``` + +Now, you can try to run your plugins: + +``` +senpy -f . +``` + +Each plugin has different requirements. +Senpy will try its best to automatically install requirements (python libraries and NLTK resources) for each plugin. +Some cases may require manual installation of dependencies, or external packages. + +# For developers / Contributors + +## Licensed data + +In our deployments, we keep all licensed data in a private submodule. +You will likely need to initialize this submodule if you're a contributor: + +``` +git submodule update --init --recursive +``` + +## Adding a plugin from a separate repository + +To add a plugin that has been developed in its own repository, you can use git-subtree as so: + +``` +$mname= +$murl= + +git remote add $mname $murl +git subtree add --prefix=$mname $mname master +``` + +Make sure to also add # LICENSE diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3302ae5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' +services: + community: + build: . + image: "${IMAGEWTAG:-gsi-upm/senpy-community:dev}" + volumes: + - ".:/senpy-plugins/" + # - "./data:/data" + ports: + - '5000:5000' + command: + - "--allow-fail"