GraphQL wrapper around PetFinder API with limited functionality built for fun.
Rename application-template.yml file to application.yml
and replace
the client secret and ID with your own generated from the
PetFinder developers page.
- Start the local server:
./gradlew bootRun
- Open: localhost:8080/playground
-
Build the image
./gradlew bootBuildImage
The image name is setup in the gradle file
-
Run image:
docker run -p8080:8080 pawfinder-graphql
-
Enable the Container, Container Registry, Cloud Build, and Cloud Run APIs:
gcloud services enable container.googleapis.com gcloud services enable containerregistry.googleapis.com gcloud services enable cloudbuild.googleapis.com gcloud services enable run.googleapis.com
-
Export the project's ID in your local .zshrc
export PROJECT_ID=YOUR_GCP_PROJECT_ID
-
Select your gcp project
gcloud config set project $PROJECT_ID
-
Build the container image on Cloud Build using Buildpacks, storing the image on Google Container Registry:
gcloud builds submit --pack=image=gcr.io/$PROJECT_ID/pawfinder-graphql
-
Deploy on Google Cloud Run:
gcloud run deploy pawfinder-graphql \ --image=gcr.io/$PROJECT_ID/pawfinder-graphql \ --project=$PROJECT_ID \ --platform=managed \ --allow-unauthenticated \ --region=europe-north1 \ --max-instances=4 \ --no-use-http2 \ --cpu-throttling
These are some sane defaults. Make your own configuration at google cloud console.
Cloud Run > Create Service > Select container image and configuration > Top right "Show command line"