In this repository we provides the instructions to run an OpenShift Dev Spaces Workshop. It has 3 Admin tasks and 2 user tasks:
- Preparation - Instructions to setup an OpenShift cluster where we will install OpenShift Dev Spaces and to start a Cloud Development Environment that has some scripts to facilitate the deployment and configuration of OpenShift Dev Spaces.
- Dev Spaces Deployment - Steps to deploy the latest version of OpenShift Dev Spaces in the cluster setup before.
- Dev Spaces Configuration - Day 2 tasks for an OpenShift Dev Spaces administrator.
- Customization of a Cloud Development Environment (CDE) - How to customize the tools and the resources and of an OpenShift Dev Spaces CDE.
- Managing CDEs using the DevWorkspace API - How to programattically manage Dev Spaces cloud development environments.
The cluster should run OpenShift 4.10 or later. Make sure that Dev Spaces is not already installed in the cluster (the goal is to install it now). Once you have access to the cluster as an admin, copy the API URL and token:
Select "Copy login command" | Copy OpenShift API URL and token |
---|---|
Follow the instructions on Red Hat Developer Sandbox web page to create an account. This will allow you to start a cloud development environment running this repository.
Click the badge at the top of this page. After a few seconds you should see VS Code running in your browser with the source code of this repository.
CDE Startup | CDE Running VS Code |
---|---|
The cloud development environment that you started runs has all the pre-requisties to run this demo.
From Visual Studio Code running in your browser, open a terminal (Terminal -> New Terminal
) and execute the following commands:
# Login to your OpenShift cluster. When prompted
# provide the API URL and Token retrieved in the
# preparation section
./commands/login.sh
# Install OpenShift Dev Spaces CLI (`dsc`)
./commands/download-cli.sh
# Deploy OpenShift Dev Spaces
./commands/deploy.sh latest
Congratulations, you have just deployed OpenShift Dev Spaces. Follow the "Users Dashboard" link to log in to Dev Spaces.
dsc server:deploy |
Users Dashboard |
---|---|
1. Configure GitHub OAuth flow (or Bitbucket, Gitlab, AzureDevops)
With OAuth, Dev Spaces can automatically configure Cloud Development Environments of the developers with their git credentials. This capability is not enabled by default but has to be configured by an administrator.
The following comand will guide you through the configuration of a GitHub OAuth application for Dev Spaces:
./commands/configure-gh-oauth.sh
2. Patch the CheCluster Custom Resource
The Kubernetes Custom Resource Definition CheCluster
is created by the Dev Spaces operator. Administrators should edit a CheCluster
Custom Resource to configuration Dev Spaces.
The following scripts will patch the CheCluster
custom resource named devspaces
in the openshift-devspaces
namespace.
# Disable inactive cloud development environment idling
./commands/disable-idling.sh
# Change the default development container to be upstream UDI
./commands/change-dev-container.sh quay.io/devfile/universal-developer-image
# Change the default IDE
./commands/change-default-ide.sh
# Use open-vsx.org rather than the embedded open-vsx registry
./commands/use-open-vsx.org.sh
NOTE: A lot more can be configured using the CheCluster custom resource. Try editing the CR with the OpenShift Console editor that has code completion.
3. Enable the Kubernetes Image Puller
The Kuberentes Image Puller operator helps making the startup of Dev Spaces Cloud Development Environments faster. Run the following script to deploy this operator:
./commands/enable-image-puller.sh
Run the following script to configure the Kubernetes Image Puller to pre-pull all the images of a specific OpenShift Dev Spaces workspace (the workspace should be running in the developer namespace):
./commands/configure-image-puller.sh
Link to the documentation article
# Use nightly DevWorkspace operator build
./commands/additionals/patch-dw-subcription.sh
# Sometimes increasing the developer namespace resource
# quotas is required (especially to run IntelliJ)
./commands/additionals/increase-resource-range.sh
OpenShift Dev Spaces is designed to run on restricted networks. The documentation article to install OpenShift Dev Spaces in such a network can be found here.
Install the “Try in web IDE” browser extension for Chrome, Safari or Firefox and use it to open the following Git repository:
https://github.com/l0rd/rails-sample.
This repository will help us to iteratively customize a Cloud Development Environment. Follow the instructions in this blog post.
Cloud development environment can be managed (created, updated and deleted) using the Kubernetes API.
Follow the steps in this Git repository README file.