Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ predictions generated by N tools contributed to NLPSandbox.io.

### Specification

- Data Node version: 1.3.0
- Data Node API version: 1.2.0
- Data Node version: 1.2.1
- Docker image: [nlpsandbox/data-node]

## Usage
Expand All @@ -48,9 +48,12 @@ Create the configuration file.

The command below starts the Data Node locally.

docker-compose up --build
docker compose up

You can stop the container run with `Ctrl+C`, followed by `docker-compose down`.
You can stop the container run with `Ctrl+C`, followed by `docker compose down`.

> Note: `docker compose` is not yet available on Linux. Use `docker-compose`
> instead.

### Running with Python

Expand All @@ -67,7 +70,7 @@ variables.

Start the MongoDB instance.

docker-compose up -d db
docker compose up -d db

Install and start the Data Node.

Expand All @@ -81,8 +84,8 @@ The Data Node provides a web interface that you can use to create and manage
resources. The address of this interface depends on whether you run the Data
Node using Docker (production mode) or the Python development server.

- Using Docker: http://localhost/ui
- Using Python: http://localhost:8080/ui
- Default: HTTP://localhost:8080/ui
- Format: `http://localhost:{SERVER_PORT}/ui`

## Contributing

Expand Down
56 changes: 40 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,66 @@ services:
container_name: data-node-db
restart: always
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
- MONGO_INITDB_DATABASE=${MONGO_INITDB_DATABASE}
- MONGO_USERNAME=${MONGO_USERNAME}
- MONGO_PASSWORD=${MONGO_PASSWORD}
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
- MONGO_INITDB_DATABASE
- MONGO_USERNAME
- MONGO_PASSWORD
volumes:
- database-data:/data/db
networks:
- nlpsandbox-data-node-internal
ports:
- "${MONGO_PORT}:27017"
- "27017:27017"
deploy:
resources:
limits:
memory: 1G

data-node:
image: nlpsandbox/data-node:1.2.1
image: nlpsandbox/data-node:1.3.0
build:
context: server
dockerfile: Dockerfile
container_name: data-node
# command: uwsgi --ini uwsgi.ini --lazy --http :8080 --processes 4
# Uncomment the line `command` if you want to customize any of its
# parameters. Replace the following values:
# - {processes}: min(2 * max number of concurrent processes that the data
# node should support, 6 * number of CPU cores)
#command: uwsgi --ini uwsgi.ini --lazy --http :8080 --processes {processes}
environment:
- SERVER_PROTOCOL=${SERVER_PROTOCOL}
- SERVER_DOMAIN=${SERVER_DOMAIN}
- SERVER_PORT=${SERVER_PORT}
- DB_PROTOCOL=${DB_PROTOCOL}
- SERVER_PROTOCOL
- SERVER_DOMAIN
- SERVER_PORT
- DB_PROTOCOL
- DB_DOMAIN=db
- DB_PORT=${DB_PORT}
- DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
- DB_PORT
- DB_DATABASE
- DB_USERNAME
- DB_PASSWORD
# healthcheck:
# test: curl --fail http://localhost:8080/api/v1/healthCheck
# interval: 10s
# timeout: 5s
# retries: 5
networks:
- nlpsandbox-data-node
- nlpsandbox-data-node-internal
ports:
- "${SERVER_PORT}:8080"
depends_on:
- db
deploy:
resources:
limits:
# The amount of memory required depends on the number of uwsgi
# processes used. Default: number of processes * 100M
memory: 2G

volumes:
database-data:

networks:
nlpsandbox-data-node:
nlpsandbox-data-node-internal:
internal: true
2 changes: 1 addition & 1 deletion server/uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ wsgi-file = openapi_server/__main__.py
callable = app
uid = www-data
gid = www-data
processes = 1 # Number of concurrent processes / workers
processes = 2 # Number of concurrent processes / workers
threads = 1 # Number of threads per process
master = true
chmod-sock = 660
Expand Down