Get your Developer Workspace

10 MINUTE EXERCISE

In this lab you will learn about providing your Developer Workspace with a Kubernetes-native development platform and getting familiar with the OpenShift CLI and OpenShift Web Console.

What is Red Hat OpenShift Dev Spaces?

Red Hat OpenShift DevSpaces

OpenShift Dev Spaces is a Kubernetes-native IDE and developer collaboration platform.

As an open-source project, the core goals of OpenShift Dev Spaces are to:

  • Accelerate project and developer onboarding: As a zero-install development environment that runs in your browser, OpenShift Dev Spaces makes it easy for anyone to join your team and contribute to a project.

  • Remove inconsistency between developer environments: No more: “But it works on my machine.” Your code works exactly the same way in everyone’s environment.

  • Provide built-in security and enterprise readiness: As OpenShift Dev Spaces becomes a viable replacement for VDI solutions, it must be secure and it must support enterprise requirements, such as role-based access control and the ability to remove all source code from developer machines.

To achieve those core goals, OpenShift Dev Spaces provides:

  • Workspaces: Container-based developer workspaces providing all the tools and dependencies needed to code, build, test, run, and debug applications.

  • Browser-based IDEs: Bundled browser-based IDEs with language tooling, debuggers, terminal, source control (SCM) integration, and much more.

  • Extensible platform: Bring your own IDE. Define, configure, and extend the tools that you need for your application by using plug-ins, which are compatible with Visual Studio Code extensions.

  • Enterprise Integration: Multi-user capabilities, including Keycloak for authentication and integration with LDAP or AD.

Getting your Developer Workspace with a single click

OpenShift Dev Spaces will provide you an out-of-the-box Developer Workspace with all the tools and the dependencies we need to do the job. And with only one single click!

Devfile

OpenShift Dev Spaces uses Devfiles to automate the provisioning of a specific workspace by defining:

  • projects to clone

  • browser IDE to use

  • preconfigured commands

  • tools that you need

  • application runtime definition

Providing a %WORKSHOP_GIT_REPO%/blob/%WORKSHOP_GIT_REF%/devfile.yaml[devfile.yaml^] file inside a Git source repository signals to OpenShift Dev Spaces to configure the project and runtime according to this file.

Click on the 'Developer Workspace' button below

Then Click 'Log in with OpenShift'

OpenShift - Login

Then login as user%USER_ID%/%OPENSHIFT_PASSWORD%.

Che - Login

Now there are a couple of steps before we can get started. Firstly you need to Trust the Git source you need to import for this workshop

Che - Workspace

Then you need to accept or select the Visual Studio Code UI Settings. You can just click Mark Done to skip these.

Che - Workspace

Once completed, you will have a fully functional Browser-based IDE within the source code already imported.

Che - Workspace

What is OpenShift Do (odo)?

OpenShift Do (odo)

OpenShift Do (odo) is a CLI tool for creating applications on OpenShift and Kubernetes. With odo, you can write, build, deploy and debug applications on a cluster without the need to administer the cluster itself. Creating deployment configurations, build configurations, service routes and other OpenShift or Kubernetes elements are all automated by odo.

Existing tools such as OpenShift CLI (oc) are operations-focused and require a deep understanding of Kubernetes and OpenShift concepts. odo abstracts away complex Kubernetes and OpenShift concepts allowing developers to focus on what is most important to them: code.

Connect Your Workspace to Your OpenShift User

First, in your Workspace,

  • IDE Task

  • CLI

Click on 'Terminal' → 'Run Task…​' → 'devfile: OpenShift - Login'

Che - RunTask

Execute the following commands in the terminal window

odo login $(oc whoami --show-server) --username=user%USER_ID% --password=%OPENSHIFT_PASSWORD% --insecure-skip-tls-verify
To open a terminal window, click on 'Terminal' → 'New Terminal'

The output should be as follows:

Connecting to the OpenShift cluster

Login successful.

You have access to the following projects and can switch between them with 'odo project set <project-name>':

  *cn-project%USER_ID%
  user%USER_ID% -devspaces

Using project "cn-project%USER_ID%".

Welcome! See 'odo help' to get started.

Then, create your Development Environment:

  • IDE Task

  • CLI

Click on 'Terminal' → 'Run Task…​' → 'devfile: OpenShift - Create Development Project'

Che - RunTask

Execute the following commands in the terminal window

odo project create my-project%USER_ID%
To open a terminal window, click on 'Terminal' → 'New Terminal'

The output should be as follows:

 ✓  Project 'my-project%USER_ID%' is ready for use
 ✓  New project created and now using project: my-project%USER_ID%

Log in to the OpenShift Developer Console

OpenShift ships with a web-based console that will allow users to perform various tasks via a browser.

Click on the 'Developer Console' button below

Enter your username and password (user%USER_ID%/%OPENSHIFT_PASSWORD%) and then log in. After you have authenticated to the web console, you will be presented with a list of projects that your user has permission to work with.

Select the 'Developer View' then your 'my-project%USER_ID%' to be taken to the project overview page which will list all of the routes, services, deployments, and pods that you have running as part of your project. There’s nothing there now, but that’s about to change.

OpenShift - Empty Project

Now you are ready to get started with the labs!