From 422ed616dca45aaa63bbf5ed0f7caeeacd8f8142 Mon Sep 17 00:00:00 2001 From: Dmitriy Kopylenko Date: Mon, 3 Feb 2020 10:47:23 -0500 Subject: [PATCH 1/2] Unified WAR deployment unit --- Jenkinsfile | 2 +- backend/Dockerfile | 4 ++-- backend/build.gradle | 27 ++++----------------------- build.gradle | 2 +- 4 files changed, 8 insertions(+), 27 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c79aaa9cd..3ae5f4595 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline { steps { sh ''' docker stop shibui || true && docker rm shibui || true - docker run -d --restart always --name shibui -p 8080:8080 -v /etc/shibui:/conf -v /etc/shibui/application.yml:/application.yml -m 2GB --memory-swap=4GB unicon/shibui:latest /usr/bin/java -Xmx1G -jar app.jar + docker run -d --restart always --name shibui -p 8080:8080 -v /etc/shibui:/conf -v /etc/shibui/application.yml:/application.yml -m 2GB --memory-swap=4GB --entrypoint /usr/bin/java unicon/shibui:latest -Xmx1G -jar app.war ''' } } diff --git a/backend/Dockerfile b/backend/Dockerfile index 6d9b026ec..1c5c805a4 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -3,8 +3,8 @@ FROM gcr.io/distroless/java ARG JAR_FILE COPY loader.properties loader.properties -COPY ${JAR_FILE} app.jar +COPY ${JAR_FILE} app.war EXPOSE 8080 -ENTRYPOINT ["/usr/bin/java", "-jar", "app.jar"] +ENTRYPOINT ["/usr/bin/java", "-jar", "app.war"] diff --git a/backend/build.gradle b/backend/build.gradle index 334c907ea..a2e4ab24c 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -89,32 +89,13 @@ bootWar { "Implementation-Version" : "${project.version}" ) } - from(tasks.findByPath(':ui:npm_run_buildProd').outputs) { - //Copying into this particular classpath location due too - //deployment to external Tomcat would not work with /public location - //This way, it works with both embedded and extarnal Tomcat - into 'WEB-INF/classes/resources' - } - archiveName = "${baseName}-${version}.war" -} - -bootJar.dependsOn ':ui:npm_run_buildProd' -bootJar.baseName = 'shibui' -bootJar { - manifest { - attributes( - "Manifest-Version" : "1.0", - "Implementation-Version" : "${project.version}", - 'Main-Class': 'org.springframework.boot.loader.PropertiesLauncher' - ) - } from(tasks.findByPath(':ui:npm_run_buildProd').outputs) { //Copying into this particular classpath location due too //deployment to external Tomcat would not work with /public location //This way, it works with both embedded and external Tomcat into 'WEB-INF/classes/resources' } - archiveName = "${baseName}-${version}.jar" + archiveName = "${baseName}-${version}.war" } springBoot { @@ -366,15 +347,15 @@ jacocoTestReport { } } -tasks.docker.dependsOn tasks.bootJar +tasks.docker.dependsOn tasks.bootWar docker { name 'unicon/shibui' tags 'latest' pull true noCache true - files tasks.bootJar.outputs + files tasks.bootWar.outputs files 'src/main/docker-files/loader.properties' - buildArgs(['JAR_FILE': "shibui-${version}.jar"]) + buildArgs(['JAR_FILE': "shibui-${version}.war"]) } tasks.dockerRun.dependsOn tasks.docker diff --git a/build.gradle b/build.gradle index 5b78682dc..a651a1093 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ githubRelease { token project.'i2.github.token' owner project.'i2.github.owner' repo project.'i2.github.repo' - releaseAssets project('backend').getTasksByName('bootWar', false).outputs, project('backend').getTasksByName('bootJar', false).outputs + releaseAssets project('backend').getTasksByName('bootWar', false).outputs overwrite true apiEndpoint project.'i2.github.apiEndpoint' } From f11b5d5da77f9a5bb0eef78f1e15e10fcad9d441 Mon Sep 17 00:00:00 2001 From: Dmitriy Kopylenko Date: Mon, 3 Feb 2020 10:49:47 -0500 Subject: [PATCH 2/2] README --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9c5b29143..bb1ede559 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # shibui -For more information, see `docs` - ## Requirements_ * Java 8 (note that ONLY Java 8 is supported at this time; other later versions might work) @@ -39,7 +37,7 @@ For complete information on overriding default configuration, see [https://docs. ### Deploying as a WAR -The application can be deployed as a WAR file in a Java Servlet 3.0 container. Currently, the application must be run in the root context. +The application can be deployed as a WAR file in a Java Servlet 3.0 container. To override default configuration, see [https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html]. The easiest way to do this in a servlet container is through the use of system properties