Skip navigation

Since WildFly 10 Final was just released, the OpenShift WildFly cartridge has been updated as well. This post will walk you through getting started on OpenShift and deploying a WildFly quickstart. If you already have an existing WildFly OpenShift app, you'll want to check out these tips for migrating your app to WildFly 10 Final.

 

Creating a new app

There are a few options for creating an app on OpenShift:

  • To use the OpenShift Web Console, just click here.
  • To get started directly from Eclipse, you'll first need to install the OpenShift JBoss Tools package. Then, simply use the New OpenShift Application Wizard to create your app.
  • With JBoss Developer Studio, the OpenShift JBoss Tools package is already installed so you can get started right away with the New OpenShift Application Wizard.
  • To use the CLI, make sure you've got the OpenShift Client Tools installed and then execute the following command:
    rhc app create <WILDFLY_APP_NAME> jboss-wildfly-10

 

WildFly management options

Once you've created your app, it will be available at http://<WILDFLY_APP_NAME>-<NAMESPACE>-rhcloud.com. You can then use the WildFly CLI or Admin Console to manage your server.


To connect to the CLI:

rhc ssh <WILDFLY_APP_NAME> # This command allows you to ssh into your OpenShift app
jboss-cli.sh -c --controller=$OPENSHIFT_WILDFLY_IP:$OPENSHIFT_WILDFLY_MANAGEMENT_HTTP_PORT


When logging into the Admin Console, you can use the credentials for the WildFly management user that's automatically created for you by the WildFly cartridge. To obtain the necessary credentials:

rhc ssh <WILDFLY_APP_NAME>
echo $OPENSHIFT_WILDFLY_USERNAME
echo $OPENSHIFT_WILDFLY_PASSWORD


Then, using port forwarding, you're ready to access the Admin Console from your local machine:

rhc port-forward <WILDFLY_APP_NAME>


Deploying a WildFly quickstart

Getting started with a WildFly quickstart on OpenShift is simple. The following steps will demonstrate how to deploy the kitchensink quickstart, an application that demonstrates a few different Java EE 7 technologies, using the OpenShift Client Tools.


If you created your OpenShift app using the CLI, Eclipse, or JBoss Developer Studio, you should already have a clone of your app's OpenShift git repository on your local machine. If you created your app using the OpenShift Web Console, you'll need to first clone your app's git repository as follows:

rhc git-clone <WILDFLY_APP_NAME>

 

Next, navigate to your app's git repository on your machine and remove the source for the default application that's created by the WildFly cartridge:

git rm -r src pom.xml

 

Now, copy over the source for the kitchensink quickstart:

cp -r QUICKSTART_HOME/kitchensink/src .
cp QUICKSTART_HOME/kitchensink/pom.xml .

 

Next, push your changes:

git add src pom.xml
git commit -m "Deploying the kitchensink quickstart on WildFly 10 on OpenShift!"
git push

 

That's it! The kitchensink quickstart will now be available at your application URL (i.e., http://<WILDFLY_APP_NAME>-<NAMESPACE>-rhcloud.com).


Enjoy!


This post provides some tips on how to migrate an existing OpenShift application to WildFly 10 Final.

 

Migrating from WildFly 10 Alpha/Beta/CR

If you already have an existing WildFly 10 Alpha/Beta/CR app, you can simply create a new WildFly 10 app based on the existing app using the following command:

rhc app create <NEW_WILDFLY_APP> --from-app <OLD_WILDFLY_APP>

 

The result will be a new WildFly 10 Final application that's a clone of your existing one. This means that your new app will have the same git repository, gear size, scaling configuration, environment variables, deployments, etc.

 

Migrating from WildFly 8 or WildFly 9

You can create a new WildFly 10 Final app that's based off your existing app's git repository. There are a couple ways to do this. One option is to first create a new WildFly 10 app and then manually copy over the contents of your old git repo to your new git repo once the new app has been created. Another option is to use the following command:

rhc app create <NEW_WILDFLY_APP> jboss-wildfly-10 --from-code http://url/to/git_repo.git

 

With both of these options, you should first replace the standalone.xml file from your git repo's .openshift/config directory with the WildFly 10 standalone.xml file.

 

Migrating from AS 7

You can create a new WildFly 10 Final app that's based off your existing app's git repository, as described above. However, there are some extra caveats that you should be aware of:

  • If your git repo contains any action hook scripts that end with "_jbossas", these scripts will need to be renamed to end with "_wildfly" instead.
  • If your git repo contains any action hook scripts that reference OpenShift environment variables that start with "OPENSHIFT_JBOSSAS_", these scripts will need to be updated to reference "OPENSHIFT_WILDFLY_" instead.

To see if you have any such scripts, have a look in the .openshift/action_hooks directory in your git repo.


Happy migrating!

Filter Blog

By date:
By tag: