Commit 62d2b413 authored by Phillip Webb's avatar Phillip Webb

Polish documentation

Apply consistent styling and edit a few section for clarity.
parent e032b673
...@@ -235,63 +235,70 @@ an extensive https://github.com/CloudBees-community/springboot-gradle-cloudbees ...@@ -235,63 +235,70 @@ an extensive https://github.com/CloudBees-community/springboot-gradle-cloudbees
that covers the steps that you need to follow when deploying to CloudBees. that covers the steps that you need to follow when deploying to CloudBees.
[[cloud-deployment-openshift]] [[cloud-deployment-openshift]]
== Openshift == Openshift
https://www.openshift.com/[Openshift] is the RedHat public (and enterprise) PaaS solution. https://www.openshift.com/[Openshift] is the RedHat public (and enterprise) PaaS solution.
Like Heroku, it works by running scripts triggered by git commits, so you can script Like Heroku, it works by running scripts triggered by git commits, so you can script
the launching of a Spring Boot app in pretty much any way you like as long as the the launching of a Spring Boot application in pretty much any way you like as long as the
Java runtime is available (which is a standard feature you can ask from at Openshift). Java runtime is available (which is a standard feature you can ask for at Openshift).
To do this you can use the https://www.openshift.com/developers/do-it-yourself[DIY Cartridge] To do this you can use the
and hooks in your repository under `.openshift/action_scripts`: https://www.openshift.com/developers/do-it-yourself[DIY Cartridge] and hooks in your
repository under `.openshift/action_scripts`:
The basic model is to: The basic model is to:
1. Ensure Java and your build tool are installed remotely, e.g. using 1. Ensure Java and your build tool are installed remotely, e.g. using a `pre_build` hook
a `pre_build` hook (Java and Maven are installed by default, Gradle is not) (Java and Maven are installed by default, Gradle is not)
2. Use a `build` hook to build your jar (using Maven or Gradle), e.g. 2. Use a `build` hook to build your jar (using Maven or Gradle), e.g.
+ +
[indent=0]
---- ----
#!/bin/bash #!/bin/bash
cd $OPENSHIFT_REPO_DIR cd $OPENSHIFT_REPO_DIR
mvn package -s .openshift/settings.xml -DskipTests=true mvn package -s .openshift/settings.xml -DskipTests=true
---- ----
+ +
3. Add a `start` hook that calls `java -jar ...` 3. Add a `start` hook that calls `java -jar ...`
+ +
[indent=0]
---- ----
#!/bin/bash #!/bin/bash
cd $OPENSHIFT_REPO_DIR cd $OPENSHIFT_REPO_DIR
nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} & nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} &
---- ----
+ +
4. Use a `stop` hook (since the start is supposed to return cleanly), e.g. 4. Use a `stop` hook (since the start is supposed to return cleanly), e.g.
+ +
[indent=0]
---- ----
#!/bin/bash #!/bin/bash
source $OPENSHIFT_CARTRIDGE_SDK_BASH source $OPENSHIFT_CARTRIDGE_SDK_BASH
PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }') PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ] if [ -z "$PID" ]
then then
client_result "Application is already stopped" client_result "Application is already stopped"
else else
kill $PID kill $PID
fi fi
---- ----
+ +
5. Embed service bindings from environment variables provided by the platform 5. Embed service bindings from environment variables provided by the platform
in your `application.properties`, e.g. in your `application.properties`, e.g.
+ +
[indent=0]
---- ----
spring.datasource.url: jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME} spring.datasource.url: jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME}
spring.datasource.username: ${OPENSHIFT_MYSQL_DB_USERNAME} spring.datasource.username: ${OPENSHIFT_MYSQL_DB_USERNAME}
spring.datasource.password: ${OPENSHIFT_MYSQL_DB_PASSWORD} spring.datasource.password: ${OPENSHIFT_MYSQL_DB_PASSWORD}
---- ----
There's a blog on https://www.openshift.com/blogs/run-gradle-builds-on-openshift[running Gradle There's a blog on https://www.openshift.com/blogs/run-gradle-builds-on-openshift[running
in Openshift] on their website that will get you started with a gradle build to run Gradle in Openshift] on their website that will get you started with a gradle build to
the app. A http://issues.gradle.org/browse/GRADLE-2871[bug in Gradle] currently prevents you run the app. A http://issues.gradle.org/browse/GRADLE-2871[bug in Gradle] currently
from using Gradle newer than 1.6. prevents you from using Gradle newer than 1.6.
[[cloud-deployment-whats-next]] [[cloud-deployment-whats-next]]
== What to read next == What to read next
......
...@@ -13,9 +13,9 @@ Auditing, health and metrics gathering can be automatically applied to your appl ...@@ -13,9 +13,9 @@ Auditing, health and metrics gathering can be automatically applied to your appl
[[production-ready-enabling]] [[production-ready-enabling]]
== Enabling production-ready features. == Enabling production-ready features.
The https://github.com/spring-projects/spring-boot/tree/master/spring-boot-actuator[`spring-boot-actuator`] module provides all of Spring Boot's production-ready The {github-code}/spring-boot-actuator[`spring-boot-actuator`] module provides all of
features. The simplest way to enable the features is to add a dependency to the Spring Boot's production-ready features. The simplest way to enable the features is to add
`spring-boot-starter-actuator` ``Starter POM''. a dependency to the `spring-boot-starter-actuator` ``Starter POM''.
.Definition of Actuator .Definition of Actuator
**** ****
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment