@@ -226,65 +226,16 @@ Your application should now be up and running on Heroku.
226226
227227[[cloud-deployment-openshift]]
228228=== OpenShift
229- https://www.openshift.com/[OpenShift] is the RedHat public (and enterprise) PaaS solution.
230- Like Heroku, it works by running scripts triggered by git commits, so you can script
231- the launching of a Spring Boot application in pretty much any way you like as long as the
232- Java runtime is available (which is a standard feature you can ask for at OpenShift).
233- To do this you can use the
234- https://www.openshift.com/developers/do-it-yourself[DIY Cartridge] and hooks in your
235- repository under `.openshift/action_hooks`:
236-
237- The basic model is to:
238-
239- 1. Ensure Java and your build tool are installed remotely, e.g. using a `pre_build` hook
240- (Java and Maven are installed by default, Gradle is not)
241- 2. Use a `build` hook to build your jar (using Maven or Gradle), e.g.
242- +
243- [indent=0]
244- ----
245- #!/bin/bash
246- cd $OPENSHIFT_REPO_DIR
247- mvn package -s .openshift/settings.xml -DskipTests=true
248- ----
249- +
250- 3. Add a `start` hook that calls `java -jar ...`
251- +
252- [indent=0]
253- ----
254- #!/bin/bash
255- cd $OPENSHIFT_REPO_DIR
256- nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} &
257- ----
258- +
259- 4. Use a `stop` hook (since the start is supposed to return cleanly), e.g.
260- +
261- [indent=0]
262- ----
263- #!/bin/bash
264- source $OPENSHIFT_CARTRIDGE_SDK_BASH
265- PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }')
266- if [ -z "$PID" ]
267- then
268- client_result "Application is already stopped"
269- else
270- kill $PID
271- fi
272- ----
273- +
274- 5. Embed service bindings from environment variables provided by the platform
275- in your `application.properties`, e.g.
276- +
277- [indent=0]
278- ----
279- spring.datasource.url: jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}
280- spring.datasource.username: ${OPENSHIFT_MYSQL_DB_USERNAME}
281- spring.datasource.password: ${OPENSHIFT_MYSQL_DB_PASSWORD}
282- ----
229+ https://www.openshift.com/[OpenShift] is the Red Hat public (and enterprise) extension of the
230+ Kubernetes container orchestration platform. Just as in Kubernetes, OpenShift has many
231+ options for installing Spring Boot based applications.
283232
284- There's a blog on https://www.openshift.com/blogs/run-gradle-builds-on-openshift[running
285- Gradle in OpenShift] on their website that will get you started with a gradle build to
286- run the app.
233+ OpenShift has many resources describing how to deploy Spring Boot applications, which include :
287234
235+ * https://blog.openshift.com/using-openshift-enterprise-grade-spring-boot-deployments/[Using the S2I builder]
236+ * https://access.redhat.com/documentation/en-us/reference_architectures/2017/html-single/spring_boot_microservices_on_red_hat_openshift_container_platform_3/[Architecture guide]
237+ * https://blog.openshift.com/using-spring-boot-on-openshift/[Running as traditional web application on Wildfly]
238+ * https://blog.openshift.com/openshift-commons-briefing-96-cloud-native-applications-spring-rhoar/[OpenShift Commons Briefing]
288239
289240
290241[[cloud-deployment-aws]]
0 commit comments