Skip to content
franciscoabenza edited this page Feb 2, 2023 · 21 revisions

New version

Production: Docker

you'll want to install the conda environment and pip requirements, mainly for linting, pre-commit, etc:

conda create -n nlp4all python=3.11
conda activate nlp4all
pip install -r requirements-dev.txt
pre-commit install

if you want to run github actions 🤌 locally, you'll also need to install docker, but once you have docker just follow the install instructions here: https://github.com/nektos/act

Then you can run at any time

act

and it will run the github actions for the repo

for the docker setup then...

first install:

# build the images, and spin them up
docker compose -f compose.yaml up -d --build
# create the database
docker compose -f compose.yaml exec app flask --app nlp4all init-db
docker compose -f compose.yaml exec app flask --app nlp4all spacy-download

to monitor output:

docker compose logs -f

To destroy and rebuild (including volumes/DB)

docker compose down -v
docker compose up -d --build
docker compose exec app flask --app nlp4all init-db
docker compose exec app flask --app nlp4all spacy-download

the site will now be available outside the container, on port 80, if you run this on your local machine then you can access it from: http://localhost/

Development: Docker

Pretty much same as above, 🤌 but instead of using gunicorn and nginx, it will serve the flask development server directly with debugging enabled. You should also always specify after docker compose the file i.e. docker compose -f compose.development.yaml ...

Build and start the dev env:

# build the images, and spin them up
docker compose -f compose.development.yaml up -d --build
# create the database
docker compose -f compose.development.yaml exec app flask --app nlp4all init-db
docker compose -f compose.development.yaml exec app flask --app nlp4all spacy-download

To destroy and rebuild (including volumes/DB)

docker compose -f compose.development.yaml down -v
docker compose -f compose.development.yaml up -d --build
docker compose -f compose.development.yaml exec app flask --app nlp4all init-db
docker compose -f compose.development.yaml exec app flask --app nlp4all spacy-download

You can now visit the site by going to http://localhost:5000/

Development: Local

Try to avoid using this because while it might be easier at first because it's outside of docker, it doesn't really mirror the actual setup, especially the database using sqlite instead of postgres.

initial setup:

conda create -n nlp4all python=3.11
conda activate nlp4all
pip install -r requirements-dev.txt
pre-commit install

setup database:

# from root of repository
flask init-db

get spacy models:

# from root of repository
flask spacy-download

run the app:

flask run

the site should now be available at http://localhost:5000/

Old developer instructions (pre docker)

conda create -n nlp4all python=3.9
conda activate nlp4all
pip install -r requirements-dev.txt
pre-commit install
python db_del_and_init.py
python ./run_dev.py

Of course you can do this without miniconda/conda but save yourself some headache!

see also: https://github.com/NLP4ALL/nlp4all/wiki/Development-Environment

Clone this wiki locally