This is a repository for Eawag SURF fastapi, initially developed for the ALPLAKES project.
Endpoints can be found in app/main.py
The documentation pages are available at the following:
- Swagger http://localhost:8000/docs
- Redoc http://localhost:8000/redoc
Follow the official install instructions here
Then run docker login to enable access to private docker images.
sudo apt-get -y update && sudo apt-get -y install git
git clone https://github.com/eawag-surface-waters-research/alplakes-fastapi.git
mkdir -p filesystemReplace example filesystem path with correct path. For local development this is likely to be the filesystem folder
within the repository. For production environments this may be on another drive.
cd alplakes-fastapi
cp env.example .env
nano .envcd alplakes-fastapi
docker compose up --build -dWhen there are changes to the API the service needs to be rebuilt to reflect those changes.
docker compose down
docker compose up --build -dconda create --name fastapi python=3.12
conda activate fastapi
conda install --file requirements.txtManually set filesystem path in main.py if files are NOT located in the filesystem folder within the repository.
conda activate fastapi
uvicorn app.main:app --host 0.0.0.0 --reloadPytest can be directly run with FastAPI. Tests are located in the file app/test_main.py.
pip install pytestTest files need to be downloaded from "URL_TO_FOLLOW" into the filesystem folder. The folder structure should look like:
├── media
│ ├── bafu
│ │ └── hydrodata
│ ├── meteoswiss
│ │ └── cosmo
│ │ └── meteodata
│ └── simulations
│ └── delft3d-flow
├── .gitkeep Navigate to the top directory of the repository to run pytest.
pytest