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!