From ee2e546508e2ca6e43ff6a509bc3bcf050149fcd Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Sun, 4 Nov 2018 12:53:55 +0200 Subject: [PATCH 1/2] BAEL-2106: Spring Boot deployment to Openshift --- spring-boot-bootstrap/openshift/configmap.yml | 7 + spring-boot-bootstrap/pom.xml | 532 ++++++++++-------- .../src/main/fabric8/deployment.yml | 29 + 3 files changed, 342 insertions(+), 226 deletions(-) create mode 100644 spring-boot-bootstrap/openshift/configmap.yml create mode 100644 spring-boot-bootstrap/src/main/fabric8/deployment.yml diff --git a/spring-boot-bootstrap/openshift/configmap.yml b/spring-boot-bootstrap/openshift/configmap.yml new file mode 100644 index 0000000000..94c8d689ae --- /dev/null +++ b/spring-boot-bootstrap/openshift/configmap.yml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: spring-boot-bootstrap +data: + application.properties: |- + spring.datasource.url=jdbc:mysql://baeldung-demo-db:3306/ \ No newline at end of file diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index b5bcc587b1..f1d5e9dac3 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -1,231 +1,311 @@ - 4.0.0 - org.baeldung - spring-boot-bootstrap - jar - spring-boot-bootstrap - Demo project for Spring Boot + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + org.baeldung + spring-boot-bootstrap + jar + spring-boot-bootstrap + Demo project for Spring Boot + + parent-boot-2 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + mysql + mysql-connector-java + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-test + test + + + io.rest-assured + rest-assured + ${rest-assured.version} + test + + + javax.servlet + javax.servlet-api + ${servlet.version} + + - - parent-boot-2 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-2 - - - - - org.springframework.cloud - spring-cloud-dependencies - Finchley.SR1 - pom - import - - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.cloud - spring-cloud-starter - - - org.springframework.boot - spring-boot-starter-cloud-connectors - - - com.h2database - h2 - - - mysql - mysql-connector-java - - - org.springframework.boot - spring-boot-starter-security - - - org.springframework.boot - spring-boot-starter-test - test - - - io.rest-assured - rest-assured - ${rest-assured.version} - test - - - javax.servlet - javax.servlet-api - ${servlet.version} - - - - - - cloud-gcp - - - org.springframework.cloud - spring-cloud-gcp-starter - 1.0.0.RELEASE - - - org.springframework.cloud - spring-cloud-gcp-starter-sql-mysql - 1.0.0.RELEASE - - - - ${project.name}-gcp - - - src/main/resources - - **/logback.xml - - - - - - com.google.cloud.tools - appengine-maven-plugin - 1.3.2 - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - cloudfoundry - - - org.springframework.cloud - spring-cloud-starter - - - org.springframework.boot - spring-boot-starter-cloud-connectors - - - - ${project.name}-cf - - - src/main/resources - - **/logback.xml - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - org.apache.maven.plugins - maven-compiler-plugin - - - **/cloud/config/*.java - - - - - - - - autoconfiguration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - - **/AutoconfigurationTest.java - - - - - - - json - - - - - - - - thin-jar - - - - org.springframework.boot.experimental - spring-boot-thin-maven-plugin - ${thin.version} - - - - resolve - - resolve - - false - - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - **/cloud/*.java - - - - - - - 4.0.0 - + + + openshift + + 0.3.0.RELEASE + Finchley.SR2 + 3.5.37 + + + + + org.springframework.cloud + spring-cloud-kubernetes-dependencies + ${spring-cloud-k8s.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + org.springframework.cloud + spring-cloud-starter-kubernetes-config + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-actuator + + + + + + src/main/resources + + **/logback.xml + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/config/*.java + + + + + org.springframework.boot + spring-boot-maven-plugin + + + io.fabric8 + fabric8-maven-plugin + ${fabric8.maven.plugin.version} + + + fmp + + resource + build + + + + + + + + + cloud-gcp + + + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR1 + pom + import + + + + + + org.springframework.cloud + spring-cloud-gcp-starter + 1.0.0.RELEASE + + + org.springframework.cloud + spring-cloud-gcp-starter-sql-mysql + 1.0.0.RELEASE + + + + ${project.name}-gcp + + + src/main/resources + + **/logback.xml + + + + + + com.google.cloud.tools + appengine-maven-plugin + 1.3.2 + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + cloudfoundry + + + + org.springframework.cloud + spring-cloud-dependencies + Finchley.SR1 + pom + import + + + + + + org.springframework.cloud + spring-cloud-starter + + + org.springframework.boot + spring-boot-starter-cloud-connectors + + + + ${project.name}-cf + + + src/main/resources + + **/logback.xml + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/config/*.java + + + + + + + + autoconfiguration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + **/*LiveTest.java + **/*IntegrationTest.java + **/*IntTest.java + + + **/AutoconfigurationTest.java + + + + + + + json + + + + + + + + thin-jar + + + + org.springframework.boot.experimental + spring-boot-thin-maven-plugin + ${thin.version} + + + + resolve + + resolve + + false + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + **/cloud/*.java + + + + + + + 4.0.0 + diff --git a/spring-boot-bootstrap/src/main/fabric8/deployment.yml b/spring-boot-bootstrap/src/main/fabric8/deployment.yml new file mode 100644 index 0000000000..c27613e83a --- /dev/null +++ b/spring-boot-bootstrap/src/main/fabric8/deployment.yml @@ -0,0 +1,29 @@ +spec: + template: + spec: + containers: + - env: + - name: SPRING_PROFILES_ACTIVE + value: mysql,openshift + - name: SPRING_DATASOURCE_USER + valueFrom: + secretKeyRef: + name: baeldung-demo-db + key: database-user + - name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: baeldung-demo-db + key: database-password + livenessProbe: + httpGet: + path: /actuator/health + port: 8080 + scheme: HTTP + initialDelaySeconds: 180 + readinessProbe: + httpGet: + path: /actuator/health + port: 8080 + scheme: HTTP + initialDelaySeconds: 20 \ No newline at end of file From 82e4adf6233d7e761032a021267374ee86c8259a Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Sun, 4 Nov 2018 15:52:06 +0200 Subject: [PATCH 2/2] BAEL-2106: Spring Boot deployment to Openshift --- spring-boot-bootstrap/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index f1d5e9dac3..b5bf4bc7b6 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -298,7 +298,7 @@ maven-compiler-plugin - **/cloud/*.java + **/cloud/config/*.java