使用 Service Fabric CLI 將應用程式部署到 Service Fabric 叢集

這個範例指令碼會將應用程式封裝複製到叢集映像存放區、在叢集中註冊應用程式類型,並從應用程式類型建立應用程式執行個體。 在這個階段,還會建立所有預設的服務。

如有需要,請安裝 Service Fabric SDK

範例指令碼

#!/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
    

清除部署

完成時,可以使用移除指令碼將應用程式移除。 移除指令碼會刪除應用程式執行個體、將應用程式類型取消登錄,並從映像存放區刪除應用程式套件。

下一步

如需詳細資訊,請參閱 Service Fabric CLI 文件

您可以在 Service Fabric CLI 範例中找到適用於 Azure Service Fabric 的其他 Service Fabric CLI 範例。