Skip to content

Deployment

gramirez-prompsit edited this page May 31, 2021 · 2 revisions

Deployment

Corset is distributed as a set of Docker containers which can be managed using docker-compose.

docker-compose up -d

Docker containers

The table below shows relevant information about each Docker container.

Container name Container image Root Port Data path Depends on
dp-solr solr:latest 8983 /var/solr
dp-postgres postgres:latest 5432 /var/lib/postgresql/data
dp-back dp-back:latest /opt/dp/back 5000 /opt/dp/back/data dp-postgres
dp-front dp-front:latest /opt/dp/front 5000 /opt/dp/front/data dp-postgres
dp-back

The only port that needs to be public is dp-front:5000, which is the entrypoint for the web app.

Data paths

This web app stores relevant information in each data path. These paths should be mounted as docker volumes for their contents to persist.

  • For dp-back, this is the data folder structure:
    • data/logs: API gunicorn logs, Celery logs
    • data/redis-data: data used by redis
    • data/corsets: generated custom corpora
  • For dp-front, this is the data folder structure:
    • data/logs: Gunicorn logs

Flask app configuration

Some settings for dp-back and dp-front are defined in back/app/config.py and front/app/config.py, respectively.

  • dp-back settings (back/app/config.py):
    • CORSET_SIZE: object containing an amount of sentences for each corset size: small, medium and large.
    • CORPORA_LINE_LIMIT: maximum amount of sentences to process from user uploaded files (query corpus/sample text)
    • CORPORA_SAMPLE_SIZE: maximum amount of sentences that will be extracted from a corset to generate an excerpt for preview
  • dp-front settings (front/app/config.py):
    • ENABLE_NEW_LOGINS: if true, lets new users log in. If false, only users that already logged in in the past will be able to sign in.
    • BANNED_USERS: list of users that should not be able to log in.
    • ADMINS: list of users with admin privileges
    • GOOGLE_OAUTH_CLIENT_ID: Client ID for Google Login
    • GOOGLE_OAUTH_CLIENT_SECRET: Client Secret for Google Login

Environment variables

Some settings are set through environment variables. The table below lists the required variables for each container and their possible values.

SECRET_KEY must have the same value in both dp-back and dp-front

Container name Variable Default value Description
dp-solr SOLR_JAVA_MEM -Xms8g -Xmx8g Memory configuration for Solr
dp-postgres POSTGRES_DB dpdb Database name. The container will create this database automatically when launched
POSTGRES_USER dpdb Username and password used to access the database. The container will set these credentials up automatically when launched
POSTGRES_PASSWORD
dp-back DATABASE_URL URL to access the database in the form: postgresql://[USER]:[PASSWORD]@dp-postgres:5432/dpdb
SOLR_URL http://dp-solr:8983/solr URL to access the Solr platform
SOLR_USR If your Solr instance is protected with HTTP Basic Auth, specify credentials here
SOLR_PWD
DEBUG 0 Enable debug mode (live code refresh)
CORS_ORIGINS http://localhost:5000 Add allowed CORS origins (separated by |). The default value should be enough for a standard deployment
SECRET_KEY development key Flask Secret Key, which determines legitimacy of sessions
dp-front DATABASE_URL URL to access the database in the form: postgresql://[USER]:[PASSWORD]@dp-postgres:5432/dpdb
API_URL http://dp-back:5000 URL to access the API
DEBUG 0 Enable debug mode (live code refresh)
SECRET_KEY development key Flask Secret Key, which determines legitimacy of sessions
Clone this wiki locally