JBoss.orgCommunity Documentation

OpenShift Tools Reference Guide

Version: 4.0.0


1. Introduction
2. Creating an OpenShift Application
3. Import an existing application
4. Modifying your Maven Web Application to Deploy to OpenShift
5. Port Forwarding
6. Debugging
6.1. Viewing the Remote Console
6.2. Viewing Environment Variables
7. Deleting applications and domains
7.1. Deleting an application
7.2. Deleting a domain

OpenShift is a cloud solution for your application server requirements. OpenShift is a cloud-based application platform for Java, Perl, PHP, Python, and Ruby applications. JBoss Developer Studio supports OpenShift deployments and this guide will show you how to connect, create and deploy applications with OpenShift, from your workbench.

The OpenShift Application creation wizard is accessed through JBoss Central or by navigating to FileNewOther.


After clicking on the OpenShift Application link, the creation wizard will launch.


If you have already signed up for an OpenShift account then you can input your Username and Password here and click the Next button. If validation is successful you will see the Setup OpenShift Application screen.

If you do not have an OpenShift account, you can create one through the link at the top of the wizard screen. This will open the OpenShift sign-up page within your workbench. Once you have created an account you will need to relaunch the OpenShift Application wizard and input your new username and password.

Note

If you have a local OpenShift Cloud instance you can choose to connect to it instead by either selecting it from the available defined connections in the Connection list, or by deselecting the Use default server option and specifying your own in the Server field.


If you need to create a domain, type the name you wish to have into the Domain name field. You will also need to ensure your public SSH key is provided and listed within the SSH2 Preferences. If you are unsure, click the SSH2 keys wizard link. Click Finish to complete domain creation.

If you already have a domain name then you will not see the Domain Creation screen.

Note

If you ever wish to rename your domain, this can be done through the OpenShift Explorer.


Now ready to create your OpenShift application, you will need to specify a name, the platform type to deploy for, from the Type drop-down list, and the Gear profile to be used.

The Gear profile option concerns the amount of physical space that will be allocated for use by the application. If you are running a trial version of OpenShift only the small Gear profile will be available to you.

Note

No underscores or special characters are allowed in the application name.

You can also select to embed cartridges into your applicaiton. By embedding a cartridge, you allow your application the ability to use the associated technology. For example, embedding the mysql cartridge will grant your application the capability to use a MySQL database.


Since you are creating a new project, leave the Create a new project checkbox ticked.

For easy interaction with the OpenShift server and your domain it is recommended that you leave the Create and setup a server for easy publishing checkbox ticked. Doing so will create an OpenShift server instance in the Servers view, upon completing the wizard.

Click the Next button to progress in the wizard.


The final screen of the OpenShift application wizard specifies Cloning settings. Here you can set the properties for creating a local copy of your application. The Location and Remote name options will be set automatically, however, you are able to change these by deselecting the default option and specifying custom settings in the fields provided.

Click Finish to create the application and clone the Git repository.

The OpenShift application that you created through the wizard, will appear in your Project Explorer tab.


After the Git repository has been cloned, it will be available through the Git Repositories view. You can open it by navigating to WindowShow ViewOtherGitGit Repositories. With the Git Repositories option selected, click OK.


The wizard has also created a server adapter that connects to your OpenShift service. In the Servers tab there will be an OpenShift server available that contains your application. Any changes you make locally to the application can be published to your OpenShift instance by right-clicking on the application under the server in the Servers view, and selecting Full Publish.


As with a local server, double-clicking on the OpenShift server instance in the Servers tab will open the server overview page in your workbench.


The OpenShift application will also be available under your domain in the OpenShift Explorer view.


To import an existing OpenShift application to your workbench, from JBoss Central navigate to the Create Projects section and click on OpenShift Application.


Select your OpenShift server, enter your OpenShift credentials and click the Next button.


On the Setup OpenShift Application screen click the checkbox beside Use existing application and click the Browse button.


A dialog will open where you will see all your OpenShift applications listed, for the current domain.


By selecting an application from the list and clicking the Details button you can see all relevant application information. Click the OK to return to the application selection screen.


Select the application to import and click the OK button.

You will be returned to the Setup OpenShift Application screen and the Use existing application field will be populated with the name of the application you selected.


To complete importing the application click the Next button and continue follow the instructions after the Setup OpenShift Application screen that are available in the Creating an OpenShift Application chapter: Figure 2.6, “Cloning settings”.

Open the pom.xml file of your web application in the editor by double-clicking on the file in your Project Explorer and selecting the pom.xml tab in your workbench.

Create profiles tags within the project tags of the pom.xml file. Within the profiles tags, press Ctrl and Spacebar together to trigger auto-completion.

From the auto-completion menu, select OpenShift profile. The profile information to connect to OpenShift will be inserted.


Port forwarding is available for each OpenShift application. To access port forwarding for an application right-click on an application in the OpenShift Explorer view tab and select Port forwarding from the context menu.


The Application port forward dialog will display ports that can be forwarded. To forward all ports click the Start All and the Stop All button will stop port forwarding for all listed ports.

If you do not wish to use the remote port numbers selected by default, click the checkbox beside the Find free ports for all Services option.

The default local address is set to 127.0.0.1 and if the remote port is not available a random one will be generated. If your operating system supports it, you can uncheck Use 127.0.0.1 as the local address for all services and the local address will become the same as the remote address.


This chapter covers useful tools for debugging OpenShift servers and applications.

This chapter explains how to remove applications and domains from OpenShift.