BAEL-2106: Spring Boot deployment to Openshift
This commit is contained in:
parent
ab821cb4e5
commit
ee2e546508
|
@ -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/
|
|
@ -1,231 +1,311 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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"
|
<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">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.baeldung</groupId>
|
<groupId>org.baeldung</groupId>
|
||||||
<artifactId>spring-boot-bootstrap</artifactId>
|
<artifactId>spring-boot-bootstrap</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>spring-boot-bootstrap</name>
|
<name>spring-boot-bootstrap</name>
|
||||||
<description>Demo project for Spring Boot</description>
|
<description>Demo project for Spring Boot</description>
|
||||||
|
<parent>
|
||||||
|
<artifactId>parent-boot-2</artifactId>
|
||||||
|
<groupId>com.baeldung</groupId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<relativePath>../parent-boot-2</relativePath>
|
||||||
|
</parent>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.rest-assured</groupId>
|
||||||
|
<artifactId>rest-assured</artifactId>
|
||||||
|
<version>${rest-assured.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
<version>${servlet.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
<parent>
|
<profiles>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<profile>
|
||||||
<groupId>com.baeldung</groupId>
|
<id>openshift</id>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<properties>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<spring-cloud-k8s.version>0.3.0.RELEASE</spring-cloud-k8s.version>
|
||||||
</parent>
|
<spring-cloud.version>Finchley.SR2</spring-cloud.version>
|
||||||
<dependencyManagement>
|
<fabric8.maven.plugin.version>3.5.37</fabric8.maven.plugin.version>
|
||||||
<dependencies>
|
</properties>
|
||||||
<dependency>
|
<dependencyManagement>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<dependencies>
|
||||||
<artifactId>spring-cloud-dependencies</artifactId>
|
<dependency>
|
||||||
<version>Finchley.SR1</version>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<type>pom</type>
|
<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
|
||||||
<scope>import</scope>
|
<version>${spring-cloud-k8s.version}</version>
|
||||||
</dependency>
|
<type>pom</type>
|
||||||
</dependencies>
|
<scope>import</scope>
|
||||||
</dependencyManagement>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<dependencies>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<dependency>
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<version>${spring-cloud.version}</version>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<type>pom</type>
|
||||||
</dependency>
|
<scope>import</scope>
|
||||||
<dependency>
|
</dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</dependencies>
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
</dependencyManagement>
|
||||||
</dependency>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-cloud-starter</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
|
<artifactId>spring-boot-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
</dependencies>
|
||||||
<groupId>com.h2database</groupId>
|
<build>
|
||||||
<artifactId>h2</artifactId>
|
<resources>
|
||||||
</dependency>
|
<resource>
|
||||||
<dependency>
|
<directory>src/main/resources</directory>
|
||||||
<groupId>mysql</groupId>
|
<excludes>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<exclude>**/logback.xml</exclude>
|
||||||
</dependency>
|
</excludes>
|
||||||
<dependency>
|
</resource>
|
||||||
<groupId>org.springframework.boot</groupId>
|
</resources>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<plugins>
|
||||||
</dependency>
|
<plugin>
|
||||||
<dependency>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<configuration>
|
||||||
<scope>test</scope>
|
<excludes>
|
||||||
</dependency>
|
<exclude>**/cloud/config/*.java</exclude>
|
||||||
<dependency>
|
</excludes>
|
||||||
<groupId>io.rest-assured</groupId>
|
</configuration>
|
||||||
<artifactId>rest-assured</artifactId>
|
</plugin>
|
||||||
<version>${rest-assured.version}</version>
|
<plugin>
|
||||||
<scope>test</scope>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</dependency>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<dependency>
|
</plugin>
|
||||||
<groupId>javax.servlet</groupId>
|
<plugin>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<groupId>io.fabric8</groupId>
|
||||||
<version>${servlet.version}</version>
|
<artifactId>fabric8-maven-plugin</artifactId>
|
||||||
</dependency>
|
<version>${fabric8.maven.plugin.version}</version>
|
||||||
</dependencies>
|
<executions>
|
||||||
|
<execution>
|
||||||
<profiles>
|
<id>fmp</id>
|
||||||
<profile>
|
<goals>
|
||||||
<id>cloud-gcp</id>
|
<goal>resource</goal>
|
||||||
<dependencies>
|
<goal>build</goal>
|
||||||
<dependency>
|
</goals>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
</execution>
|
||||||
<artifactId>spring-cloud-gcp-starter</artifactId>
|
</executions>
|
||||||
<version>1.0.0.RELEASE</version>
|
</plugin>
|
||||||
</dependency>
|
</plugins>
|
||||||
<dependency>
|
</build>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
</profile>
|
||||||
<artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId>
|
<profile>
|
||||||
<version>1.0.0.RELEASE</version>
|
<id>cloud-gcp</id>
|
||||||
</dependency>
|
<dependencyManagement>
|
||||||
</dependencies>
|
<dependencies>
|
||||||
<build>
|
<dependency>
|
||||||
<finalName>${project.name}-gcp</finalName>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<resources>
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
<resource>
|
<version>Finchley.SR1</version>
|
||||||
<directory>src/main/resources</directory>
|
<type>pom</type>
|
||||||
<excludes>
|
<scope>import</scope>
|
||||||
<exclude>**/logback.xml</exclude>
|
</dependency>
|
||||||
</excludes>
|
</dependencies>
|
||||||
</resource>
|
</dependencyManagement>
|
||||||
</resources>
|
<dependencies>
|
||||||
<plugins>
|
<dependency>
|
||||||
<plugin>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<groupId>com.google.cloud.tools</groupId>
|
<artifactId>spring-cloud-gcp-starter</artifactId>
|
||||||
<artifactId>appengine-maven-plugin</artifactId>
|
<version>1.0.0.RELEASE</version>
|
||||||
<version>1.3.2</version>
|
</dependency>
|
||||||
</plugin>
|
<dependency>
|
||||||
<plugin>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<artifactId>spring-cloud-gcp-starter-sql-mysql</artifactId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<version>1.0.0.RELEASE</version>
|
||||||
</plugin>
|
</dependency>
|
||||||
</plugins>
|
</dependencies>
|
||||||
</build>
|
<build>
|
||||||
</profile>
|
<finalName>${project.name}-gcp</finalName>
|
||||||
<profile>
|
<resources>
|
||||||
<id>cloudfoundry</id>
|
<resource>
|
||||||
<dependencies>
|
<directory>src/main/resources</directory>
|
||||||
<dependency>
|
<excludes>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<exclude>**/logback.xml</exclude>
|
||||||
<artifactId>spring-cloud-starter</artifactId>
|
</excludes>
|
||||||
</dependency>
|
</resource>
|
||||||
<dependency>
|
</resources>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<plugins>
|
||||||
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
|
<plugin>
|
||||||
</dependency>
|
<groupId>com.google.cloud.tools</groupId>
|
||||||
</dependencies>
|
<artifactId>appengine-maven-plugin</artifactId>
|
||||||
<build>
|
<version>1.3.2</version>
|
||||||
<finalName>${project.name}-cf</finalName>
|
</plugin>
|
||||||
<resources>
|
<plugin>
|
||||||
<resource>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<directory>src/main/resources</directory>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<excludes>
|
</plugin>
|
||||||
<exclude>**/logback.xml</exclude>
|
</plugins>
|
||||||
</excludes>
|
</build>
|
||||||
</resource>
|
</profile>
|
||||||
</resources>
|
<profile>
|
||||||
<plugins>
|
<id>cloudfoundry</id>
|
||||||
<plugin>
|
<dependencyManagement>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependencies>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<dependency>
|
||||||
</plugin>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<plugin>
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<version>Finchley.SR1</version>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<type>pom</type>
|
||||||
<configuration>
|
<scope>import</scope>
|
||||||
<excludes>
|
</dependency>
|
||||||
<exclude>**/cloud/config/*.java</exclude>
|
</dependencies>
|
||||||
</excludes>
|
</dependencyManagement>
|
||||||
</configuration>
|
<dependencies>
|
||||||
</plugin>
|
<dependency>
|
||||||
</plugins>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
</build>
|
<artifactId>spring-cloud-starter</artifactId>
|
||||||
</profile>
|
</dependency>
|
||||||
<profile>
|
<dependency>
|
||||||
<id>autoconfiguration</id>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<build>
|
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
|
||||||
<plugins>
|
</dependency>
|
||||||
<plugin>
|
</dependencies>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<build>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<finalName>${project.name}-cf</finalName>
|
||||||
<executions>
|
<resources>
|
||||||
<execution>
|
<resource>
|
||||||
<phase>integration-test</phase>
|
<directory>src/main/resources</directory>
|
||||||
<goals>
|
<excludes>
|
||||||
<goal>test</goal>
|
<exclude>**/logback.xml</exclude>
|
||||||
</goals>
|
</excludes>
|
||||||
<configuration>
|
</resource>
|
||||||
<excludes>
|
</resources>
|
||||||
<exclude>**/*LiveTest.java</exclude>
|
<plugins>
|
||||||
<exclude>**/*IntegrationTest.java</exclude>
|
<plugin>
|
||||||
<exclude>**/*IntTest.java</exclude>
|
<groupId>org.springframework.boot</groupId>
|
||||||
</excludes>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<includes>
|
</plugin>
|
||||||
<include>**/AutoconfigurationTest.java</include>
|
<plugin>
|
||||||
</includes>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
</configuration>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
</execution>
|
<configuration>
|
||||||
</executions>
|
<excludes>
|
||||||
<configuration>
|
<exclude>**/cloud/config/*.java</exclude>
|
||||||
<systemPropertyVariables>
|
</excludes>
|
||||||
<test.mime>json</test.mime>
|
</configuration>
|
||||||
</systemPropertyVariables>
|
</plugin>
|
||||||
</configuration>
|
</plugins>
|
||||||
</plugin>
|
</build>
|
||||||
</plugins>
|
</profile>
|
||||||
</build>
|
<profile>
|
||||||
</profile>
|
<id>autoconfiguration</id>
|
||||||
<profile>
|
<build>
|
||||||
<id>thin-jar</id>
|
<plugins>
|
||||||
<build>
|
<plugin>
|
||||||
<plugins>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<plugin>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<groupId>org.springframework.boot.experimental</groupId>
|
<executions>
|
||||||
<artifactId>spring-boot-thin-maven-plugin</artifactId>
|
<execution>
|
||||||
<version>${thin.version}</version>
|
<phase>integration-test</phase>
|
||||||
<executions>
|
<goals>
|
||||||
<execution>
|
<goal>test</goal>
|
||||||
<!-- Download the dependencies at build time -->
|
</goals>
|
||||||
<id>resolve</id>
|
<configuration>
|
||||||
<goals>
|
<excludes>
|
||||||
<goal>resolve</goal>
|
<exclude>**/*LiveTest.java</exclude>
|
||||||
</goals>
|
<exclude>**/*IntegrationTest.java</exclude>
|
||||||
<inherited>false</inherited>
|
<exclude>**/*IntTest.java</exclude>
|
||||||
</execution>
|
</excludes>
|
||||||
</executions>
|
<includes>
|
||||||
</plugin>
|
<include>**/AutoconfigurationTest.java</include>
|
||||||
</plugins>
|
</includes>
|
||||||
</build>
|
</configuration>
|
||||||
</profile>
|
</execution>
|
||||||
</profiles>
|
</executions>
|
||||||
<build>
|
<configuration>
|
||||||
<plugins>
|
<systemPropertyVariables>
|
||||||
<plugin>
|
<test.mime>json</test.mime>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
</systemPropertyVariables>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
</configuration>
|
||||||
<configuration>
|
</plugin>
|
||||||
<excludes>
|
</plugins>
|
||||||
<exclude>**/cloud/*.java</exclude>
|
</build>
|
||||||
</excludes>
|
</profile>
|
||||||
</configuration>
|
<profile>
|
||||||
</plugin>
|
<id>thin-jar</id>
|
||||||
</plugins>
|
<build>
|
||||||
</build>
|
<plugins>
|
||||||
<properties>
|
<plugin>
|
||||||
<servlet.version>4.0.0</servlet.version>
|
<groupId>org.springframework.boot.experimental</groupId>
|
||||||
</properties>
|
<artifactId>spring-boot-thin-maven-plugin</artifactId>
|
||||||
|
<version>${thin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<!-- Download the dependencies at build time -->
|
||||||
|
<id>resolve</id>
|
||||||
|
<goals>
|
||||||
|
<goal>resolve</goal>
|
||||||
|
</goals>
|
||||||
|
<inherited>false</inherited>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/cloud/*.java</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<properties>
|
||||||
|
<servlet.version>4.0.0</servlet.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue