Saturday, February 21, 2015

Quick Start: Spring Boot and WildfFly 8.2 on OpenShift

A really “Quick Start” with Spring Boot, WildFly and OpenShift as opposed to my last, more descriptive article.

Prerequisite

Before we can start building the application, we need to have an OpenShift free account and client tools installed.

Step 1: Create WildFly application

To create an application using client tools, type the following command:

rhc create-app <app-name> jboss-wildfly-8 --scaling

This command creates an application using WildFly 8.2 cartridge with scalability option and clones the repository to <app-name> directory.

Step 2: Delete Template Application Source code

OpenShift creates a template project that can be freely removed:

git rm -rf .openshift deployments src README.md pom.xml

Commit the changes:

git commit -am "Removed template application source code"

Step 3: Pull Source code from GitHub

git remote add upstream https://github.com/kolorobot/openshift-wildfly-spring-boot.git
git pull -s recursive -X theirs upstream master

Step 4: Push changes

The basic template is ready to be pushed to OpenShift:

git push

The initial deployment (build and application startup) will take some time (up to several minutes). Subsequent deployments are a bit faster.

You can now browse to: http://<app-name>-<domain>.rhcloud.com and you should see home page with the form.

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Please can you provide the steps to extend your code and architecture to support https on OpenShift cloud . Your help will be extremely useful .

    http://stackoverflow.com/questions/28739380/spring-boot-java-application-deployment-on-redhat-openshift-shared-ssl-certific

    Thank you very much!!

    ReplyDelete
  3. I mean with shared SSL cert (free account) for testing/demo :-)

    ReplyDelete
    Replies
    1. "Support for enabling HTTPS connections to custom, aliased hostnames is available for users of OpenShift Online’s premium plans."

      "You can always take advantage of our *.rhcloud.com wildcard certificate in order to securely connect to any application via it’s original, OpenShift-provided hostname URL."

      So if you deploy your application to let's say myapp-mydomain.rhcloud.com the SSL will be enabled by default, you can check this: https://myapp-mydomain.rhcloud.com.

      Please refer to OS documentation.
      https://developers.openshift.com/en/managing-domains-ssl.html

      Delete
  4. I wonder if the title of this blog post is wrong. It seems to be about OpenShift and WildFly - I don't see anything related to Spring Boot at all right? I was initially excited; thinking someone had figured out how to reuse JEE components from WildFly in Spring Boot - but it doesn't look like it ;)

    ReplyDelete
    Replies
    1. Hi, Thanks for the comment. Have a look at the full article that is more descriptive (http://blog.codeleak.pl/2015/02/openshift-build-spring-boot-application.html). This one is really "Quick Start" as explained on top.

      I am describiing how to deploy Spring Boot app on JEE server and that's it.

      I am sorry for making you confused.

      Delete