joreilly / PeopleInSpaceGraphQLServer

Cloud Run based GraphQL backend for PeopleInSpace supporting queries and subscriptions
Apache License 2.0
5 stars 1 forks source link
graphql graphql-server kotlin

PeopleInSpace GraphQL Server

GraphQL backend allowing querying list of people in space and subscribing to position of International Space Station.

Run Locally:

  1. Start the local server: ./gradlew bootRun
  2. Open: localhost:8080/playground

Run on Google Cloud Run (with the command line):

  1. Install & setup gcloud

  2. Enable the Container, Container Registry, Cloud Build, and Cloud Run APIs:

    gcloud services enable container.googleapis.com containerregistry.googleapis.com cloudbuild.googleapis.com run.googleapis.com
  3. Build the container image on Cloud Build using Buildpacks, storing the image on Google Container Registry:

    export PROJECT_ID=YOUR_GCP_PROJECT_ID
    gcloud builds submit --pack=image=gcr.io/$PROJECT_ID/peopleinspace-graphql
  4. Deploy on Google Cloud Run:

    gcloud run deploy \
      --image=gcr.io/$PROJECT_ID/peopleinspace-graphql \
      --platform=managed \
      --allow-unauthenticated \
      --project=$PROJECT_ID \
      --region=us-central1 \
      --memory=1Gi \
      peopleinspace-graphql

Local Docker Build & Run

  1. Install Docker

  2. Build the image

    ./gradlew bootBuildImage --imageName=peopleinspace-graphql
  3. Run image:

    docker run -p8080:8080 peopleinspace-graphql
  4. Open: localhost:8080/playground