This document provides step-by-step instructions for setting up and running the pf_build server locally. Two modes are possible:
-
On the metal from a python virtual environment
-
Using a container
Running the server requires an environment variable called GH_TOKEN
for authentication to github. Consult github documentation for information on generating a token. This token is connected to a github organization and allows this server to access that organization. The GH_TOKEN
variable should contain the token data which is a long string of alphanumeric characters.
Assume the token is stored in a file:
export GH_FILE=/home/user/data/tokens/githubtoken.txt
Obviously adjust as required.
Set an environment variable:
export GH_TOKEN=$(cat $GH_FILE)
To run the server locally, the overall approach is to clone the repo, create a python virtual environment, and install the dependencies and application. This is typically a one-time activity.
Clone the repository to your local machine:
git clone https://github.com/FNNDSC/pf_build.git cd pf_build
Create a venv in the repo directory:
python -m venv venv
and activate it:
source venv/bin/activate
Install the required dependencies using pip
:
pip install -r requirements.txt
To ensure the application is available for uvicorn
, install it in the current environment:
pip install -e .
Now, assuming the application and dependencies are setup in a local python virtual environment or running in a docker container, start MongoDB locally or using Docker Compose:
docker-compose up
Open your browser and navigate to:
-
API Root: http://127.0.0.1:8000
-
Interactive API Docs: http://127.0.0.1:8000/docs