Share via


Azure Spring Apps Basic または Standard プランのインスタンスを Enterprise プランに移行する

Note

Azure Spring Apps は、Azure Spring Cloud サービスの新しい名前です。 サービスの名前は新しくなりましたが、スクリーンショット、ビデオ、図などの資産の更新に取り組んでいる間、場所によってはしばらく古い名前が表示されます。

この記事の適用対象: ✔️ Basic または Standard ✔️ Enterprise

この記事では、Basic または Standard プランの既存のアプリケーションを Enterprise プランに移行する方法について説明します。 Basic プランまたは Standard プランから Enterprise プランに移行すると、VMware Tanzu コンポーネントによってオープンソース ソフトウェア (OSS) Spring Cloud コンポーネントが置き換えられ、より多くの機能サポートが提供されます。

この記事では、移行方法の例として Pet Clinic サンプル アプリを使用します。

前提条件

  • Azure サブスクリプション。 サブスクリプションをお持ちでない場合は、開始する前に無料アカウントを作成してください。
  • Azure CLI バージョン 2.45.0 以上。
  • Azure Spring Apps Enterprise プランの拡張機能。 次のコマンドを使用して、以前のバージョンを削除し、最新の Enterprise プランの拡張機能をインストールします。 以前に spring-cloud 拡張機能をインストールした場合は、構成とバージョンの不一致を回避するためにそれをアンインストールします。
    az extension add --upgrade --name spring
    az extension remove --name spring-cloud
    
  • Git.

サービス インスタンスをプロビジョニングする

Azure Spring Apps Enterprise プランでは、VMware Tanzu コンポーネントによって OSS Spring Cloud コンポーネントが置き換えられ、より多くの機能サポートが提供されます。 Tanzu コンポーネントは、必要に応じてオンデマンドで有効にします。 Azure Spring Apps サービス インスタンスを作成する前に、必要なコンポーネントを有効にする必要があります。

Note

Tanzu コンポーネントを使用するには、Azure Spring Apps サービス インスタンスをプロビジョニングする際に有効にする必要があります。 現在は、プロビジョニング後に有効にすることはできません。

Azure Spring Apps サービス インスタンスをプロビジョニングするには、次の手順を使用します。

  1. Azure Portalを開きます。

  2. 上部の検索ボックスで Azure Spring Apps を検索します。

  3. 結果から Azure Spring Apps を選択し、[作成] を選択します

  4. [Azure Spring Apps の作成] ページで 、インスタンスの サブスクリプションリソース グループ、および 名前 を設定します。

  5. [サービスの詳細でのプラン] で、[変更] を選択します

    Screenshot of the Azure portal Azure Spring Apps creation page with the Change button highlighted in the plan section.

  6. [プランの選択] ページで、テーブルの [エンタープライズ] 行を選択し、[選択] を選択します

    Screenshot of the Azure portal Azure Spring Apps creation page with Basics section and 'Choose your pricing tier' pane showing.

  7. [Azure Spring Apps の作成] ページに戻り、[条件] を選択して、Azure Marketplace の Enterprise プラン オファリングの法的条件とプライバシーに関する声明に同意します。

  8. [次へ: VMware Tanzu の設定] を選択 します

  9. [VMWare Tanzu の設定] タブで、一覧をスクロールして Tanzu コンポーネントを確認します。 既定では、すべてのコンポーネントが有効になっています。

    Screenshot of the Azure portal Azure Spring Apps creation page with V M ware Tanzu Settings section showing.

    Note

    プロビジョニング フェーズ中に使用または有効にする Tanzu コンポーネントを慎重に検討してください。 Azure Spring Apps インスタンスをプロビジョニングした後は、Tanzu コンポーネントを有効または無効にすることはできません。

  10. [アプリケーション インサイト] タブを選択し、[アプリケーション インサイトを有効にする] を選択します。 以下の設定を確認します。

    • [アプリケーションインサイトを有効にする] を選択する必要があります。
    • 既存の Application Insights インスタンスを選択するか、新しい Application Insights インスタンスを作成します。
    • サンプリング レート0 ~ 100 の範囲で入力するか、既定値の 10 を使用します。

    Azure Spring Apps インスタンスをプロビジョニングした後で Application Insights を有効にすることもできます。 アプリケーションインサイトの価格の詳細については、「Azure Monitor ログのコストの計算とオプション」の「アプリケーションインサイト課金」セクションを参照してください。

    Note

    Azure Spring Apps と統合すると、Application Insights の使用に対して料金が発生します。

  11. [確認と作成] を選択し、検証が完了するまで待機し、その後 [作成] を選択してサービス インスタンスのプロビジョニングを開始します。

リソースのプロビジョニングが完了するまでに約 5 分かかります。

アプリを作成して構成する

アプリの作成手順は、Standard プランと同じです。

  1. 次のコマンドを使用して、Azure CLI の既定値を設定します。 プレースホルダーは必ず、独自の値で置き換えてください。

    az config set defaults.group=<resource-group-name>
    az config set defaults.spring=<Azure-Spring-Apps-service-instance-name>
    
  2. 次のコマンドを使用して、PetClinic api-gateway 用の 2 つのコア アプリケーションを作成します customers-service

    az spring app create --name api-gateway --instance-count 1 --memory 2Gi --assign-endpoint
    az spring app create --name customers-service --instance-count 1 --memory 2Gi
    

外部構成用の Application Configuration Service を使用する

分散システムの外部化された構成の場合、管理された Spring Cloud Config Server (OSS) は Basic プランと Standard プランでのみ使用できます。 Enterprise プランでは、Tanzu の Application Configuration Service によってアプリに同様の機能が提供されます。 次の表では、OSS 構成サーバーとアプリケーション構成サービスの使用方法の違いについて説明します。

コンポーネント サポート プラン Enabled アプリへのバインド プロフィール
Spring Cloud Config Server Basic/Standard 常に有効です。 自動バインド アプリのソース コードで構成。
Application Configuration Service for Tanzu Enterprise オンデマンドで有効化。 手動バインド Azure Spring Apps のデプロイで config-file-pattern として提供。

OSS 構成サーバーのクライアント/サーバー モードとは異なり、Application Configuration Service は Kubernetes ネイティブ ConfigMapを使用して構成を管理します。これは、バックエンド Git リポジトリで定義されているプロパティから設定されます。 Application Configuration Service は、適切な構成に一致するようにアプリのソース コードで構成されたアクティブなプロファイルを取得できないため、明示的な構成 config-file-pattern は Azure Spring Apps のデプロイ レベルで指定する必要があります。

Tanzu のアプリケーション構成サービスを構成する

一元化された構成サービスとして Application Configuration Service for Tanzu を使用するには、次の手順に従います。

  1. Azure Spring Apps Enterprise インスタンスで、ナビゲーション ウィンドウで [Application Configuration Service] を選択します。 Tanzu のアプリケーション構成サービスに割り当てられている実行中の状態とリソースを表示します。

    Screenshot of the Azure portal showing the Overview tab of the Application Configuration Service page.

  2. 設定選択し、リポジトリのフォームに入力して、次の情報を含む新しいエントリを追加します。

    • 名前: default
    • パターン: api-gateway,customers-service
    • URI: https://github.com/Azure-Samples/spring-petclinic-microservices-config
    • ラベル: master

    Screenshot of the Azure portal showing the Settings tab of the Application Configuration Service page.

  3. ターゲット URI へのアクセスを検証するには、[検証] を選択します。

  4. 検証が正常に完了したら、[適用] を選択して構成設定を更新します。

Tanzu のアプリケーション構成サービスにアプリケーションをバインドする

Git バックエンドで Application Configuration Service for Tanzu を使用する場合は、アプリを Application Configuration Service for Tanzu にバインドする必要があります。 アプリをバインドした後、アプリで使用されるパターンを構成する必要があります。 アプリのパターンをバインドして構成するには、次の手順を使用します。

次の手順を使用して、VMware Tanzu のアプリケーション構成サービスにアプリをバインドします。

  1. Azure Spring Apps Enterprise インスタンスで、ナビゲーション ウィンドウで [Application Configuration Service] を選択します。

  2. [アプリ のバインド] を選択し、[アプリのバインド] を選択します

    Screenshot of the Azure portal showing the App binding tab of the Application Configuration Service page and the Bind app dropdown menu showing.

  3. ドロップダウン メニューでアプリを選択し、[適用] を選択して、アプリケーションを Tanzu 用 Application Configuration Service にバインドします。

詳細については、「Application Configuration Service for Tanzu を使用する」を参照してください。

Service Registry for Tanzu を使用する

Service Registry は、財産的価値のある VMware Tanzu コンポーネントの 1 つです。 これにより、マイクロサービス ベースのアーキテクチャの主要な概念の 1 つであるサービス検出パターンの実装がアプリに提供されます。 Enterprise プランでは、Tanzu の Service Registry がサービス レジストリを提供し、アプリのサポートを検出します。 Managed Spring Cloud Eureka は Basic プランと Standard プランでのみ使用でき、Enterprise プランでは使用できません。

コンポーネント Standard プラン Enterprise プラン
サービス レジストリ OSS eureka
自動的にバインドされる (常に挿入)
常にプロビジョニングされる
Service Registry for Tanzu
アプリへの手動バインドが必要
オンデマンドで有効にする

アプリケーションを Tanzu Service Registry にバインドする

VMware Tanzu のアプリケーション構成サービスにアプリをバインドするには、次の手順に従います。

  1. Azure Spring Apps Enterprise インスタンスで、[サービス レジストリ] を選択 します

  2. [アプリ バインド] を選択 します。 現在バインドされているアプリは、[アプリ名] の下に表示されます。

  3. [アプリのバインド] を選択 します

  4. ドロップダウン メニューでアプリを選択し、[適用] を選択して、アプリケーションを Tanzu Service Registry にバインドします。

    Screenshot of the Azure portal Azure Spring Apps with Service Registry page and 'Bind app' dialog showing.

Note

バインドとバインド解除の状態を変更したときは、アプリを再起動または再デプロイして変更を有効にする必要があります。

詳細については、「Tanzu Service Registry を使用する」を参照してください。

アプリケーションをビルドしてデプロイする

Enterprise プランでは、Tanzu Build Service を使用してアプリをビルドします。 これは、ソース コードや zip ファイルなどの成果物からデプロイするポリグロット アプリなど、多くの機能を提供しています。

Tanzu Build Service を使用するには、ビルド タスクとビルダーで使用するリソースを指定する必要があります。 ビルド環境を設定する --build-env パラメーターを指定することもできます。

アプリが Tanzu の Application Configuration Service にバインドされている場合は、追加の引数 —config-file-patternを指定する必要があります。

詳細については、「Tanzu Build Service を使用する」を参照してください。

アプリケーションをローカルでビルドする

ローカルでビルドするには、次の手順を使用します。

  1. 次のコマンドを使用して、Azure アカウントにサンプル アプリ リポジトリを複製し、ディレクトリを変更して、プロジェクトをビルドします。

    git clone -b enterprise https://github.com/azure-samples/spring-petclinic-microservices
    cd spring-petclinic-microservices
    mvn clean package -DskipTests
    

    プロジェクトのコンパイルには数分かかる場合があります。 完了すると、各サービスの個々の JAR ファイルがそれぞれのフォルダーに格納されます。

  2. 次のコマンドを使用して、前の手順でビルドした JAR ファイルをデプロイします。

    az spring app deploy \
        --name api-gateway \
        --artifact-path spring-petclinic-api-gateway/target/spring-petclinic-api-gateway-2.3.6.jar \
        --config-file-patterns api-gateway
    az spring app deploy \
        --name customers-service \
        --artifact-path spring-petclinic-customers-service/target/spring-petclinic-customers-service-2.3.6.jar \
        --config-file-patterns customers-service
    
  3. 次のコマンドを使用して、デプロイ後にアプリケーションの状態を照会します。

    az spring app list --output table
    

    次の例のような出力が表示されます。

    Name                  Location    ResourceGroup       Public Url                                                 Production Deployment    Provisioning State    CPU    Memory    Running Instance    Registered Instance    Persistent Storage    Bind Service Registry    Bind Application Configuration Service
    --------------------  ----------  ---------------  ---------------------------------------------------------  -----------------------  --------------------  -----  --------  ------------------  ---------------------  --------------------  -----------------------  ----------------------------------------
    api-gateway           eastus      <resource group>   https://<service_name>-api-gateway.asc-test.net                    default                  Succeeded             1      2Gi       1/1                1/1                    -                     True                     True
    customers-service     eastus      <resource group>                                                                      default                  Succeeded             1      2Gi       1/1                1/1                    -                     True                     True
    

Application Insights を使用する

Azure Spring Apps Enterprise プランでは、ビルドパック バインドを使用して、アプリケーション インサイトをインプロセス エージェントではなく型ApplicationInsightsと統合します。 詳細については、「APM 統合と CA 証明書を構成する方法」を参照してください。

次の表に、プランで使用できる APM プロバイダーの一覧を示します。

Standard プラン Enterprise プラン
Application Insight
New Relic
Dynatrace
AppDynamics
Application Insight
New Relic
Dynatrace
AppDynamics
Elastic APM

Application Insights の現在の設定を確認または更新するには、次の手順を使用します。

  1. Azure Spring Apps Enterprise インスタンスで、[アプリケーション インサイト] を選択します

  2. [バインドの編集] または [バインドのバインドの解除] を選択して、アプリケーション インサイトを有効または無効にします。

    Screenshot of the Azure portal Application Insights page with the Edit binding option dropdown menu showing.

  3. [バインドの編集] を選択 します。 バインド設定を編集し、[保存] を選択 します

    Screenshot of the Azure portal 'Edit binding' pane.

次のステップ