Skip to content

Commit

Permalink
[#239] Base Structure for Hera API (#240)
Browse files Browse the repository at this point in the history
* Added API module. Updated CI/CD pipeline with better naming and so that API is also built and deployed when pushing to master

* Foundation for Kotlin GraphQL API
  • Loading branch information
AarKro authored and Pacmens committed Jul 2, 2021
1 parent 361b0e6 commit cf09102
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 5 deletions.
99 changes: 99 additions & 0 deletions api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hera</artifactId>
<groupId>hera</groupId>
<version>2.0.0-beta.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>api</artifactId>
<packaging>jar</packaging>

<properties>
<kotlin.version>1.3.71</kotlin.version>
</properties>

<dependencies>
<dependency>
<groupId>com.expediagroup</groupId>
<artifactId>graphql-kotlin-spring-server</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.2.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>hera</groupId>
<artifactId>data</artifactId>
<version>2.0.0-beta.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>hera-prod-api</finalName>
<archive>
<manifest>
<mainClass>hera.core.Core</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 11 additions & 0 deletions api/src/main/kotlin/hera/api/ApiApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package hera.api

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
open class ApiApplication

fun main(args: Array<String>) {
runApplication<ApiApplication>(*args)
}
11 changes: 11 additions & 0 deletions api/src/main/kotlin/hera/api/schemas/Test.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package hera.api.schemas

import com.expediagroup.graphql.spring.operations.Query
import org.springframework.stereotype.Component

@Component
class Test : Query {
fun test(): String {
return "test successfull!"
}
}
1 change: 1 addition & 0 deletions api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
graphql.packages=hera.api.schemas
6 changes: 4 additions & 2 deletions appspec.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version: 0.0
os: linux
files:
- source: ./hera-prod-bundle-jar-with-dependencies.jar
destination: /home/ec2-user/bots
- source: ./hera-prod-bot-jar-with-dependencies.jar
destination: /home/ec2-user/apps
- source: ./hera-prod-api-jar-with-dependencies.jar
destination: /home/ec2-user/apps
3 changes: 2 additions & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ phases:
- mvn clean install
artifacts:
files:
- core/target/hera-prod-bundle-jar-with-dependencies.jar
- core/target/hera-prod-bot-jar-with-dependencies.jar
- api/target/hera-prod-api-jar-with-dependencies.jar
- appspec.yml
discard-paths: yes
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>hera-prod-bundle</finalName>
<finalName>hera-prod-bot</finalName>
<archive>
<manifest>
<mainClass>hera.core.Core</mainClass>
Expand Down
2 changes: 1 addition & 1 deletion data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<artifactId>data</artifactId>

<properties>
<kotlin.version>1.3.61</kotlin.version>
<kotlin.version>1.3.71</kotlin.version>
</properties>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<module>core</module>
<module>data</module>
<module>metrics</module>
<module>api</module>
</modules>

<dependencies>
Expand Down

0 comments on commit cf09102

Please sign in to comment.