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 → → .
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 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.
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 to complete domain creation.
If you already have a domain name then you will not see the Domain Creation screen.
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 Gear profile will be available to you.
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
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
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 → → → → . With the Git Repositories option selected, click .
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 .
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
button.On the Setup OpenShift Application screen click the checkbox beside Use existing application and click the 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
button you can see all relevant application information. Click the to return to the application selection screen.Select the application to import and click the
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 Setup OpenShift Application screen that are available in the Creating an OpenShift Application chapter: Figure 2.6, “Cloning settings”.
button and continue follow the instructions after the
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
. 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 from the context menu.
The Application port forward dialog will display ports that can be forwarded. To forward all ports click the and the 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.
Similar to when you are running a server locally, you are also able to see console output for your remote OpenShift server. To have this output displayed to you, right-click on your OpenShift application in the OpenShift view tab, and select .
The dialog that opens allows you to modify the tail options. A default tail command will be present and you can always revert back to it by pressing the
button. Once you have completed setting the tail options you wish, click the button.
A new tab will open called Console and display the last 100 lines of the servers boot.log
and server.log
files. This Console tab will now tail the content of these files on the server, outputing any updates to you, as they occur.
This information can be useful in ensuring processes are executing as expected.
You are able to view the environment variables that an OpenShift application is utilizing and the current content of each variable. To have this output displayed to you right-click on your OpenShift server in the OpenShift view tab, and select .
The output will appear in the Console view tab.
This information can be useful in ensuring an application is receiving the correct environment variable values.
This chapter explains how to remove applications and domains from OpenShift.
Deleting an application will only remove it from the OpenShift server. The application and OpenShift server adapter will remain in your workbench.
To remove an application right-click on it in the OpenShift Explorer view tab and select from the context menu.
A dialog window will display asking you to confirm the action and alerting you that you will not be able to recover the application one it has been deleted. Click the
button to delete the application.Once the application has been deleted you will notice that it has been removed from the list of applications available on your OpenShift server.
To delete a domain right-click on your server connection in the OpenShift Explorer view tab and select from the context menu.
A dialog box will be displayed asking you to confirm domain deletion. As a domain can only be deleted if it has no applications associated with it, an option is available to Force applications deletion. By selecting this checkbox any applications still associated with the domain will be deleted and unrecoverable.
It is recommended that you remove applications individually before deleting a domain to ensure you have created a copy of any application data you wish to keep.
If you do not select the Force applications deletion option and the domain to be removed still has an application associated with it, domain deletion will fail.
Once the domain has been deleted the connection to OpenShift will remain, however the
option will not be available from the context menu.