Warning message

Log in to add comments or rate this document.

Using Container Development Kit 2.1 Tooling in JBoss Developer Studio 10.0

Updated 2017-03-16T10:40:15+00:00

NOTE: This article details steps for Red Hat JBoss Developer Studio 10.0 and Container Development Kit 2.1. However, some of the steps may have changed for newer versions of the products. For the latest version of the document, see Using Container Development Kit 2.x Tooling in JBoss Developer Studio 10.x.

Red Hat Container Development Kit (CDK) is a pre-built container development environment based on Red Hat Enterprise Linux to help you get started developing container-based applications quickly.

Set up Red Hat Container Development Kit with JBoss Developer Studio as follows:

  1. Installation and configuration in one of two ways:

    a. Automatically install and configure the Red Hat Container Development Kit and Red Hat JBoss Developer Studio using the Red Hat JBoss Developer Studio Platform Installer.

    b. Manually download, install, and configure the Red Hat Container Development Kit and Red Hat JBoss Developer Studio.

  2. Use the installed components for Container-Based Development.

Automatic Installation and Configuration

Use the Red Hat Development Suite Installer to install Container Development Kit, JBoss Developer Studio, and other relevant components. The Installer automatically configures these components for use together. This option is currently in Technical Preview and only available for Windows.

For instructions about using the Red Hat Development Suite Installer, see https://access.redhat.com/articles/2360571

After using the Red Hat Development Suite Installer to install Red Hat Container Development Kit and Red Hat JBoss Developer Studio, manually run the Container Development Environment tooling, which also creates an OpenShift connection. Refer to the Troubleshooting(link here) section for the workaround to a potential issue when starting the Container Development Kit tooling.

Manual Installation and Configuration

Manually download and install Red Hat Container Development Kit and Red Hat JBoss Developer Studio separately. This option requires some additional configuration steps before the two can be used together.

Prerequisites

Ensure that the following are installed on your system:

  • A virtualization system such as VirtualBox, VMWare, or Linux KVM/libvirt.
  • Vagrant, which is an open-source tool to create and distribute portable development environments.
  • Red Hat Container Development Kit 2.1
  • Red Hat JBoss Developer Studio 10

NOTE: Ensure that your $VAGRANT_HOME environment variable points to the default location (~/.vagrant.d). If required, manually set this environment varable from the CDK Launch Configuration -> Environment option.

For details about installing these prerequisites, see the Red Hat Container Development Kit Installation Guide

Known Issues

  • When the Docker Explorer is first started, attempting to extend the Containers or Images causes the explorer to fail and throw an exception. To work around this issue, restart Eclipse/JBoss Developer Studio. Details are in JBIDE-21983

Set Up the Container Development Kit in JBoss Developer Studio

  1. Run JBoss Developer Studio.

  2. Press the Ctrl and 3 keys and in the Quick Access bar, start typing Container Development Environment.

  3. From the results, click Launch Container Development Environment.

  4. In the New Server dialog box:

    a. Ensure that the Show downloadable server adapters option is selected.

    b. Add the desired Server host name in the relevant field.

    c. Add the desired Server Name in the relevant field.

    d. Click Next to continue.

  5. Add the security information and users must add their access.redhat.com credentials:

    a. Click Add to add a new username for the Red Hat Customer Portal or select an existing user from the drop-down menu.

    b. In the Folder field, navigate to the directory that contains your local Vagrantfile file. If Vagrantfile does not exist on your system, use the Vagrantfiles supplied in the cdk.zip file to initialize the CDK box.

    d. Click Finish to conclude setting up the CDK Server Adapter.

  6. Run the Container Development Environment server.

  7. Add the OpenShift server.

  8. Test the OpenShift Console at https://10.1.2.2:8443 with the username openshift-dev and password devel.

  9. You can now choose to continue working with OpenShift within JBoss Developer Studio or view instructions for Container-Based Development with JBoss Developer Studio.

Docker Tooling

After starting the Container Development Environment server in JBoss Developer Studio, you can follow one of two container development workflows:

Using the Docker Tooling

Use Docker for Container-Based Development as follows:

  1. Create a new Dynamic Web Project with your Dockerfile.

    a. Click File > New and select Project.

    b. Type java in the search bar and from the results, select Java Project and click Next to continue.

    c. Add a name for the new project and click Finish.

    d. Click File > New and select File.

    e. Enter the Dockerfile as the name and click Finish.

    f. Edit the Dockerfile as desired and then save (for example, by creating a new Docker image to customize a given version of JBoss/WildFly by adding a datasource definition and its associated driver). The Dockerfile may also package your application as a war file via a Maven command, and copy it into the container in the WildFly deployments directory. See https://docs.docker.com/engine/reference/builder for more information about the Dockerfile instructions.

  2. Do a Docker build using the Container Development Environment

    a. In the Project Explorer, right-click the Dockerfile and select Run As > Docker Image Build.

    b. In the dialog box, for the Connection field, select your Container Development Environment server adapter.

    c. For Repository Name, enter the desired name for the docker image and click OK.

    d. Once the build is done, a new image with the given name will be listed in the Docker Explorer view and in the Docker Images view.

  3. Do a Docker run using the Container Development Environment:

    a. Open the Docker Explorer view using the quick access menu using Ctrl+3.

    b. Navigate to the Images node under the Docker connection.

    c. Right-click your image and click Run.

    d. Fill in the necessary details and click Finish to run your image. It is optional to give the container a name, but it is recommended to name it. This name helps locate the specific container in a list of containers in the future.

  4. In the Docker Explorer view, select the container and expand its node and select the 8080 port and click on Show In>Web browser to access the application deployed in the Docker container.

Next Steps for the Docker Tooling

For further information about the basics of Docker Tooling, see https://access.redhat.com/articles/1488373

Using OpenShift Tooling

Use OpenShift for Container-Based Development as follows:

  1. Create a new OpenShift project. OpenShift projects are like namespaces for OpenShift applications, which is different from how Eclipse projects relate to Eclipse applications. Additionally, Eclipse projects can be mapped to OpenShift applications.

    a. If the installation was manual, you need to create an OpenShift 3 connection. In the OpenShift Explorer tab, click New Connection Wizard to create a new OpenShift 3 connection. If the Red Hat Development Suite Installer is used, this connection is automatically created when the Container Development Environment Tooling is run.

    b. Add details for your connections, such as Connection name, Server type, Server URL and Authentication information.

    c. Click Finish to create the connection.

    d. The OpenShift Explorer tab now displays your new connection. Right-click the name of the connection and select New > Project to create a new OpenShift project.

    e. Add the name and any other relevant details for your new OpenShift project and click Finish.

  2. Create an application in your OpenShift project using the OpenShift templates.

    a. Right-click your new project’s name and click New > Application.

    b. In the Select Template dialog box, type the application type required. For example, for a node.js application, type nodejs and from the displayed list, select nodejs-example and click Finish.

    c. Click OK to accept the results of the application creation process.

    d. When prompted, enter a new git location or click Finish in the dialog box to use the listed default git location for your application.

  3. Create a new OpenShift server adapter for your project and application.

    a. In the OpenShift Explorer view, right-click the appropriate service under the relevant OpenShift Project.

    b. In the displayed context menu, select Server Adapter. This displays a New Server wizard which has the adapter type and connection already selected.

    c. Edit any of the settings as required, and then click Finish.

  4. Debug the application, if required.

    a. In the Server view, from the context of a server adapter, select Restart in Debug to debug the application.

Next Steps for the OpenShift Tooling

See the Developing for the Cloud with OpenShift 3 section in https://access.redhat.com/documentation/en/red-hat-jboss-developer-studio/ to view instructions for additional tasks using the OpenShift 3 tooling in JBoss Developer Studio.

Known Issues

  • When the Docker Explorer is first started, attempting to extend the Containers or Images causes the explorer to fail and throw an exception. To work around this issue, restart Eclipse/JBoss Developer Studio. Details are in JBIDE-21983

  • When the Container Development Environment is first started, you can use the OpenShift Explorer as expected with the automatically created connection. However, if the Container Development Environment is stopped and started again, the OpenShift connection requests the OpenShift password because it did not save this information when the connection was created. The default password for this is devel and when asked, you can choose to save the password for future use. For details about this issue, see JBIDE-22186

  • When starting the Container Development Environment, if the CDE is unable to start, an error message (see screenshot) may appear behind the Development Suite window and therefore not be visible. If the CDE starting process appears to not conclude, look for the error message behind the IDE window.

CDK Start Error

Troubleshooting

  • When searching for CDK in the Quick Access bar, the results do not include Launch CDK Server, so I cannot launch the installation.

    You need to search for CDE (or cde) -- which stands for Container Development Environment.

  • After installation, starting Container Development Kit using one of the custom Vagrantfiles (See the Set Up the Container Development Kit in JBoss Developer Studio section above) with shared folders set up (components/rhel/misc/shared_folder/rhel-ose/Vagrantfile or components/rhel/misc/shared_folder/rhel-k8s-singlenode-setup) results in the server adapter displaying the starting message but never successfully starting the Container Development Environment tooling. For details about this issue, see JBIDE-22604. The workaround for this issue is:

    1. Start Red Hat Container Development Kit with sshfs setup from the CLI:
      $ cd components/rhel/misc/rhel-ose
      or
      $ cd components/rhel/misc/shared_folder/rhel-k8s-singlenode-setup/

    2. Start Vagrant:
      $ vagrant up

    3. Set up the Container Development Environment tooling in JBoss Developer Studio and start it. Once this step is complete, the Container Development Environment tooling runs as expected.