diff --git a/README.md b/README.md index 72ccc06..983e958 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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. @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index beb7fa7..7fe69b7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/server/uwsgi.ini b/server/uwsgi.ini index 94bd762..18569ae 100644 --- a/server/uwsgi.ini +++ b/server/uwsgi.ini @@ -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