Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate API code + bootstrap webserver + simplify launch #8

Merged
merged 4 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.gradle
.idea
build
.DS_Store
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ FROM gradle:jdk14 AS build

COPY . /code
WORKDIR /code
RUN gradle fatjar --no-daemon
RUN gradle distTar --no-daemon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason to use tar vs jar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to follow the gradle way of distributing. I ran into a lot of problem with the server piece when I tried to create a fatjar.


# RUN
FROM openjdk:14.0.2-slim
EXPOSE 8080

RUN mkdir /app
WORKDIR /app/conduit-server

COPY --from=build /code/build/libs/*fatjar*.jar /app/conduit-application.jar
COPY --from=build /code/conduit-server/build/distributions/*.tar conduit-server.tar
RUN tar xvf conduit-server.tar --strip-components=1

ENTRYPOINT ["java", "-jar", "/app/conduit-application.jar"]
CMD bin/conduit-server
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Conduit
## Getting Started

### Docker
Simply run
```
docker run --rm -it dataline/conduit:$VERSION
./tools/app/start.sh
```

### Repo
```
VERSION=$(cat .version)
docker build . -t dataline/conduit:$VERSION
docker run --rm -it dataline/conduit:$VERSION
```
And go to [http://localhost:8080]()
39 changes: 17 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
plugins {
id 'java'
allprojects {
group = "io.dataline.${rootProject.name}"
version = rootProject.file('.version').text.trim()
}

group 'io.dataline'
version = rootProject.file('.version').text.trim()
// For java projects (might need to add some filtering once we have the UI)
subprojects {
apply plugin: 'java'

repositories {
mavenCentral()
}

test {
useJUnitPlatform()
}
repositories {
mavenCentral()
}

dependencies {
compile group: 'com.google.guava', name: 'guava', version: '29.0-jre'
test {
useJUnitPlatform()
}

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
}
dependencies {
implementation group: 'com.google.guava', name: 'guava', version: '29.0-jre'

task fatjar(type: Jar) {
manifest {
attributes 'Main-Class': 'io.dataline.playground.HelloWorld'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed if we are importing it as testImplementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the same lib

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

late night double vision

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.4.6'
}
baseName "${rootProject.name}-fatjar"
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
47 changes: 47 additions & 0 deletions conduit-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id "org.openapi.generator" version "4.3.1"
id "java-library"
}

def specFile = "$projectDir/src/main/openapi/conduit.yaml".toString()

openApiGenerate {
generatorName = "jaxrs-spec"
inputSpec = specFile
outputDir = "$buildDir/generated".toString()

apiPackage = "io.dataline.conduit.api"
invokerPackage = "io.dataline.conduit.api.invoker"
modelPackage = "io.dataline.conduit.api.model"

generateApiDocumentation = false

configOptions = [
dateLibrary : "java8",
generatePom : "false",
interfaceOnly: "true"
]
}

dependencies {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.11.2'

implementation group: 'io.swagger', name: 'swagger-annotations', version: '1.6.2'

implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
implementation group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1.1'
implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
}

sourceSets {
main {
java {
srcDir "$buildDir/generated/src/gen/java"
}
resources {
srcDir "$projectDir/src/main/openapi/"
}
}
}

compileJava.dependsOn tasks.openApiGenerate
Loading