4.5. Deploy and View Application

4.5.1. Deploy to the JBoss EAP Server

Once you have imported the TicketMonster source code into JBoss Developer Studio, the project application can be deployed to the JBoss EAP server and the running application viewed in the default system web browser, as detailed in the procedure below.

Procedure 4.3. Deploy to the JBoss EAP Server

  1. In the Project Explorer view, right-click ticket-monster and click Run AsRun on Server.
  2. Under How do you want to select the server?, ensure Choose an existing server is selected.
  3. In the Server table, expand localhost, select jboss-eap-version where version denotes the JBoss EAP version, and click Next.
    Description

    Figure 4.2. JBoss EAP 6.x Server Selected

  4. Ensure ticket-monster is listed in the Configured column and click Finish. The Console view automatically becomes the view in focus and displays the output from the JBoss EAP server. Once deploying is complete, the web application opens in the default system web browser.
    Description

    Figure 4.3. ticket-monster Listed in the Configured Column

4.5.2. Deploy to OpenShift Online

Once verified that the workspace ticket-monster application runs successfully on JBoss EAP, you can deploy it with confidence to OpenShift Online, Red Hat's cloud service. To deploy ticket-monster to OpenShift Online, you must create a new OpenShift Online application based on the existing workspace project using OpenShift Tools, as detailed in the procedure below.

Note

This procedure documents the deploying process for first-time OpenShift Online users. This includes one-time steps, such as signing up for an OpenShift Online account, creating an OpenShift Online domain and uploading SSH keys. If you have previously used OpenShift Online and OpenShift Tools, omit the one-time steps as appropriate.

Procedure 4.4. Deploy to OpenShift Online

  1. In JBoss Central, under Start from scratch, click OpenShift Application.
  2. If you do not have an OpenShift Online account, click Please sign up here to create an OpenShift Online account and follow the instructions on the OpenShift web page displayed in your default system web browser. Once you have completed the sign-up process, restart the New OpenShift Application wizard.
  3. Complete the fields about your OpenShift Online account as follows:
    • From the Connection list, select New Connection.
    • Ensure the Use default server check box is selected.
    • In the Username and Password fields, type your account credentials.
    Completed Username and Password Fields

    Figure 4.4. Completed Username and Password Fields

  4. Click Next.
  5. If your OpenShift Online account has no SSH public keys stored, you are prompted with the Add SSH Keys wizard. Click New and complete the fields about the SSH Keys to be created as follows:
    • In the Name field, type a name for the SSH key.
    • From the Key Type list, ensure SSH_RSA is selected.
    • In the SSH2 Home field, ensure your .ssh directory path is shown.
    • In the Private Key File Name field, type a name for the private key file name. The Public Key File Name field populates automatically with the name of the private key file name with .pub appended.
    Click Finish and click Finish again to close the Add SSH Keys window.
  6. If your OpenShift Online account has no domains, you are prompted with the Create Domain wizard. In the Domain name field, type a name for your new OpenShift Online domain and click Finish. The provided domain name must be unique across all domains on OpenShift Online; if it is not unique, you are directed back to the Create Domain wizard page to provide a unique domain name.
  7. Complete the fields about the type of OpenShift application you want to create as follows:
    • Ensure Create a new OpenShift application is selected.
    • Expand Basic Cartridges and select JBoss Enterprise Application Platform 6 jbosseap-6.
    Completed Fields about the Type of OpenShift Application

    Figure 4.5. Completed Fields about the Type of OpenShift Application

  8. Click Next.
  9. Complete the fields about your OpenShift Online application as follows:
    • Ensure the Domain field displays the OpenShift Online domain with which you want to host your application.
    • In the Name field, type ticketmonster.
    • From the Gear profile list, select small.
    Completed Fields about the New OpenShift Application

    Figure 4.6. Completed Fields about the New OpenShift Application

  10. Click Next.
  11. Complete the fields about the workspace ticket-monster project as follows:
    • Clear the Create a new project check box.
    • In the Use existing project field, type ticket-monster. Alternatively, click Browse to select the ticket-monster project.
    • Ensure the Create and set up a server adapter for easy publishing check box is selected.
    Completed Fields in the New OpenShift Application Wizard

    Figure 4.7. Completed Fields in the New OpenShift Application Wizard

  12. Click Next.
  13. Click Finish to create the new OpenShift application based on the existing workspace ticket-monster project. This process may take some time to complete.
  14. At the prompt stating OpenShift application ticketmonster will be enabled on project ticket-monster ..., click OK. This configures the workspace ticket-monster project for OpenShift and connects it to the OpenShift Online Git repository system used for version control.
    Import OpenShift Application Prompt

    Figure 4.8. Import OpenShift Application Prompt

  15. At the prompt stating the authenticity of the host cannot be established and asking if you are sure you want to continue connecting, verify the host information is correct and click Yes.
  16. In the Servers view, right-click ticketmonster at OpenShift and click Publish.
  17. At the prompt asking if you want to push committed changes to OpenShift, click Yes. The Console view automatically becomes the view in focus and displays the output from the OpenShift Online server. Once the OpenShift Online ticketmonster application is created and deployed, the Console view displays the following:
    Deployment completed with status: success
    Deployment Completed Message in the Console View

    Figure 4.9. Deployment Completed Message in the Console View

4.5.3. View the OpenShift Application in a Browser

Once deployed, you can view the OpenShift Online ticketmonster application in a web browser. Details are provided here for viewing in your default system web browser and with BrowserSim.
To view the application in your default system web browser, in the OpenShift Explorer view, expand the connection and domain. Right-click ticketmonster and click Show in Web Browser.
Description

Figure 4.10. TicketMonster Application Opened in a Web Browser

To view the application in a BrowserSim simulated device web browser, click the Run BrowserSim icon. Copy and paste the URL from your default system web browser into the simulated device web browser address bar. Notice that the user interface is different in the two web browsers; the TicketMonster example has a different user interface for small views such as mobile devices.
Description

Figure 4.11. Ticket Monster Application Opened in BrowserSim