Global Water Watch Service
Backend API for synchronous operations within Global Water Watch
Testing
docker-compose up
pytest
Local deployment
Currently, I have 2 ways of deploying locally
Debugging
For debugging, it is best to debug the main.py file in python, and use docker-compose to get the database running:
docker-compose up
Get earthengine credentials:
make get_secrets
And add the following environment variables (to your launch.json in VSCode) and .env:
{
"EE_SA": "dagster-workloads@global-water-watch.iam.gserviceaccount.com",
"EE_PK": "${workspaceFolder}/gcloud_dist/privatekey.json"
}
We can then use psql to create the postgis extension:
psql -U testuser -h localhost -d testdb
using the testpassword.
Then use (for example) VSCode to debug main.py.
Local kubernetes
To test kubernetes (later for some extra functionality like workflows), you can deploy a local cluster.
This is simplified in the Makefile.
make build-docker
make deploy-local
Check out the database: in one terminal:
export PGMASTER=$(kubectl get pods -o jsonpath={.items..metadata.name} -l application=spilo,cluster-name=gwwuser-gww,spilo-role=master -n gww)
kubectl port-forward $PGMASTER 6432:5432 -n gww
in another:
export PGPASSWORD=$(kubectl get secret -n gww gwwuser.gwwuser-gww.credentials.postgresql.acid.zalan.do -o 'jsonpath={.data.password}' | base64 -d)
export PGSSLMODE=require
psql -U gwwuser -h localhost -p 6432 -d gwwdb
Check out the api:
kubectl port-forward -n gww svc/gww-api 8080:80
After you are done:
kind delete clusters waterwatch
Note: This is to test working with other software, for debugging, using VSCode together with docker-compose and FastAPI's
--reloadoption helps developing quickly.
Deploy on kubernetes
This repository contains a helm chart that deploys the API to kubernetes. For example values, check out the values file.
Release files for gww-service 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gww_service-0.2.0.tar.gz | 20.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gww_service-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:42.7 kB
Release files / gww_service-0.2.0.tar.gz
| Download URL | gww_service-0.2.0.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a01f537d2c2bd60b7a8e6c68b0ad850e7584e6b8c2a5d58b584689ca8ededec0
|
|
BLAKE2b-256 checksum How to use checksums |
a82bc73c53605d7021118a5c0e4f114cf1ed7ed1fbe7ba471c0e18f5cd79f462
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.6
|
Release files / gww_service-0.2.0-py3-none-any.whl
| Download URL | gww_service-0.2.0-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28512799d2bab5d935891e8621d38232467b5f73b59ffbe91db298ec5918bb86
|
|
BLAKE2b-256 checksum How to use checksums |
67120698c0703ea826da14ebcb6ac4caf4d545b93a148771ff9a4b87de5a76ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.6
|