Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 4.01 KB

README.md

File metadata and controls

58 lines (40 loc) · 4.01 KB

Application Programming Interface for CTSM

DOI

This repository contains an API and Dockerfile for containerised CTSM applications.

Setup and Run the Dev Server

To run the services locally or with docker, first you need to create a .env file in your project root directory. You can use env-example as a template and adjust the variables accordingly. See the Variable section below for more information.

Cases are supposed to run in docker, though you can also run them locally. To see what dependencies are needed for a local run, check out docker/Dockerfile.

Run locally

We recommend using a virtual environment for your project.

You can either use Conda or Python venv to create a virtual environment, though conda is not tested.

  • Make sure Poetry is installed in your environment.
  • Install the dependencies: poetry install.
  • Set up the database: ./scripts/migrations_forward.sh.
  • Run the dev server: ./scripts/run_dev_server.sh.

Run in Docker

Install docker and docker-compose first.

The current configs and commands are tested with docker 20.10.13 and docker-compose 1.29.2.

  • To build the image locally, run docker-compose -f docker-compose.dev.yaml build.
  • To run the docker services in debug mode, run docker-compose -f docker-compose.dev.yaml up.
  • For production, run docker-compose up.

In order to avoid permission issues on folders handled by docker, you can set HOST_USER and HOST_UID variables to their respective values for the host user under which you are running the docker commands.

You can do this either in your .env file or by exporting them in your environment. THe following command is an example of how to set the variables: HOST_USER=$(whoami) HOST_UID=$(id -u) docker-compose -f docker-compose.dev.yaml up

See docker/entrypoint.sh to see how permissions are updated when running the docker services.

Variables

Adjustable Variables in .env:

Variable Required Description Default Scope
MODEL_REPO No The model repository to use https://github.com/ESCOMP/CTSM/ API/Docker
MODEL_VERSION Yes The model repository tag to use - API/Docker
PORT No The port to use for API service in docker 8000 Docker
HOST_USER No Docker host user. If specified for a docker container, ownership of all folders within resources will be changed to the container host user
It must be used with HOST_UID
- Docker
HOST_UID No UID of docker host user. See HOST_ID above and the docker section for more info - Docker

Resources

TODO: describe the resources and how they must be set up.