LoginSignup
1
0

More than 1 year has passed since last update.

Wazi: OpenShift上でのメインフレーム開発環境構築 - (9)Wazi Developer for Workspacesの作成

Last updated at Posted at 2021-04-17

はじめに

IBM Wazi Developer for Red Hat CodeReady Workspaces という製品には、z/OSのエミュレーター部分である"Sandbox"と、"Code"と呼ばれる開発ツール部分があります。先の記事ではPC上のVSCodeやEclipseからSandboxに接続する例を示しましたが、もう一つの形態として、"Code"として提供されている機能で "Wazi Developer Workspaces"を使用することができます。
当記事では、Wazi Developer for Workspacesの利用について記載します。

関連記事

Wazi: OpenShift上でのメインフレーム開発環境構築 - (1)事前準備
Wazi: OpenShift上でのメインフレーム開発環境構築 - (2)ライセンス・サーバーの構成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (3)イメージ・ストレージ・サーバーの構成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (4)OpenShiftクラスターの構成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (5)Sandboxインスタンスの作成
Wazi: OpenShift上でのメインフレーム開発環境構築 - (6)Sandboxインスタンスの確認
Wazi: OpenShift上でのメインフレーム開発環境構築 - (7)Sandboxインスタンスへの接続
Wazi: OpenShift上でのメインフレーム開発環境構築 - (8)Sandboxのカスタマイズ
Wazi: OpenShift上でのメインフレーム開発環境構築 - (9)Wazi Developer for Workspacesの作成

全体像

image.png

Red Hat OpenShiftでは、クラウド・ネイティブのアプリケーション開発環境として、CodeReady Workspacesというものを提供しています。
参考:
Red Hat、業界初のKubernetesネイティブな統合開発環境 「Red Hat CodeReady Workspaces」を発表
Red Hat CodeReady Workspaces 2.0 で 開発環境をコードとして管理する

Wazi Developer for Workspacesというのは、このRed Hat CodeReady Workspacesを拡張しz/OSアプリケーション開発環境を追加したもの、と捉えるのがよいでしょう。
これは開発環境をコンテナとして稼働させ複数のユーザーで共有して使用できる仕組みを提供しています。各アプリケーション開発者は各自のPC上に個別にVSCodeやEclipseなどのクライアント・ツールを導入/セットアップする必要は無く、OpenShift上で稼働するWazi Developer for WorkspacesにブラウザからアクセスできればOKです。この開発環境ではブラウザ上からVSCodeライクな操作が可能なUIを提供してくれます。

環境構築

ほぼデフォルトの設定で構成します。

事前準備

管理用のPCから、oc, cloudctlコマンドが実行できるようにしておきます。これは事前にVirtualBox上のLinuxにセットアップ済なのでここでは同じ環境を使用します。
参考: 環境準備 - PC側

CASEのインストール

oc, cloudctlコマンドをセットアップしたLinux上にCASE bundleをダウンロードします。
https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-wazi-development-client
上のサイトから最新バージョンのディレクトリを選択します(執筆時点の最新は1.1.2)
https://github.com/IBM/cloud-pak/tree/master/repo/case/ibm-wazi-development-client/1.1.2
ここに含まれる ibm-wazi-development-client-xxx.tgz ファイルをダウンロードします。

[root@Test05 ~/openshift/Wazi/CASE_DevClient]# wget https://github.com/IBM/cloud-pak/raw/master/repo/case/ibm-wazi-development-client/1.1.2/ibm-wazi-development-client-1.1.2.tgz
--2021-02-10 09:51:12--  https://github.com/IBM/cloud-pak/raw/master/repo/case/ibm-wazi-development-client/1.1.2/ibm-wazi-development-client-1.1.2.tgz
github.com (github.com) をDNSに問いあわせています... 13.114.40.48
github.com (github.com)|13.114.40.48|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: https://raw.githubusercontent.com/IBM/cloud-pak/master/repo/case/ibm-wazi-development-client/1.1.2/ibm-wazi-development-client-1.1.2.tgz [続く]
--2021-02-10 09:51:13--  https://raw.githubusercontent.com/IBM/cloud-pak/master/repo/case/ibm-wazi-development-client/1.1.2/ibm-wazi-development-client-1.1.2.tgz
raw.githubusercontent.com (raw.githubusercontent.com) をDNSに問いあわせています... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 3968394 (3.8M) [application/octet-stream]
`ibm-wazi-development-client-1.1.2.tgz' に保存中

100%[===========================================================================================================================================>] 3,968,394   5.10MB/s 時間 0.7s

2021-02-10 09:51:14 (5.10 MB/s) - `ibm-wazi-development-client-1.1.2.tgz' へ保存完了 [3968394/3968394]

[root@Test05 ~/openshift/Wazi/CASE_DevClient]# ls -la
合計 3880
drwxr-xr-x. 2 root root      51  2月 10 09:51 .
drwxr-xr-x. 6 root root    4096  2月 10 09:46 ..
-rw-r--r--. 1 root root 3968394  2月 10 09:51 ibm-wazi-development-client-1.1.2.tgz

ダウンロードしたtgzファイルを解凍します。

解凍結果
[root@Test05 ~/openshift/Wazi/CASE_DevClient]# tar -zxvf ibm-wazi-development-client-1.1.2.tgz
ibm-wazi-development-client/
ibm-wazi-development-client/LICENSE
ibm-wazi-development-client/README.md
ibm-wazi-development-client/case.yaml
ibm-wazi-development-client/certifications/
ibm-wazi-development-client/certifications/ibmmc.yaml
ibm-wazi-development-client/digests.yaml
ibm-wazi-development-client/inventory/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/README.md
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/actions.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/files/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/files/deploy/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/files/deploy/catalog_source.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/files/deploy/install.sh
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/inventory.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetup/resources.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/README.md
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/actions.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/files/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/files/deploy/
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/files/deploy/catalog_source.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/files/deploy/install.bat
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/files/deploy/licenses.bat
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/inventory.yaml
ibm-wazi-development-client/inventory/waziDeveloperWorkspacesSetupWindows/resources.yaml
ibm-wazi-development-client/licenses/
ibm-wazi-development-client/licenses/IBM Z Distribution for Zowe_Notices.txt.zip
ibm-wazi-development-client/licenses/LICENSE
ibm-wazi-development-client/licenses/NOTICES
ibm-wazi-development-client/licenses/non_ibm_license
ibm-wazi-development-client/licenses/non_ibm_license.txt
ibm-wazi-development-client/prereqs.yaml
ibm-wazi-development-client/roles.yaml
ibm-wazi-development-client/signature.yaml

[root@Test05 ~/openshift/Wazi/CASE_DevClient]# tree --charset=C .
.
|-- ibm-wazi-development-client
|   |-- LICENSE
|   |-- README.md
|   |-- case.yaml
|   |-- certifications
|   |   `-- ibmmc.yaml
|   |-- digests.yaml
|   |-- inventory
|   |   |-- waziDeveloperWorkspacesSetup
|   |   |   |-- README.md
|   |   |   |-- actions.yaml
|   |   |   |-- files
|   |   |   |   `-- deploy
|   |   |   |       |-- catalog_source.yaml
|   |   |   |       `-- install.sh
|   |   |   |-- inventory.yaml
|   |   |   `-- resources.yaml
|   |   `-- waziDeveloperWorkspacesSetupWindows
|   |       |-- README.md
|   |       |-- actions.yaml
|   |       |-- files
|   |       |   `-- deploy
|   |       |       |-- catalog_source.yaml
|   |       |       |-- install.bat
|   |       |       `-- licenses.bat
|   |       |-- inventory.yaml
|   |       `-- resources.yaml
|   |-- licenses
|   |   |-- IBM\ Z\ Distribution\ for\ Zowe_Notices.txt.zip
|   |   |-- LICENSE
|   |   |-- NOTICES
|   |   |-- non_ibm_license
|   |   `-- non_ibm_license.txt
|   |-- prereqs.yaml
|   |-- roles.yaml
|   `-- signature.yaml
`-- ibm-wazi-development-client-1.1.2.tgz

10 directories, 27 files

oc loginでOpenShiftクラスターにログインします。

[root@Test05 ~/openshift/Wazi/CASE_DevClient]# sh oc_login_wazi.sh
Login successful.

You have access to 67 projects, the list has been suppressed. You can list all projects with ' projects'

Using project "wazi-test01".

CASE bundleをインストールします。途中ライセンスの同意処理が求められるのでライセンスを確認してYESを入力する必要があります。

[root@Test05 ~/openshift/Wazi/CASE_DevClient]# cloudctl case launch --case ibm-wazi-development-client --inventory waziDeveloperWorkspacesSetup
Welcome to the CASE launcher
Attempting to retrieve and extract the CASE from the specified location
[?] CASE has been retrieved and extracted
Attempting to validate the CASE
[?] CASE has been successfully validated
Attempting to locate the launch inventory item, script, and action in the specified CASE
[?] Found the specified launch inventory item, action, and script for the CASE
Attempting to check the cluster and machine for required prerequisites for launching the item
Checking for required prereqs...
No requires section specified.
Required prereqs result: OK
Checking user permissions...

Kubernetes RBAC Prerequisite                    Verbs       Result  Reason
extensions.ingresses/                           *           true
route.openshift.io.routes/                      *           true
rbac.authorization.k8s.io.roles/                *           true
rbac.authorization.k8s.io.rolebindings/         *           true
rbac.authorization.k8s.io.clusterroles/         *           true
rbac.authorization.k8s.io.clusterrolebindings/  *           true
pods/                                           *           true
services/                                       *           true
serviceaccounts/                                *           true
endpoints/                                      *           true
persistentvolumeclaims/                         *           true
events/                                         *           true
configmaps/                                     *           true
secrets/                                        *           true
pods/exec/                                      *           true
pods/log/                                       *           true
namespaces/                                     get         true
apps.deployments/                               *           true
monitoring.coreos.com.servicemonitors/          get,create  true
org.eclipse.che.*/                              *           true

User permissions result: OK
[?] Cluster and Client Prerequisites have been met for the CASE
Running the CASE waziDeveloperWorkspacesSetup launch script with the following action context: install

=========================================================================
Non-IBM License
=========================================================================
TERMS AND CONDITIONS FOR SEPARATELY LICENSED CODE

IBM Wazi Developer for Workspaces V1.1
IBM Z Open Editor V1.1
IBM Z Open Debug V1.1
IBM RSE API Plug-in for Zowe CLI V1.1
IBM Z Distribution for Zowe (Zowe Explorer)
IBM Z Distribution for Zowe (Zowe CLI)

The IBM license agreement and any applicable information on the web
download page for IBM products refers Licensee to this file for details
concerning terms and conditions applicable to code identified as
Separately Licensed Code below and included in the products listed
above ("the Program").

...省略...

=========================================================================
Please accept all licenses before continuing. Type Yes or No
=========================================================================
Yes
License accepted. Proceeding with the install...
catalogsource.operators.coreos.com/wazi-codeready-operator-catalog created
[?] CASE launch script completed successfully
OK

OpenShift Consoleにて、Administration - Custom Resource Definitions からCatalogSourceを選択しInstancesタブを開くと、wazi-codeready-operator-catalogが追加されていることが確認できます。
image.png

また、OperatorHubからwaziで検索するとIBM Wazi Developer for Workspacesが表示されることが確認できます。
image.png

Operatorインストール

まずOpenShiftクラスター上にプロジェクトを作成します(ここでは"wazi-developer01"とします)。

[root@Test05 ~/openshift/Wazi]# oc new-project wazi-developer01
Now using project "wazi-developer01" on server "https://xxx.containers.cloud.ibm.com:xxx".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app rails-postgresql-example

to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=k8s.gcr.io/serve_hostname

OpenShiftクラスターコンソールのOperatorHubから上で作成したプロジェクトにOperatorをインストールします。

OperatorHubから IBM Wazi Developer for Workspacesを選択。
image.png

Installをクリック
image.png

Installed Namespaceから上で作成したProject(Namespace)名を選択し、Installをクリック。
image.png

Installed Operatorsに"IBM Wazi Developer for Workspaces"が表示されればOKです。
image.png

インスタンス作成

Installed Operatorsから、IBM Wazi Developer for Workspacesを選択し、Create Instanceをクリック
image.png

Create CheClusterという画面が開きます。
image.png

一番下までスクロールして、Storageというセクションの所だけ以下のように明示的に設定し、Createをクリック。
image.png

  • postgresPVCStorageClassName: 内部的にpostgreSQLが使われ、postgreSQL用の永続ボリューム作成時に使用されるStorage Classを指定。
  • pvcStrategy: PVCを作成する単位を指定します。"common"を指定することでインスタンス全体で1つのPVCが作成されることになります。(デフォルトの"per-workspace"だとworkspace単位でPVCが作成される)
  • workspacePVCStorageClassName: workspace用の永続ボリューム作成時に使用されるStorage Classを指定
  • pvcClaimSize: workspace用永続ボリュームのサイズを指定

※ここでは、検証環境でコストを抑えるため、Storage Classとしてibmc-block-bronzeを指定しています。
参考:
クラシック IBM Cloud Block Storage へのデータの保管
IBM Cloud Block Storage: Pricing

Installed OperatorsからIBM Wazi Developer for Workspacesを選択し、IBM Wazi Developer for Workspacesタブを選択すると、インスタンスが作成されていることが確認できます。
image.png

RH-SSO(Red Hat Single Sign on)のカスタマイズ

RH-SSOというのは、KeycloakというOSSをベースにしたアイデンティティ/アクセス管理機能を提供するものです。デフォルトの構成ではこのRH-SSOによってWazi Developer for Workspaceのユーザー管理が行われることになるので、RH-SSO用のサーバーもPodとして稼働することになります(また、データ保持用にPostgreSQLも使用されるのでPostgreSQL用のPodも稼働します)。
このRH-SSOは、デフォルトでユーザーの登録機能(Registration)が有効になっているので、URLにアクセスできれば自由にユーザー登録して利用できるようになってしまっています。オープンな環境の場合はそれだとまずいので、ログインページからユーザー登録できる機能を無効化しておきます。

まず、RH-SSO(Keycloak)の管理ユーザー/パスワードを確認します。
OpenShiftコンソールのSecretから、プロジェクトwazi-developer01配下のche-identity-secretのuser,passwordの値を確認します。
image.png

Operators - Installed OperatorsからIBM Wazi Developer for WorkspacesのインスタンスのDetailsを確認します。IBM Wazi Developer for Workspaces SSO Admin Console URL以下がRH-SSOの管理コンソールへのリンクです。
image.png

上のリンクにアクセスし、Administration Consoleを選択します。
image.png

先に確認した管理ユーザー/パスワードでログインします。
image.png

Realm SettingのLoginタブで、User RegistrationをON=>OFFに変更にSaveします。
image.png

これでUser Registration機能が無効化されました。

Wazi Developer for Workspaces使用例

アクセス先URLの確認

OpenShiftのコンソールから、Operators - Installed Operatorsを選択し、IBM Wazi Developer for WorkspacesをインストールしたProjectを選択し、"IBM Wazi Developer for Workspaces"を選択します。
image.png

"IBM Wazi Developer for Workspaces"タブから、wazi-codeready-workspacesを選択します。
image.png

IBM Wazi Developer Workspaces URLで示されているリンクが、開発環境へのアクセスのためのURLです。
image.png

以降の操作は全てブラウザから実施することになります。

ログイン

上のURLにアクセスすると、以下のようにログイン画面になります。
image.png

管理者に依頼して事前にユーザー登録をしておく必要があります。
(RH-SSOの管理コンソールからユーザー登録)
※User Registrationを無効化していないデフォルトの状態の場合は、この画面にRegistrationのリンクが表示されユーザー登録することができます。

Workspaces作成

参考: Creating a workspace using Wazi Developer for Workspaces

Getting Startedのメニューから、Wazi Developerを選択します。
image.png

しばらくすると自分用のWorkspaceが作成されて、以下のような画面が表示されます。
image.png

基本設定

Temp Folderの設定

参考: Configuring your workspace

File - Settings - Open Preferences でzowe-tempを検索
image.png

ガイドに従ってZowe-Temp-Folder-Locationを設定
image.png

Sandboxへの接続プロファイル作成

次に、Sandboxとの接続用にZowe CLIのProfile(z/OSMF)を作成します。これはローカルのVSCodeで実施した時の操作と基本的に同じです。ただ、同一のOpenShiftクラスター上からのアクセスになるので、接続先はローカルのアドレスでOKです。

右側のキューブ状のアイコン(My Workspace)をクリックし、Wazi以下のNew Terminalを選択します。
image.png

下段にTerminal(bash)が開くので、ここからzowe cliコマンドが実行できます。
image.png

以下の記述に倣って、Sandboxへの接続用のZowe CLIプロファイルを作成すれば、ローカルのVSCodeと同じようにZowe画面からSandboxへのアクセスが可能です。
参考: Zowe CLI接続構成

コマンド例
bash-4.4$ zowe profiles create zosmf-profile prof_Wazi01 --host xxx --port 31917 --user TAGUCHI --password yyy --reject-unauthorized false --encoding 1399

接続先Sandboxのアドレス(xxx部分)は管理者に問い合わせてください。
※SandboxがデフォルトのService(NodePort)の構成であれば、WorkerNodeのローカルのIPアドレス+Serviceで公開されているz/OSMFのポートで接続可能なはず。

Sandboxアクセス

参考: Zowe Explorer Extensionの設定(接続プロファイル追加)

プロファイルができたら、ローカルのVSCodeからの接続と同様にDATASETの横の「+」アイコンから上で作成したプロファイルを追加すれば、Sandbox上のDATASETを扱えるようになります。

image.png

Workspaceの起動停止

Workspaceを作成すると、左側のメニューでWorkspaceの起動/停止が制御できます。使わないときはWorkspaceを停止させておくとOpenShiftの負荷が軽減できます。メニューが閉じている場合は左上の黄色い「>」アイコンで開きます。
image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0