Red Hat Training

A Red Hat training course is available for Red Hat Fuse

Chapter 28. Managing servers

The Servers view lets you run and manage servers in your Red Hat CodeReady Studio environment.

Note

For step by step instructions on how to publish a Camel project to Red Hat Fuse, see Chapter 29, Publishing Fuse Integration Projects to a Server.

28.1. Adding a Server

Overview

For the tooling to manage a server, you need to add the server to the Servers list. Once added, the server appears in the Servers view, where you can connect to it and publish your Fuse Integration projects.

Note

If adding a Red Hat Fuse server, it is recommended that you edit its installDir/etc/users.properties file and add user information, in the form of user=password,role, to enable the tooling to establish an SSH connection to the server.

Procedure

There are three ways to add a new server to the Servers view:

  • In the Servers view, click No servers are available. Click this link to create a new server…​.

    Note

    This link appears in the Servers view only when no server has been defined. If you defined and added a server when you first created your project, the Servers view displays that server.

  • In the Servers view, right-click to open the context menu and select NewServer.
  • On the menu bar, select FileNewOtherServerServer.

In the Define a New Server dialog, to add a new server:

  1. Expand the Red Hat JBoss Middleware node to expose the list of available server options:

    UGDefNewServer
  2. Click the server that you want to add.
  3. In the Server’s host name field, accept the default (localhost).

    Note

    The address of localhost is 0.0.0.0.

  4. In the Server name field, accept the default, or enter a different name for the runtime server.
  5. For Server runtime environment, accept the default or click Add to open the server’s runtime definition page:

    tutFuseRuntimeDef1
    Note

    If the server is not already installed on your machine, you can install it now by clicking Download and install runtime…​ and following the site’s download instructions. Depending on the site, you might be required to provide valid credentials before you can continue the download process.

  6. Accept the default for the installation Name.
  7. In the Home Directory field, enter the path where the server runtime is installed, or click Browse to find and select it.
  8. Next to Execution Environment, select the runtime JRE from the drop-down menu.

    If the version you want does not appear in the list, click Environments and select the version from the list that appears. The JRE version you select must be installed on your machine.

    Note

    See Red Hat Fuse Supported Configurations for the required Java version.

  9. Leave the Alternate JRE option as is.
  10. Click Next to save the server’s runtime definition and open its Configuration details page:

    UGJBFserverConfigDetails
  11. Accept the default for SSH Port (8101).

    The runtime uses the SSH port to connect to the server’s Karaf shell. If this default is incorrect for your setup, you can discover the correct port number by looking in the server’s installDir/etc/org.apache.karaf.shell.cfg file.

  12. In the User Name field, enter the name used to log into the server.

    For Red Hat Fuse, this is a user name stored in the Red Hat Fuse installDir/etc/users.properties file.

    Note

    If the default user has been activated (uncommented) in the /etc/users.properties file, the tooling autofills the User Name and Password fields with the default user’s name and password, as shown in [servCnfigDetails].

    If a user has not been set up, you can either add one to that file by using the format user=password,role (for example, joe=secret,Administrator), or you can set one using the karaf jaas command set:

    • jaas:realms — to list the realms
    • jaas:manage --index 1 — to edit the first (server) realm
    • jaas:useradd <username> <password> — to add a user and associated password
    • jaas:roleadd <username> Administrator — to specify the new user’s role
    • jaas:update — to update the realm with the new user information

    If a jaas realm has already been selected for the server, you can discover the user name by issuing the command JBossFuse:karaf@root>jaas:users.

  13. In the Password field, enter the password required for User Name to log into the server.
  14. Click Finish to save the server’s configuration details.

    The server runtime appears in the Servers view.

    Expanding the server node exposes the server’s JMX node:

    UGnewServrInstalledExpand

28.2. Starting a Server

Overview

When you start a configured server, the tooling opens the server’s remote management console in the Terminal view. This allows you to easily manage the container while testing your application.

Procedure

To start a server:

  1. In the Servers view, select the server you want to start.
  2. Click run button .

    • The Console view opens and displays a message asking you to wait while the container is starting, for example:

      UGservrStartConsoleV
      Note

      If you did not properly configure the user name and password for opening the remote console, a dialog opens asking you to enter the proper credentials. See Section 28.1, “Adding a Server”.

    • After the container has started up, the Terminal view opens to display the container’s management console.
    • The running server appears in the Servers view:

      UGservrStartServrsView
    • The running server also appears in the JMX Navigator view under Server Connections:

      UGservStartJMXNavView
      Note

      If the server is running on the same machine as the tooling, the server also has an entry under Local Processes.

28.3. Connecting to a Running Server

Overview

After you start a configured server, it appears in the Servers view and in the JMX Navigator view under the Server Connections node. You may need to expand the Server Connections node to see the server.

To publish and test your Fuse project application on the running server, you must first connect to it. You can connect to a running server either in the Servers view or in the JMX Navigator view.

Note

The Servers view and the JMX Navigator view are synchronized with regards to server connections. That is, connecting to a server in the Servers view also connects it in the JMX Navigator view, and vice versa.

Connecting to a running server in the Servers view

  1. In the Servers view, expand the server runtime to expose its JMX[Disconnected] node.
  2. Double-click the JMX[Disconnected] node:

    UGservrStartServrsView

Connecting to a running server in the JMX Navigator view

  1. In the JMX Navigator view, under the Server Connections node, select the server to which you want to connect.
  2. Double-click the selected server:

    UGservConnectJMXNav

Viewing bundles installed on the connected server

  1. In either the Servers view or the JMX Navigator view, expand the server runtime tree to expose the Bundles node, and select it.
  2. The tooling populates the Properties view with a list of bundles that are installed on the server:

    UGservBundles

    Using the Properties view’s Search tool, you can search for bundles by their Symbolic Name or by their Identifier, if you know it. As you type the symbolic name or the identifier, the list updates, showing only the bundles that match the current search string.

    Note

    Alternatively, you can issue the osgi:list command in the Terminal view to see a generated list of bundles installed on the Red Hat Fuse server runtime. The tooling uses a different naming scheme for OSGi bundles displayed by the osgi:list command.

    In the <build> section of project’s pom.xml file, you can find the bundle’s symbolic name and its bundle name (OSGi) listed in the maven-bundle-plugin entry. For more details, see the section called “Verifying the project was published to the server”.

28.4. Disconnecting from a Server

Overview

When you are done testing your application, you can disconnect from the server without stopping it.

Note

The Servers view and the JMX Navigator view are synchronized with regards to server connections. That is, disconnecting from a server in the Servers view also disconnects it in the JMX Navigator view, and vice versa.

Disconnecting from a server in the Servers view

  1. In the Servers view, expand the server runtime to expose its JMX[Connected] node.
  2. Right-click the JMX[Connected] node to open the context menu, and then select Disconnect.

    UDserversDisconnect

Disconnecting from a server in the JMX Navigator view

  1. In the JMX Navigator view, under Server Connections, select the server from which you want to disconnect.
  2. Right-click the selected server to open the context menu, and then select Disconnect.

    UGservDisconnectJMXN

28.5. Stopping a Server

Overview

You can shut down a server in the Servers view or in the server’s remote console in the Terminal view.

Using the Servers view

To stop a server:

  1. In the Servers view, select the server you want to stop.
  2. Click stop button .

Using the remote console

To stop a server:

  1. Open the Terminal view that is hosting the server’s remote console.
  2. Press: CTRL+D

28.6. Deleting a Server

Overview

When you are finished with a configured server, or if you misconfigure a server, you can delete it and its configuration.

First, delete the server from the Servers view or from the JMX Navigator view. Next, delete the server’s configuration.

Deleting a server

  1. In the Servers view, right-click the server you want to delete to open the context menu.
  2. Select Delete.
  3. Click OK.

Deleting the server’s configuration

  1. On the menu bar, select CodeReady StudioPreferencesServer.

    Note

    On Linux and Windows machines, select WindowPreferences.

  2. Expand the Server folder, and then select Runtime Environments to open the Server Runtime Environments page.
  3. From the list, select the runtime environment of the server that you previously deleted from the Servers view, and then click Remove.
  4. Click OK.