Development
Prerequisits
The ${BIOTERM_ROOT_DIRECTORY} contains an additional requirements_dev.txt
file for developers.
Use
$ pip install -r requirements_dev.txt
after having your virtual environment activated, to install the additional packages required for developing. Then, run
$ pre-commit install # installs .git/hooks/pre-commit
$ pre-commit install --hook-type pre-push # installs .git/hooks/pre-push
to set up the git hook scripts stored in .pre-commit-config.yaml
in the .git/hooks
directory.
Settings
When deploying on a local machine, certain settings need to be adopted to ease the development. This especially concerns the server backend and frontend, which are dockerized for production deployment and The nginx configuration needs to be adopted as well, to point to either the docker container’s host adress or the local machine’s localhost.
In addition, on a local machine self-signed certificates are used and TLS verification needs to be disabled.
Warning
Don’t forget to turn TLS verification back on when deploying for production, as this might get by unnoticed.
Backend
In the docker-compose.yml
file, uncomment the ports directive for the timescaledb service:
...
timescaledb:
...
ports:
- 5432:5432
...
Also, disable the biotermserverapi service completely by commenting out the whole service and its directives.
Then, change the environment variable POSTGRES_SERVER from timescaledb:5432 to localhost:5432.
Set the environment variable USE_TLS to False.
Warning
FastAPI requires Python 3.9 !
Then, set up a virtual environment and install the required packages located in bioterm/server/backend/requirements.txt
:
$ python3.9 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
run
$ sudo docker compose up -d
in bioterm/server/backend
to start the PostgreSQL service.
To run the server use the following command in the bioterm root directory:
$ uvicorn bioterm.server.backend.app.main:app --reload --host 0.0.0.0 --port 8001
Frontend
For information regarding frontend development, please refer to webUI.
NGINX
For local development, change the API section configuration as follows:
### API SECTION
server {
...
location / {
# set $api_upstream http://biotermserverapi:8001;
# proxy_pass $api_upstream;
proxy_pass http://host.docker.internal:8001;
...
}
}
Change the APP section as follows:
### APP SECTION
server {
...
location / {
# set $app_upstream http://bioterm-webui:8081;
# proxy_pass $app_upstream;
proxy_pass http://host.docker.internal:8081/;
...
}
}
authentik
Commmitlint
feat
: new featurefix
: bug fixdocs
: changes to the documentationstyle
: formatting, missing semi colons, etc; no production code changerefactor
: refactoring production code, eg. renaming a variable, moving stuff aroundtest
: adding missing tests, refactoring tests; no production code changechore
: TBD
Coding Style
Please check Coding Style Guide for details.