-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mergo master to main See merge request pkpdapp/pkpdapp!1
- Loading branch information
Showing
376 changed files
with
76,475 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
frontend/node_modules | ||
env | ||
*.egg-info | ||
pkpdapp/db.sqlite3 | ||
.docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DEBUG=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
PORT=8020 | ||
DEBUG=1 | ||
HOST_NAME=monkshood | ||
SECRET_KEY=aLargeRandomSecretKey | ||
DJANGO_SUPERUSER_USERNAME=admin | ||
DJANGO_SUPERUSER_PASSWORD=sekret1 | ||
DJANGO_SUPERUSER_EMAIL=[email protected] | ||
EMAIL_HOST=in-v3.mailjet.com | ||
EMAIL_PORT=25 | ||
EMAIL_HOST_USER=email_username | ||
EMAIL_HOST_PASSWORD=email_password | ||
DEFAULT_FROM_EMAIL=[email protected] | ||
POSTGRES_PASSWORD=sekret2 | ||
DATABASE_URL=postgres://postgres:sekret2@postgres:5432/postgres | ||
|
||
RABBITMQ_DEFAULT_USER=guest | ||
RABBITMQ_DEFAULT_PASS=guest | ||
|
||
AUTH_LDAP_USE=0 | ||
AUTH_LDAP_SERVER_URI=ldap://ldap.forumsys.com:389 | ||
AUTH_LDAP_DIRECT_BIND=1 | ||
AUTH_LDAP_BIND_DN_TEMPLATE=uid=%(user)s,dc=example,dc=com | ||
AUTH_LDAP_BIND_DN=cn=read-only-admin,dc=example,dc=com | ||
AUTH_LDAP_BIND_PASSWORD=password | ||
AUTH_LDAP_SEARCH_BASE=ou=mathematicians,dc=example,dc=com | ||
AUTH_LDAP_SEARCH_FILTER=(uid=%(user)s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
extend-ignore = E203, W503 | ||
|
||
exclude= | ||
.git, | ||
venv | ||
|
||
ignore= | ||
# Accept ambiguously named variables | ||
E741 | ||
|
||
# Accept line breaks after binary operators | ||
W504 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Copyright | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
name: copyright | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
|
||
- name: install ldap | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev | ||
- name: install pkpdapp | ||
run: | | ||
python --version | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install -r requirements.txt | ||
- name: run copyright test | ||
run: | | ||
python run-tests.py --copyright |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Coverage | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
name: coverage | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
|
||
- name: install sundials | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsundials-dev libsasl2-dev python3-dev libldap2-dev libssl-dev | ||
- name: install pkpdapp | ||
run: | | ||
python --version | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install -r requirements.txt | ||
python -m pip install coverage codecov | ||
- name: run coverage | ||
run: | | ||
cd pkpdapp && coverage run manage.py test | ||
- name: codecov | ||
if: success() | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
run: | | ||
cd pkpdapp && codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
name: Style tests (flake8) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
name: style test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
|
||
- name: install ldap | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsasl2-dev python3-dev libldap2-dev libssl-dev | ||
- name: install pkpd | ||
run: | | ||
python --version | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install -r requirements.txt | ||
python -m pip install flake8 | ||
- name: run style tests | ||
run: | | ||
python -m flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Unit tests (OS versions) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
|
||
- name: install sundials (ubuntu) | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsundials-dev libsasl2-dev python3-dev libldap2-dev libssl-dev | ||
- name: install sundials (macos) | ||
if: ${{ matrix.os == 'macos-latest' }} | ||
run: | | ||
brew update-reset | ||
brew install sundials | ||
- name: install pkpdapp | ||
run: | | ||
python --version | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install -r requirements.txt | ||
- name: run unit tests | ||
run: | | ||
cd pkpdapp && python manage.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Unit tests (python versions) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build-and-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10'] | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
|
||
- name: install sundials | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsundials-dev libsasl2-dev python3-dev libldap2-dev libssl-dev | ||
- name: install pkpdapp | ||
run: | | ||
python --version | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install -r requirements.txt | ||
- name: run unit tests | ||
run: | | ||
cd pkpdapp && python manage.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
||
# Virtual environments | ||
venv | ||
env* | ||
|
||
# Setuptools files | ||
*.egg-info | ||
|
||
# vscode | ||
.vscode | ||
|
||
# database file (not sure yet what its good for) | ||
db.sqlite3 | ||
|
||
# DS | ||
.DS_Store | ||
|
||
# static files | ||
pkpdapp/static | ||
|
||
# nodemodules | ||
frontend/node_modules | ||
|
||
logfile.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[MASTER] | ||
load-plugins=pylint_django |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Contributing to the PKPDApp | ||
|
||
The PKPDApp is built with the Django framework and as such adheres largely to Django's philosophy - one project contains multiple smaller apps that each perform exactly one task and are as self-contained as possible. As a result, the PKPDApp is really a collection of smaller apps that take care of model building, result illustration and so on. | ||
|
||
## Repository Structure | ||
|
||
To meet the modular structure of Django apps, the repository is organised in 3 layers | ||
|
||
1) `\pkpdapp`: The top level folder that contains administrative files, such as `setup.py`, `README.md` or this file `CONTRIBUTING.md`. | ||
2) `\pkpdapp\pkpdapp`: The Django project folder that contains the various smaller apps and the executible `manage.py`. | ||
3) `\pkpdapp\pkdpapp\pkpdapp`: The website application that defines the structure of the PKPDApp. | ||
|
||
## Summary of apps | ||
|
||
Apps in the PKPDApp can be broadly categorised into function and integration apps. Function apps are applications that perform a specific function, for example building a model, simulating the model or providing a plotting interface for simulation results. Those individual apps may be used at multiple occasions in the PKPDApp, i.e. for simulation or inference. The integration apps are applications that patch various functional apps together, and are in essence responsible for a good user experience. | ||
|
||
For an overview of apps and their purpose in the PKPDApp, please check out the list below. We will reference all apps realtive to the Django project root `\pkpdapp\pkdpapp`. | ||
|
||
- `\pkpdapp`: The main app of the website. It defines base templates and the url structure of the PKPDApp. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Using a 2-stage build. This is the builder for javascript frontend | ||
|
||
FROM node:19 as build | ||
RUN mkdir -p /app/frontend | ||
WORKDIR /app/frontend | ||
COPY frontend-v2/package.json /app/frontend | ||
|
||
RUN npm install | ||
|
||
COPY frontend-v2 /app/frontend/ | ||
RUN npm run build | ||
|
||
FROM python:3.10 | ||
|
||
# install libsundials-dev | ||
RUN apt-get update && apt-get upgrade -y | ||
RUN apt-get install -y libsundials-dev memcached | ||
|
||
# install nginx | ||
RUN apt-get install nginx vim -y --no-install-recommends | ||
RUN ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log | ||
RUN chown www-data:www-data /etc/nginx/sites-available/default | ||
|
||
# install envsubst and git | ||
RUN apt-get install -y gettext-base | ||
|
||
# clean up apt | ||
RUN apt-get clean | ||
RUN apt-get autoclean | ||
RUN apt-get autoremove | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
# install dependencies | ||
COPY ./requirements.txt / | ||
RUN apt-get update && apt-get upgrade -y | ||
RUN apt-get install -y build-essential libsasl2-dev python3-dev libldap2-dev libssl-dev | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
# install server code | ||
WORKDIR /app | ||
COPY ./pkpdapp . | ||
|
||
RUN python manage.py collectstatic --noinput | ||
RUN python manage.py migrate --noinput | ||
|
||
# copy the built frontend (needs to be after we install nginx) | ||
COPY --from=build /app/frontend/build /usr/share/nginx/html | ||
|
||
# we're running as the www-data user, so make the files owned by this user | ||
RUN chown -R www-data:www-data . | ||
|
||
# make /var/www/.config dir and make it writable (myokit writes to it) | ||
RUN mkdir -p /var/www/.config | ||
RUN chown -R www-data:www-data /var/www | ||
|
||
# gunicorn and nginx needs to write to a few places | ||
RUN chown -R www-data:www-data /var/lib/nginx /run /tmp | ||
|
||
# server setup files | ||
COPY nginx.default.template . | ||
COPY start-server.sh . | ||
RUN chown -R www-data:www-data nginx.default.template start-server.sh | ||
|
||
# run as www-data | ||
USER www-data | ||
|
||
# start server using the port given by the environment variable $PORT | ||
# nginx config files don't support env variables so have to do it manually | ||
# using envsubst | ||
STOPSIGNAL SIGTERM | ||
CMD /bin/bash -c "envsubst '\$PORT' < ./nginx.default.template > /etc/nginx/sites-available/default" && "./start-server.sh" |
Oops, something went wrong.