Delen via


Een toepassing implementeren in een Service Fabric-cluster met behulp van de Service Fabric CLI

Met dit voorbeeldscript wordt een toepassingspakket gekopieerd naar een clusterinstallatiekopieopslag, wordt het toepassingstype in het cluster geregistreerd en wordt een toepassingsexemplaren gemaakt op basis van het toepassingstype. Op dit moment worden ook alle standaardservices aangemaakt.

Installeer indien nodig de Service Fabric CLI.

Voorbeeldscript

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

Opschoning van de implementatie

Wanneer u klaar bent, kan het verwijderscript worden gebruikt om de toepassing te verwijderen. Het verwijderscript verwijdert het toepassingsexemplaar, registreert het toepassingstype uit en verwijdert het toepassingspakket uit de beeldopslag.

Volgende stappen

Zie de Service Fabric CLI-documentatie voor meer informatie.

Aanvullende Service Fabric CLI-voorbeelden voor Azure Service Fabric vindt u in de Service Fabric CLI-voorbeelden.