Service Fabric CLI を使用して Service Fabric クラスターにアプリケーションをデプロイする

このサンプル スクリプトは、アプリケーション パッケージをクラスター イメージ ストアにコピーし、クラスターにそのアプリケーションの種類を登録し、そのアプリケーションの種類からアプリケーション インスタンスを作成します。 また、この時点で既定のサービスも作成されます。

必要に応じて、Service Fabric CLI をインストールします。

サンプル スクリプト

#!/bin/bash

# Select cluster
sfctl cluster select \
    --endpoint http://svcfab1.westus2.cloudapp.azure.com:19080

# Upload the application files to the image store
# (note the last folder name, Debug in this example)
sfctl application upload \
    --path  C:\Code\svcfab-vs\svcfab-vs\pkg\Debug \
    --show-progress

# Register the application (manifest files) from the image store
# (Note the last folder from the previous command is used: Debug)
sfctl application provision \
    --application-type-build-path Debug \
    --timeout 500

# Create an instance of the registered application and 
# auto deploy any defined services
sfctl application create \
    --app-name fabric:/MyApp \
    --app-type MyAppType \
    --app-version 1.0.0
    

デプロイのクリーンアップ

終了したら、remove スクリプトを使用してアプリケーションを削除することができます。 remove スクリプトは、アプリケーション インスタンスを削除し、アプリケーションの種類の登録を解除し、イメージ ストアからアプリケーション パッケージを削除します。

次のステップ

詳細については、Service Fabric CLI ドキュメントをご覧ください。

その他の Azure Service Fabric 用 Service Fabric CLI サンプルは、Service Fabric CLI のサンプルのページにあります。