Docker compose of collections explorer core (Django API container, mySQL container, nginx container) Nginx depends on Django web, Django web relies on mySQL
Docker Compose version v2.26.1-desktop.1 Docker Engine - Community version 27.2.0
Things to modify before build:
.env
(Request from @zhucchininoodles)
- add .env file to root of Django project folder: explorer-core/.env
_collections_app_api/static/_
- create a static folder in collections_app_api folder; add your static files/scans (example file casxlogo.png included)
There is a shell script dc_start.sh to make building and starting more convenient:
./dc_start.sh up
This will build the project with project label galapagateway_api
The same shell script can be used to stop and remove the Docker containers, volumes, builder cache:
./dc_start.sh down
...And to occassionally, fully prune Docker resources and builder cache/layers tied to this project:
./dc_start.sh prune
-
Should only prune resources related to this project only. DO double-check before cleaning.....
-
Still tweaking "cleanup" part of dc_start.sh
-
API runs on 0.0.0.0 after successful deployment.
Visit 0.0.0.0/api/docs to view API document (/collections_app_api/collections_schema.yaml).
Static files served through nginx on 0.0.0.0/static/ Add scan files under /collections_app_api/static/ within a subfolder. e.g. If you want to add scan files of HERP8141, path would look like: /collections_app_api/static/HERP8141/scanfile1.GLB
This api is hosted as Cloud Run container on Google Cloud Platform. The project is named galapagateway
.
After installing the gcloud cli and authenticating, you can build the docker image on remote:
gcloud builds submit --tag us-central1-docker.pkg.dev/galapagateway/cloud-run-source-deploy/api --project galapagateway .
Once the build is complete, update the service to run that container:
gcloud run deploy --image us-central1-docker.pkg.dev/galapagateway/cloud-run-source-deploy/api:latest --project galapagateway --region us-central1 api-stage
Note the container region is us-central1
. The public endpoint is https://api-stage-592971452831.us-central1.run.app/
Pre-existing Occurrences records of collectionsdb can be changed/modified, or new occurrences can be created and added from JSON derived from GBIF (/api/gbif/{collectionCode}{catalogNumber}, e.g. /api/gbif/HERP8141), through the Django admin panel, 0.0.0.0/admin
.
Contact @zhucchininoodles for API admin login credentials.