2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ABAP Cloud Developer Trial 2022でCloud Connectorを設定

Last updated at Posted at 2024-06-27

はじめに

ABAP Cloud Developer Trial 2022は、今年の4月に登場したトライアル用のABAP開発環境で、Docker Hubで提供されています。"Cloud"とつくのは、このバージョンから言語バージョン"ABAP for Cloud Development"を選択できるためです。すなわち、開発者拡張の検証もできます!

インストール手順は上記Docker Hubのドキュメントのほか、以下の記事がわかりやすいです。(以下の記事は1909ですが、手順は基本的に同じです)

過去にNW AS ABAP Developer Editionで環境構築したときと比べ、手順が簡単になっていることに驚きました。

本記事の目的

ABAP Cloud Developer Trialには、Cloud Connectorがデフォルトで含まれています。この記事では、Cloud Connectorを設定してABAP環境とBTP環境を接続する手順について説明します。

環境の構成

私の場合、ABAP Cloud Developer TrialはEC2インスタンスの中で実行しており、GUIやCloud Connectorにはローカルの環境から接続しています。

ABAPサーバとCloud Connectorは同一のDockerコンテナの中で起動しています。ABAPサーバはポート50000をHTTP用に、50001をHTTPS用に公開しています。Cloud Connectorはポート8443を公開しています。

architecture.drawio (2).png

設定手順

  1. Cloud Connectorの起動
  2. Cloud Connectorにログイン
  3. BTPサブアカウントと接続
  4. ABAP環境と接続
  5. Destinationの登録
  6. BASからの疎通確認

1. Cloud Connectorの起動

a4hのコンテナを起動したあと、ドキュメントの"Cloud Connector"のセクションに従い、Cloud Connectorを起動します。

docker exec -it a4h bash
/usr/local/sbin/rcscc_daemon start

※以下のエラーが出ますが、Cloud Connectorは使える状態です

ERROR: shell command for retrieving PID of process bound to SCC port failed -- com.sap.scc.util.ShellCommand$ExecutionException: Command lsof -i :8443 failed, caused by java.io.IOException: Cannot run lsof - execvpe failed (ENOENT - No such file or directory)
WARNING: cannot determine PID of process using port 8443
Cloud Connector 2.16.2 started on https://vhcala4hci:8443 (master)

2. Cloud Connectorにログイン

以下のURLで接続します。

https://<the container's IP>:8443

hostsでIPにvhcala4hciに割り当てている場合はhttps://vhcala4hci:8443でアクセスできます。
image.png

ユーザ:Administrator、パスワード:manageでログインします。ログイン後、パスワード変更を求められるので変更します。

3. BTPサブアカウントと接続

Connector > Add Subaccountをクリックします。
image.png

接続先のサブアカウントの情報を設定します。
image.png

4. ABAP環境と接続

ABAP環境との接続を追加します。いくつかつまづきがあったので、トラブルシューティングの過程も含めて書きます。

image.png

4.1. 最初の設定

最初の設定では、Internal Hostをlocalhostとしていました。
image.png

接続チェックを行うとNot Reachableとなり、詳細を確認すると Issueer with subject DN CN=*.dummy.nodomain ... is not trusted. Add this issuer to the Cloud Connector backend trust store というメッセージが出ていました。
image.png
image.png

CN=*.dummy.nodomain ...というのはABAPサーバの証明書であり、Tr-cd:STRUSTで、"SSL Server Standard"に設定されているものでした。

証明書のチェックが走るのはプロトコルをHTTPSにしているためで、HTTPにするとこの段階でも接続できます。

4.2. ABAPサーバの証明書をCloud ConnectorのBackend Trust Storeに追加

Tr-cd:STRUSTで、ABAPサーバの証明書をエクスポートします。
image.png

エクスポートした証明書をCloud ConnectorのConfiguration > ON PREMISEのタブからBackend Trust Storeにアップロードします。
image.png

再度接続確認を行ったところ、次は Certificate for doesn't match any of the subject alternative names というメッセージが出ました。
image.png

これは、Internal Hostにlocalhostと設定しているが、ABAPサーバの証明書のSubject、およびSubject (Alt)にはlocalhostが含まれていないため、信用できないということです。
image.png

対応方法として2つを考えました。

  • Internal HostをABAPサーバの証明書のCNと合わせて*.dummy.nodomainとする
  • ABAPサーバの証明書を変更する

まずは一つ目の方法を試してみます。

4.3. Internal HostをABAPサーバの証明書のCNと合わせる

Dockerコンテナ内のhostファイルを確認します。

cat /ect/hosts

image.png

*.dummy.nodomainに関するマッピングは定義されていないので、追加しました。

echo "172.0.0.1 test.dummy.nodomain" >> /etc/hosts

image.png

そのうえで、Internal Hostをtest.dummy.nodomainとすると接続が成功しました。
image.png

4.4. ABAPサーバの証明書を変更する

このままでも問題ないのですが、test.dummy.nodomainというのがしっくりこなかったので、ABAPサーバの証明書側を更新することにしました。

Tr-cd: STRUSTでSSL server Standardを右クリックし、Replaceを選択します。
image.png

Nameにvhcala4hciを設定します。
image.png

このあと、新しい証明書をエクスポートし、Cloud ConnectorのBackend Trust Storeの証明書を置き換えます。
image.png
image.png

そのうえで、Internal Hostをvhcala4hciとすると接続が成功しました。
image.png

4.5. 許可するパスの追加

ODataサービスに接続できるよう、許可するパスに/sap/opu/odata/を追加しました。
image.png

5. Destinationの登録

BTPサブアカウントに以下のDestinationを追加します。
image.png

6. BASからの疎通確認

最後にSAP Business Application Studio (BAS)から疎通を確認します。テンプレートからUI5アプリを作成でODataの接続を確認してもよいのですが、以下のブログに載っているcurlコマンドで確認する方法がより手軽です。

curl -v -i "<destination>.dest/sap/opu/odata/iwfnd/catalogservice;v=2/ServiceCollection?%24top=1"

ステータスコード200が返ってくれば成功です。
image.png

※Destinationの設定を変更した場合は、以下のコマンドでキャッシュのクリアが必要です。

curl localhost:8887/reload

おわりに

以前Cloud Connectorの設定をしたときは、証明書のエラーは出なかったのですが、記事を見返すとこのときはHTTP接続を使っていました。実際ABAPサーバとCloud Connectorは同一コンテナ内で十分セキュアなので、HTTPでもよかったのかもしれません。それでも、HTTPS接続のときに必要な設定を知れたのは収穫でした。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?