CodeReady Workspaces provides development teams a faster and more reliable foundation on which to work, and it gives operations centralized control and peace of mind.
This article goes through the steps of deploying CodeReady Workspaces on IBM Z and LinuxONE.
Developing applications can be fun with the use of the many development Integrated Development Environments (IDEs) available, like Microsoft VSCode, Eclipse, Atom, and many others. What if you could provide a standard development environment running on your Red Hat® OpenShift® cluster that would facilitate collaboration on a scalable platform? That is the idea behind CodeReady Workspace (CRW). CRW is a developer tool that makes cloud native development practical. It is a cloud native IDE based on Eclipse Che that enables developers to deliver new applications efficiently and to improve collaboration during the development process. CRW eliminates the "works on my machine" problem with container native-based development and offers an in-browser IDE for rapid cloud applications development.
Before you stop reading this article because you are thinking "I already love my IDE", let us show you what the CRW IDE (running on a Firefox browser) looks like when developing a simple Node.js application.
CRW uses Eclipse Che. CRW offers an in-browser IDE providing a desktop-like coding experience and allowing team members to update code from anywhere. Visual Studio Code and the development environment from CRW look very similar.
How about running CRW on a OpenShift cluster running on an IBM Z/LinuxONE? The process is quite simple as CRW is deployed by OpenShift Operators. Log in to your OpenShift graphical console and on the left menu select the option called Operators -> OperatorHub. In the OperatorHub Search for Red Hat CodeReady Workspaces as shown below.
Once you select Red Hat CodeReady Workspaces you will see the following screen.
CRW by default requires persistent storage allocation. For the purposes of this article, prior to starting this installation we provided a couple of persistent volumes available with at least 1 GB of space. If you need help setting up a default storage class for your OpenShift cluster, see Persistent Storage Part II: Dynamic NFS Provisioning for OpenShift 4.3 on IBM Z and LinuxONE. Click Install to move to the next screen.
The Install process of the operator is very straight forward, and we recommend using the default options as shown by the previous screen capture.
While the operator for CRW is installing, you can check the details of the new operator by clicking on the suggested hyperlink that will take you to the Installed Operators section.
This process shouldn't take long. Now that the CodeReady Workspaces operator is installed, the next step is to configure the CheCluster. We click on Red Hat CodeReady Workspaces, in the list of Installed Operators to proceed to the next part of the deployment.
Once inside the Operator Details section of the CRW operator, we click on the Create CheCluster button. This will present a form with many options to define the characteristics of the CheCluster, as shown in the next screen capture.
For this deployment only a few changes were made. You should always consult the official documentation of the CodeReady Workspaces to understand all of the options available for these types of deployments.
Under the Storage section, we enable Pre Create Sub Paths and configured the PVC to allocate 1 Gi. This configuration will use that previously defined persistent storage. Why is this important? We want the workspaces created by our developers to be stored in a persistent volume so that all the changes and configurations they use for their workspaces are saved, even if they disconnect from their workspaces. Workspaces are containerized. Once you disconnect they are gone and all the data is gone as well, unless you provide a persistent volume to keep that data saved so when a new container is spawned that workspace data is back where the developer left it.
Another option is OpenShift to Auth under Authentication. This configuration option allows CRW users to leverage the already in-place authentication method used by the OpenShift cluster. For example, our OpenShift Cluster offers integration with an LDAP server for authentication. We want to use the same authentication method for CRW.
After completing the changes to the form, we initiate the creation of a CheCluster by clicking the Create button at the bottom of the form. The process may take several minutes. You can check the progress by using the Resources tab, or just keep checking the Details tab. Once the status changes to Available, a CodeReady Workspaces URL will appear. That URL is the Portal for the CodeReady Workspaces. To access it, click on the URL.
The first time you access the CRW portal, you may receive a "Certificate Error" message if your OpenShift cluster is using self-signed certificates. Depending on what browser you are using, there are different steps you will need to take in order to proceed. Click the link provided and follow the instructions for your browser.
The good news is that the CRW portal guides you through this process and you should be able to proceed to the next step easily. Once the certificate process is done, a login screen be presented.
After logging in the Getting Started with CodeReady Workspaces screen will be presented to you. Now, the sky is the limit! You can use any of the sample workspaces available in this menu or you can create your own custom workspace. Why not create your first application using CodeReady Workspaces? Let's go with the very popular choice: NodeJS Express
Select the option NodeJS Express to get the following screen.
Wait until the workspace is created with the sample NodeJS web application.
Using the navigation menu on the right, select the My Workspace option (the icon that looks like a cube). This will open a menu with options to deploy and run the sample application.
Select option number 1 to run the sample application, Hello World.
Open the application in preview mode by selecting the option Open in Preview.
Alternatively you can use the option from the menu on the right called nodejs, that will open a new browser tab to test your new application.
Let's change the application a little bit, instead of Hello World, what about "CodeReady Workspaces on Z rocks!" ? Using the current workspace, we select the app folder from the left menu and select the app.js file. This will open the file in edit mode.
We will edit a section of the code. As the code is changed, it is automatically saved and the application re-deployed.
In order to activate the Preview mode, use the right menu with the option right after the cube icon.
Hooray! Congratulations on using CodeReady Workspaces to deploy your first NodeJS web application with your own custom modifications!
To stop your application, select the option from the right menu Stop the web app.
Now exit that specific workspace. Select the yellow arrow to the top left and select the option Workspaces to open the next screen.
Select the option Stop Workspace from the ACTIONS menu to stop that workspace and save all your work. When you want to access that specific workspace you can always select the start option from ACTIONS menu and resume your work.
This is just the beginning ! Lot's of other cool things can be done with CRW, for example, connecting it to your favorite source code control, such as GitHub, share your code with other developers, test your code locally using CRW then deploy it directly to an OpenShift Cluster.
The material included in this document is in DRAFT form and is provided 'as is' without warranty of any kind. IBM is not responsible for the accuracy or completeness of the material, and may update the document at any time. The final, published document may not include any, or all, of the material included herein. Client assumes all risks associated with Client's use of this document.