Редактиране

Споделяне чрез


Deploy an application to a Service Fabric cluster using the Service Fabric CLI

This sample script copies an application package to a cluster image store, registers the application type in the cluster, and creates an application instance from the application type. Any default services are also created at this time.

If needed, install the Service Fabric CLI.

Sample script

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

Clean up deployment

When done, the remove script can be used to remove the application. The remove script deletes the application instance, unregisters the application type, and deletes the application package from the image store.

Next steps

For more information, see the Service Fabric CLI documentation.

Additional Service Fabric CLI samples for Azure Service Fabric can be found in the Service Fabric CLI samples.