PeopleInSpace GraphQL Server

Overview

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

You might also like...
An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL

graphql-kotlin-spring-server An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL Running the s

GraphQL for Java with Spring Boot made easy.

GraphQL for Java with Spring Boot made easy.

This repository demonstrates Spring GraphQL + RSocket + WebFlux + R2DBC + H2

Reactive GraphQL with Spring This repository demonstrates Spring GraphQL + RSocket + WebFlux + R2DBC + H2 O__ +-----------+

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

A simple reference example Kotlin GraphQL service

A simple reference example Kotlin GraphQL service, written for colleagues coming over from Python & FastAPI/Flask + Ariadne/Graphene.

A kotlin based server for the milky store mobile application
A kotlin based server for the milky store mobile application

Milky Store backend server A kotlin 💜 💜 based backend server to power up the milky store android application FEATURES : Secure serialisation 🤯 lead

The Okila server project uses the Spring boot framework and uses the Kotlin language

Okila-Server The Okila server project uses the Spring boot framework and uses the Kotlin language Format Response //The response successfully format

sample project that shows you how you can use Ktor to creat a server for real Project.

Ktor-Sample This is a sample project that shows you how you can use Ktor to creat a server for real Project. What is done Save data to database (Get a

Kotlin API for MiniKeyValue server

minikeyvaluekt Kotlin API for MiniKeyValue. Example val mkv = MiniKeyValue("http://localhost:3000/", MKVOkHttp) assert(mkv.put("wehave", "bigswag")) a

Comments
  • Issue trying to deploy to docker

    Issue trying to deploy to docker

    Docker version: 4.5.0 (74594)

    I am able to run ./gradlew bootRun successfully. Then I tried to build and run the docker image and I am getting a NoClassDefFound exception for HttpClient. Here is the output:

    $ docker run -p8080:8080 peopleinspace-graphql
    Setting Active Processor Count to 6
    WARNING: Unable to convert memory limit "max" from path "/sys/fs/cgroup/memory.max" as int: memory size "max" does not match pattern "^([\\d]+)([kmgtKMGT]?)$"
    Calculating JVM memory based on 1307828K available memory
    Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx887727K -XX:MaxMetaspaceSize=112900K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 1307828K, Thread Count: 50, Loaded Class Count: 17519, Headroom: 0%)
    Enabling Java Native Memory Tracking
    Adding 128 container CA certificates to JVM truststore
    Spring Cloud Bindings Enabled
    Picked up JAVA_TOOL_OPTIONS: -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -XX:+ExitOnOutOfMemoryError -XX:ActiveProcessorCount=6 -XX:MaxDirectMemorySize=10M -Xmx887727K -XX:MaxMetaspaceSize=112900K -XX:ReservedCodeCacheSize=240M -Xss1M -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics -Dorg.springframework.cloud.bindings.boot.enable=true
    
      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::                (v2.5.6)
    
    2022-02-11 15:03:01.835  INFO 1 --- [           main] demo.DemoApplicationKt                   : Starting DemoApplicationKt using Java 1.8.0_322 on 057769dbf9a6 with PID 1 (/workspace/BOOT-INF/classes started by cnb in /workspace)
    2022-02-11 15:03:01.837  INFO 1 --- [           main] demo.DemoApplicationKt                   : No active profile set, falling back to default profiles: default
    2022-02-11 15:03:03.026  WARN 1 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'issPositionSubscription' defined in file [/workspace/BOOT-INF/classes/demo/IssPositionSubscription.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [demo.IssPositionSubscription]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: Ljava/net/http/HttpClient;
    2022-02-11 15:03:03.041  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 
    
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2022-02-11 15:03:03.065 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'issPositionSubscription' defined in file [/workspace/BOOT-INF/classes/demo/IssPositionSubscription.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [demo.IssPositionSubscription]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: Ljava/net/http/HttpClient;
    	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:315) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:181) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.12.jar:5.3.12]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.12.jar:5.3.12]
    	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.5.6.jar:2.5.6]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.6.jar:2.5.6]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.6.jar:2.5.6]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.6.jar:2.5.6]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.6.jar:2.5.6]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.6.jar:2.5.6]
    	at demo.DemoApplicationKt.main(DemoApplication.kt:14) [classes/:na]
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_322]
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_322]
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_322]
    	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_322]
    	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [workspace/:na]
    	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [workspace/:na]
    	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [workspace/:na]
    	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [workspace/:na]
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [demo.IssPositionSubscription]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: Ljava/net/http/HttpClient;
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:311) ~[spring-beans-5.3.12.jar:5.3.12]
    	... 27 common frames omitted
    Caused by: java.lang.NoClassDefFoundError: Ljava/net/http/HttpClient;
    	at java.lang.Class.getDeclaredFields0(Native Method) ~[na:1.8.0_322]
    	at java.lang.Class.privateGetDeclaredFields(Class.java:2583) ~[na:1.8.0_322]
    	at java.lang.Class.getDeclaredField(Class.java:2068) ~[na:1.8.0_322]
    	at java.util.concurrent.atomic.AtomicLongFieldUpdater$CASUpdater$1.run(AtomicLongFieldUpdater.java:388) ~[na:1.8.0_322]
    	at java.util.concurrent.atomic.AtomicLongFieldUpdater$CASUpdater$1.run(AtomicLongFieldUpdater.java:386) ~[na:1.8.0_322]
    	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_322]
    	at java.util.concurrent.atomic.AtomicLongFieldUpdater$CASUpdater.<init>(AtomicLongFieldUpdater.java:385) ~[na:1.8.0_322]
    	at java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater(AtomicLongFieldUpdater.java:89) ~[na:1.8.0_322]
    	at io.ktor.client.engine.java.JavaHttpEngine.<clinit>(JavaHttpEngine.kt) ~[ktor-client-java-jvm-2.0.0-beta-1.jar:2.0.0-beta-1]
    	at io.ktor.client.engine.java.Java.create(Java.kt:18) ~[ktor-client-java-jvm-2.0.0-beta-1.jar:2.0.0-beta-1]
    	at io.ktor.client.HttpClientKt.HttpClient(HttpClient.kt:44) ~[ktor-client-core-jvm-2.0.0-beta-1.jar:2.0.0-beta-1]
    	at demo.PeopleInSpaceApiKt.createHttpClient(PeopleInSpaceApi.kt:30) ~[classes/:na]
    	at demo.PeopleInSpaceApi.<init>(PeopleInSpaceApi.kt:24) ~[classes/:na]
    	at demo.PeopleInSpaceApi.<init>(PeopleInSpaceApi.kt:21) ~[classes/:na]
    	at demo.IssPositionSubscription.<init>(IssPositionSubscription.kt:18) ~[classes/:na]
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_322]
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_322]
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_322]
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_322]
    	at kotlin.reflect.jvm.internal.calls.CallerImpl$Constructor.call(CallerImpl.kt:41) ~[kotlin-reflect-1.6.10.jar:1.6.10-release-923(1.6.10)]
    	at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) ~[kotlin-reflect-1.6.10.jar:1.6.10-release-923(1.6.10)]
    	at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:159) ~[kotlin-reflect-1.6.10.jar:1.6.10-release-923(1.6.10)]
    	at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:112) ~[kotlin-reflect-1.6.10.jar:1.6.10-release-923(1.6.10)]
    	at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:867) ~[spring-beans-5.3.12.jar:5.3.12]
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:196) ~[spring-beans-5.3.12.jar:5.3.12]
    	... 29 common frames omitted
    Caused by: java.lang.ClassNotFoundException: java.net.http.HttpClient
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:387) ~[na:1.8.0_322]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_322]
    	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:135) ~[workspace/:na]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_322]
    	... 54 common frames omitted
    
    
    Native Memory Tracking:
    
    Total: reserved=2374907KB, committed=333747KB
    -                 Java Heap (reserved=888832KB, committed=135168KB)
                                (mmap: reserved=888832KB, committed=135168KB) 
     
    -                     Class (reserved=1087360KB, committed=43136KB)
                                (classes #6418)
                                (malloc=8064KB #7972) 
                                (mmap: reserved=1079296KB, committed=35072KB) 
     
    -                    Thread (reserved=17500KB, committed=17500KB)
                                (thread #17)
                                (stack: reserved=17428KB, committed=17428KB)
                                (malloc=55KB #102) 
                                (arena=17KB #31)
     
    -                      Code (reserved=251258KB, committed=10566KB)
                                (malloc=1658KB #3298) 
                                (mmap: reserved=249600KB, committed=8908KB) 
     
    -                        GC (reserved=40561KB, committed=37981KB)
                                (malloc=8081KB #176) 
                                (mmap: reserved=32480KB, committed=29900KB) 
     
    -                  Compiler (reserved=20068KB, committed=20068KB)
                                (malloc=11KB #265) 
                                (arena=20057KB #17)
     
    -                  Internal (reserved=8311KB, committed=8311KB)
                                (malloc=8279KB #9003) 
                                (mmap: reserved=32KB, committed=32KB) 
     
    -                    Symbol (reserved=10029KB, committed=10029KB)
                                (malloc=8774KB #80024) 
                                (arena=1255KB #1)
     
    -    Native Memory Tracking (reserved=1616KB, committed=1616KB)
                                (malloc=5KB #64) 
                                (tracking overhead=1611KB)
     
    -               Arena Chunk (reserved=49371KB, committed=49371KB)
                                (malloc=49371KB) 
     
    
    opened by rindress 4
Owner
John O'Reilly
Android Software Engineer
John O'Reilly
GraphQL Jetpack - A collection of packages for easily writing Java GraphQL server implementations

GraphQL Jetpack A collection of packages for easily writing Java GraphQL server

Ryan Yang 18 Dec 2, 2022
Kotlin-GraphQL-Apollo - Sencillo cliente para consumir una API GraphQL con Apollo usando Kotlin

Kotlin GraphQL Apollo Sencillo cliente para consumir una API GraphQL con Apollo

José Luis González Sánchez 2 Jan 25, 2022
Victor Hugo 1 Feb 2, 2022
Koltin Multplatform Project that interacts with a GraphQL server to display golf scores, player and weather information.

GolfScoresKMM Koltin Multplatform Project that interacts with a GraphQL server to display golf scores, player and weather information. The app is setu

Mohit 15 Oct 21, 2022
Mock up social media android application created to interact with a backend Java server using GraphQL.

The Community Board Project Authorship: author: dnglokpor date: may 2022 Project Summary: The Community Board Project consists of a Java Spring Boot b

Delwys Glokpor 1 May 17, 2022
Allowing server admins to backdoor their own server!

DiscordBackdoorBot Allowing server admins to backdoor their own server! What does Discord Backdoor Bot do? Discord Backdoor bot allows the bot owner t

Awesomemoder316 1 Jun 8, 2022
Jambeez-server - Jambeez server with kotlin

jambeez-server How to start Start your own server with: docker pull ghcr.io/jamb

null 5 Apr 2, 2022
Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, KGraphQL/GraphQL generated endpoints, Gradle.

Kotlin Clean Architecture Backend Kotlin backend based on the Clean Architecture principles. The application is separated into three modules: Domain,

null 255 Jan 3, 2023
🗼 yukata (浴衣) is a modernized and fast GraphQL implementation made in Kotlin

?? yukata 浴衣 - Modernized and fast implementation of GraphQL made in Kotlin yukata is never meant to be captialised, so it'll just be yukata if you me

Noel 5 Nov 4, 2022
A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Dario Mungoi 7 Sep 17, 2022