Improved docs, docker-compose and dockerfile

master
J. Fernando Sánchez 6 years ago
parent bbe91e1924
commit 48ba936a7b

@ -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

@ -1,29 +1,75 @@
# Senpy Plugins
# Installing
# Requirements
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**.
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
## Using docker
To deploy all the plugins in this repository, run:
```
docker-compose up
```
A server should now be available at `http://localhost:5000`.
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
```
pip install senpy
```
Now, you can try to run your plugins:
```
senpy -f .
```
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.
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.
# Running
# 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
Run with:
To add a plugin that has been developed in its own repository, you can use git-subtree as so:
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
```
$mname=<your plugin name>
$murl=<URL to your repository>
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:
git remote add $mname $murl
git subtree add --prefix=$mname $mname master
```
git submodule add ../data/<NAME OF YOUR PLUGIN> ./data
Make sure to also add
# LICENSE

@ -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"
Loading…
Cancel
Save