多容器应用程序和服务清单示例Multi-container application and service manifest examples

下面是多容器 Service Fabric 应用程序的应用程序和服务清单示例。The following are examples of the application and service manifests for a multi-container Service Fabric application. 这些示例的用途是展示有哪些设置可用以及如何使用它们。The purpose of these examples is to show what settings are available and how to use them. 这些应用程序和服务清单基于 Windows Server 2016 容器示例清单。These application and service manifests are based on the Windows Server 2016 Container Sample manifests.

展示了以下功能:The following features are shown:

清单Manifest 功能Features
应用程序清单Application manifest 替代环境变量配置容器端口到主机映射配置容器注册表身份验证资源调控设置隔离模式指定 OS 内部版本特定的容器映像override environment variables, configure container port-to-host mapping, configure container registry authentication, resource governance, set isolation mode, specify OS build-specific container images
FrontEndService 服务清单FrontEndService service manifest 设置环境变量配置终结点、将命令传递给容器、将证书导入到容器中set environment variables, configure an endpoint, pass commands to the container, import a certificate into a container
BackEndService 服务清单BackEndService service manifest 设置环境变量配置终结点配置卷驱动程序set environment variables, configure an endpoint, configure volume driver

有关特定 XML 元素的详细信息,请参阅应用程序清单元素FrontEndService 服务清单元素BackEndService 服务清单元素See Application manifest elements, FrontEndService service manifest elements, and BackEndService service manifest elements for more information on specific XML elements.

应用程序清单Application manifest

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest ApplicationTypeName="Container.ApplicationType"
                     ApplicationTypeVersion="1.0.0"
                     xmlns="http://schemas.microsoft.com/2011/01/fabric"
                     xmlns:xsd="https://www.w3.org/2001/XMLSchema"
                     xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
  <Parameters>
    <Parameter Name="BackEndService_InstanceCount" DefaultValue="-1" />
    <Parameter Name="FrontEndService_InstanceCount" DefaultValue="-1" />
    <Parameter Name="CpuCores" DefaultValue="2" />
    <Parameter Name="BlockIOWeight" DefaultValue="200" />
    <Parameter Name="MaximumIOBandwidth" DefaultValue="1024" />
    <Parameter Name="MemoryReservationInMB" DefaultValue="1024" />
    <Parameter Name="MemorySwapInMB" DefaultValue="4084"/>
    <Parameter Name="MaximumIOps" DefaultValue="20"/>
    <Parameter Name="MemoryFront" DefaultValue="4084" />
    <Parameter Name="MemoryBack" DefaultValue="2048" />
    <Parameter Name="CertThumbprint" DefaultValue=""/>
  </Parameters>
  <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion 
       should match the Name and Version attributes of the ServiceManifest element defined in the 
       ServiceManifest.xml file. -->
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="BackEndServicePkg" ServiceManifestVersion="1.0.0" />    

    <!-- Policies to be applied to the imported service manifest. -->
    <Policies>
      <!-- Set resource governance at the service package level. -->
      <ServicePackageResourceGovernancePolicy CpuCores="[CpuCores]" MemoryInMB="[MemoryFront]"/>

      <!-- Set resource governance at the code package level. -->
      <ResourceGovernancePolicy CodePackageRef="Code" CpuPercent="10" MemoryInMB="[MemoryFront]" BlockIOWeight="[BlockIOWeight]" MaximumIOBandwidth="[MaximumIOBandwidth]" MaximumIOps="[MaximumIOps]" MemoryReservationInMB="[MemoryReservationInMB]" MemorySwapInMB="[MemorySwapInMB]"/>

      <!-- Policies for activating container hosts. -->
      <ContainerHostPolicies CodePackageRef="Code" Isolation="process">

        <!-- Credentials for the repository hosting the container image.-->
        <RepositoryCredentials AccountName="sfsamples" Password="ENCRYPTED-PASSWORD" PasswordEncrypted="true"/>

        <!-- This binds the port the container is listening on (8905 in this sample) to an endpoint resource named "BackEndServiceTypeEndpoint", which is defined in the service manifest.  -->
        <PortBinding ContainerPort="8905" EndpointRef="BackEndServiceTypeEndpoint"/>

        <!-- Configure the Azure Files volume plugin.  Bind the source folder on the host VM or a remote share to the destination folder within the running container. -->
        <Volume Source="azfiles" Destination="c:\VolumeTest\Data" Driver="sfazurefile">
          <!-- Driver options to be passed to driver. The Azure Files volume plugin supports the following driver options:
            shareName (the Azure Files file share that provides the volume for the container), storageAccountName (the Azure storage account
            that contains the Azure Files file share), storageAccountKey (Access key for the Azure storage account that contains the Azure Files file share).
            These three driver options are required. -->
          <DriverOption Name="shareName" Value="" />
          <DriverOption Name="storageAccountName" Value="MY-STORAGE-ACCOUNT-NAME" />
          <DriverOption Name="storageAccountKey" Value="MY-STORAGE-ACCOUNT-KEY" />
        </Volume>

        <!-- Windows Server containers may not be compatible across different versions of the OS.  You can specify multiple OS images per container and tag 
        them with the build versions of the OS. Get the build version of the OS by running "winver" at a Windows command prompt. -->
        <ImageOverrides>
          <!-- If the underlying OS is build version 16299 (Windows Server version 1709), Service Fabric picks the container image tagged with Os="16299". -->
          <Image Name="sfsamples.azurecr.cn/sfsamples/servicefabricbackendservice_1709" Os="16299" />

          <!-- An untagged container image is assumed to work across all versions of the OS and overrides the image specified in the service manifest. -->
          <Image Name="sfsamples.azurecr.cn/sfsamples/servicefabricbackendservice_default" />          
        </ImageOverrides>
      </ContainerHostPolicies>
    </Policies>
  </ServiceManifestImport>

  <!-- Policies to be applied to the imported service manifest. -->
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="FrontEndServicePkg" ServiceManifestVersion="1.0.0" />

    <!-- This enables you to provide different values for environment variables when creating a FrontEndService
         Theses environment variables are declared in the FrontEndServiceType service manifest-->
    <EnvironmentOverrides CodePackageRef="Code">
      <EnvironmentVariable Name="BackendServiceName" Value="Container.Application/BackEndService"/>
      <EnvironmentVariable Name="HttpGatewayPort" Value="19080"/>
      <EnvironmentVariable Name="IsContainer" Value="true"/>
    </EnvironmentOverrides>

    <!-- This policy maps the  port of the container (80) to the endpoint declared in the service, 
         FrontEndServiceTypeEndpoint which is exposed as port 80 on the host-->    
    <Policies>

      <!-- Set resource governance at the service package level. -->
      <ServicePackageResourceGovernancePolicy CpuCores="[CpuCores]" MemoryInMB="[MemoryBack]"/>

      <!-- Policies for activating container hosts. -->
      <ContainerHostPolicies CodePackageRef="Code" Isolation="process">

        <!-- Credentials for the repository hosting the container image.-->
        <RepositoryCredentials AccountName="sfsamples" Password="ENCRYPTED-PASSWORD" PasswordEncrypted="true"/>

        <!-- Binds an endpoint resource (declared in the service manifest) to the exposed container port. -->
        <PortBinding ContainerPort="80" EndpointRef="FrontEndServiceTypeEndpoint"/>

        <!-- Import a certificate into the container.  The certificate must be installed in the LocalMachine store of all the cluster nodes.
          When the application starts, the runtime reads the certificate and generates a PFX file and password (on Windows) or a PEM file (on Linux).
          The PFX file and password are accessible in the container using the Certificates_ServicePackageName_CodePackageName_CertName_PFX and 
          Certificates_ServicePackageName_CodePackageName_CertName_Password environment variables. The PEM file is accessible in the container using the 
          Certificates_ServicePackageName_CodePackageName_CertName_PEM and Certificates_ServicePackageName_CodePackageName_CertName_PrivateKey environment variables.-->
        <CertificateRef Name="MyCert1" X509StoreName="My" X509FindValue="[CertThumbprint]" />

        <!-- If the certificate is already in PFX or PEM form, you can create a data package inside your application and reference that certificate here. -->
        <CertificateRef Name="MyCert2" DataPackageRef="Data" DataPackageVersion="1.0.0" RelativePath="MyCert2.PFX" Password="ENCRYPTED-PASSWORD" IsPasswordEncrypted="true"/>
      </ContainerHostPolicies>
    </Policies>
  </ServiceManifestImport>

  <DefaultServices>
    <!-- The section below creates instances of service types, when an instance of this 
         application type is created. You can also create one or more instances of service type using the 
         ServiceFabric PowerShell module.

         The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->

    <Service Name="FrontEndService" >
      <StatelessService ServiceTypeName="FrontEndServiceType" InstanceCount="[FrontEndService_InstanceCount]">
        <SingletonPartition />
      </StatelessService>
    </Service>
        <Service Name="BackEndService" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="BackEndServiceType" InstanceCount="[BackEndService_InstanceCount]">
        <SingletonPartition />
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

FrontEndService 服务清单FrontEndService service manifest

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="FrontEndServicePkg"
                 Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric"
                 xmlns:xsd="https://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <!-- This is the name of your ServiceType.
         The UseImplicitHost attribute indicates this is a guest service. -->
    <StatelessServiceType ServiceTypeName="FrontEndServiceType" UseImplicitHost="true" />
  </ServiceTypes>

  <!-- Code package is your service executable. -->
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ContainerHost>
        <!--The repo and image on https://hub.docker.com or Azure Container Registry. -->
        <ImageName>sfsamples.azurecr.cn/sfsamples/servicefabricfrontendservice:v1</ImageName>
      </ContainerHost>
    </EntryPoint>
    <!-- Pass environment variables to your container or exe.  These variables are overridden in the application manifest. -->
    <EnvironmentVariables>
      <EnvironmentVariable Name="BackendServiceName" Value=""/>
      <EnvironmentVariable Name="HttpGatewayPort" Value=""/>
      <EnvironmentVariable Name="IsContainer" Value=""/>
    </EnvironmentVariables>
  </CodePackage>

  <!-- Config package is the contents of the Config directory under PackageRoot that contains an 
       independently-updateable and versioned set of custom configuration settings for your service. -->
  <ConfigPackage Name="Config" Version="1.0.0" />

  <!-- Data package is the contents of the Data directory under PackageRoot that contains an 
       independently-updateable and versioned static data that's consumed by the process at runtime. -->
  <DataPackage Name="Data" Version="1.0.0"/>

  <Resources>
    <Endpoints>
      <!-- This endpoint is used by the communication listener to obtain the port on which to 
           listen. For a guest executable is used to register with the NamingService at its REST endpoint
           with http scheme and port 80 -->
      <Endpoint Name="FrontEndServiceTypeEndpoint" UriScheme="http" Port="80"/>
    </Endpoints>
  </Resources>
</ServiceManifest>

BackEndService 服务清单BackEndService service manifest

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="BackEndServicePkg"
                 Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric"
                 xmlns:xsd="https://www.w3.org/2001/XMLSchema"
                 xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
  <ServiceTypes>
    <!-- This is the name of your ServiceType.
         The UseImplicitHost attribute indicates this is a guest service. -->
    <StatelessServiceType ServiceTypeName="BackEndServiceType" UseImplicitHost="true" />
  </ServiceTypes>

  <!-- Code package is your service executable. -->
  <CodePackage Name="Code" Version="1.0.0">
    <EntryPoint>
      <ContainerHost>
        <!--The repo and image on https://hub.docker.com or Azure Container Registry. -->
        <ImageName>sfsamples.azurecr.cn/sfsamples/servicefabricbackendservice:v1</ImageName>

        <!-- Pass comma delimited commands to your container. -->
        <Commands> dotnet, myproc.dll, 5 </Commands>
      </ContainerHost>
    </EntryPoint>
    <!-- Pass environment variables to your container. These variables are overridden in the application manifest. -->
    <EnvironmentVariables>
      <EnvironmentVariable Name="IsContainer" Value="true"/>
    </EnvironmentVariables>
  </CodePackage>

  <!-- Config package is the contents of the Config directory under PackageRoot that contains an 
       independently-updateable and versioned set of custom configuration settings for your service. -->
  <ConfigPackage Name="Config" Version="1.0.0" />

  <Resources>
    <Endpoints>
      <!-- This endpoint is used by the communication listener to obtain the host port on which to 
           listen. For a guest executable is used to register with the NamingService at its REST endpoint
           with http scheme. In this case since no port is specified, one is created and assigned dynamically
           to the service. This dynamically assigned host port is mapped to the container port (8905 in this sample),
            which was specified in the application manifest.-->
      <Endpoint Name="BackEndServiceTypeEndpoint" UriScheme="http" />
    </Endpoints>
  </Resources>
</ServiceManifest>

应用程序清单元素Application manifest elements

ApplicationManifest 元素ApplicationManifest Element

以声明方式描述应用程序类型和版本。Declaratively describes the application type and version. 引用构成服务的一个或多个服务清单来撰写应用程序类型。One or more service manifests of the constituent services are referenced to compose an application type. 可以使用参数化应用程序设置重写构成服务的配置设置。Configuration settings of the constituent services can be overridden using parameterized application settings. 默认服务、服务模板、主体、策略、诊断设置和证书也可以在应用程序级别声明。Default services, service templates, principals, policies, diagnostics set-up, and certificates can also declared at the application level. 有关详细信息,请参阅 ApplicationManifest 元素For more information, see ApplicationManifest Element

Parameters 元素Parameters Element

声明在此应用程序清单中使用的参数。Declares the parameters that are used in this application manifest. 当应用程序已实例化并可用于重写应用程序或服务配置设置时,可以提供这些参数的值。The value of these parameters can be supplied when the application is instantiated and can be used to override application or service configuration settings. 有关详细信息,请参阅 Parameters 元素For more information, see Parameters Element

Parameter 元素Parameter Element

要在此清单中使用的应用程序参数。An application parameter to be used in this manifest. 可在应用程序实例化期间更改参数值;如果未提供值,则使用默认值。The parameter value can be changed during application instantiation, or, if no value is supplied the default value is used. 有关详细信息,请参阅 Parameter 元素For more information, see Parameter Element

ServiceManifestImport 元素ServiceManifestImport Element

导入服务开发人员创建的服务清单。Imports a service manifest created by the service developer. 必须导入应用程序中每个构成服务的服务清单。A service manifest must be imported for each constituent service in the application. 可为服务清单声明配置重写和策略。Configuration overrides and policies can be declared for the service manifest. 有关详细信息,请参阅 ServiceManifestImport 元素For more information, see ServiceManifestImport Element

ServiceManifestRef 元素ServiceManifestRef Element

按引用导入服务清单。Imports the service manifest by reference. 当前,服务清单文件 (ServiceManifest.xml) 必须存在于生成包中。Currently the service manifest file (ServiceManifest.xml) must be present in the build package. 有关详细信息,请参阅 ServiceManifestRef 元素For more information, see ServiceManifestRef Element

Policies 元素Policies Element

描述要在导入的服务清单中应用的策略(终结点绑定、包共享、运行方式和安全访问权限)。Describes policies (end-point binding, package sharing, run-as, and security access) to be applied on the imported service manifest. 有关详细信息,请参阅 Policies 元素For more information, see Policies Element

ServicePackageResourceGovernancePolicy 元素ServicePackageResourceGovernancePolicy Element

定义在整个服务包级别应用的资源调控策略。Defines the resource governance policy that is applied at the level of the entire service package. 有关详细信息,请参阅 ServicePackageResourceGovernancePolicy 元素For more information, see ServicePackageResourceGovernancePolicy Element

ResourceGovernancePolicy 元素ResourceGovernancePolicy Element

指定代码包的资源限制。Specifies resource limits for a code package. 有关详细信息,请参阅 ResourceGovernancePolicy 元素For more information, see ResourceGovernancePolicy Element

ContainerHostPolicies 元素ContainerHostPolicies Element

指定用于激活容器主机的策略。Specifies policies for activating container hosts. 有关详细信息,请参阅 ContainerHostPolicies 元素For more information, see ContainerHostPolicies Element

RepositoryCredentials 元素RepositoryCredentials Element

要从中提取映像的容器映像存储库的凭据。Credentials for container image repository to pull images from. 有关详细信息,请参阅 RepositoryCredentials 元素For more information, see RepositoryCredentials Element

PortBinding 元素PortBinding Element

指定要绑定到公开的容器端口的终结点资源。Specifies which endpoint resource to bind to the exposed container port. 有关详细信息,请参阅 PortBinding 元素For more information, see PortBinding Element

Volume 元素Volume Element

指定要绑定到容器的卷。Specifies the volume to be bound to the container. 有关详细信息,请参阅 Volume 元素For more information, see Volume Element

DriverOption 元素DriverOption Element

要传递给驱动程序的驱动程序选项。Driver options to be passed to driver. 有关详细信息,请参阅 DriverOption 元素For more information, see DriverOption Element

ImageOverrides 元素ImageOverrides Element

Windows Server 容器在不同 OS 版本中可能不兼容。Windows Server containers may not be compatible across different versions of the OS. 可以为每个容器指定多个 OS 映像,并使用 OS 的内部版本来标记它们。You can specify multiple OS images per container and tag them with the build versions of the OS. 通过在 Windows 命令提示符下运行“winver”获取 OS 的内部版本。Get the build version of the OS by running "winver" at a Windows command prompt. 如果基础 OS 为内部版本 16299(Windows Server 版本 1709),Service Fabric 会选取带有 Os="16299" 标记的容器映像。If the underlying OS is build version 16299 (Windows Server version 1709), Service Fabric picks the container image tagged with Os="16299". 可以认为未标记的容器映像适合所有版本的 OS,并且会替代在服务清单中指定的映像。An untagged container image is assumed to work across all versions of the OS and overrides the image specified in the service manifest. 有关详细信息,请参阅 ImageOverrides 元素For more information, see ImageOverrides Element

Image 元素Image Element

容器映像,对应于要启动的 OS 内部版本号。Container image corresponding to OS build version number to be launched. 如果 Os 属性未指定,则认为容器映像适合所有版本的 OS,并且会替代在服务清单中指定的映像。If the Os attribute is not specified, the container image is assumed to work across all versions of the OS and overrides the image specified in the service manifest. 有关详细信息,请参阅 Image 元素For more information, see Image Element

EnvironmentOverrides 元素EnvironmentOverrides Element

有关详细信息,请参阅 EnvironmentOverrides 元素For more information, see EnvironmentOverrides Element

EnvironmentVariable 元素EnvironmentVariable Element

环境变量。Environment variable. 有关详细信息,请参阅 EnvironmentVariable 元素For more information, see EnvironmentVariable Element

CertificateRef 元素CertificateRef Element

指定要向容器环境公开的 X509 证书的相关信息。Specifies information about an X509 certificate which is to be exposed to the container environment. 该证书必须安装在所有群集节点的 LocalMachine 存储中。The certificate must be installed in the LocalMachine store of all the cluster nodes. 应用程序启动时,运行时读取证书并生成 PFX 文件和密码(在 Windows 上)或 PEM 文件(在 Linux 上)。When the application starts, the runtime reads the certificate and generates a PFX file and password (on Windows) or a PEM file (on Linux). 可在容器内使用 Certificates_ServicePackageName_CodePackageName_CertName_PFX 和 Certificates_ServicePackageName_CodePackageName_CertName_Password 环境变量访问此 PFX 文件和密码。The PFX file and password are accessible in the container using the Certificates_ServicePackageName_CodePackageName_CertName_PFX and Certificates_ServicePackageName_CodePackageName_CertName_Password environment variables. 可在容器内使用 Certificates_ServicePackageName_CodePackageName_CertName_PEM 和 Certificates_ServicePackageName_CodePackageName_CertName_PrivateKey 环境变量访问此 PEM 文件。The PEM file is accessible in the container using the Certificates_ServicePackageName_CodePackageName_CertName_PEM and Certificates_ServicePackageName_CodePackageName_CertName_PrivateKey environment variables. 有关详细信息,请参阅 CertificateRef 元素For more information, see CertificateRef Element

DefaultServices 元素DefaultServices Element

声明每当一个应用程序依据此应用程序类型进行实例化时自动创建的服务实例。Declares service instances that are automatically created whenever an application is instantiated against this application type. 有关详细信息,请参阅 DefaultServices 元素For more information, see DefaultServices Element

Service 元素Service Element

声明在实例化应用程序时要自动创建的服务。Declares a service to be created automatically when the application is instantiated. 有关详细信息,请参阅 Service 元素For more information, see Service Element

StatelessService 元素StatelessService Element

定义无状态服务。Defines a stateless service. 有关详细信息,请参阅 StatelessService 元素For more information, see StatelessService Element

FrontEndService 服务清单元素FrontEndService service manifest elements

ServiceManifest 元素ServiceManifest Element

以声明方式描述服务类型和版本。Declaratively describes the service type and version. 它列出组成一个服务包以支持一个或多个服务类型的独立可升级的代码、配置和数据包。It lists the independently upgradeable code, configuration, and data packages that together compose a service package to support one or more service types. 此外,还指定资源、诊断设置和服务元数据,例如服务类型、运行状况属性和负载均衡指标。Resources, diagnostics settings, and service metadata, such as service type, health properties, and load-balancing metrics, are also specified. 有关详细信息,请参阅 ServiceManifest 元素For more information, see ServiceManifest Element

ServiceTypes 元素ServiceTypes Element

定义此清单中的 CodePackage 支持哪些服务类型。Defines what service types are supported by a CodePackage in this manifest. 当一种服务针对这些服务类型之一进行实例化时,可激活此清单中声明的所有代码包,方法是运行这些代码包的入口点。When a service is instantiated against one of these service types, all code packages declared in this manifest are activated by running their entry points. 在清单级别而不是代码包级别声明服务类型。Service types are declared at the manifest level and not the code package level. 有关详细信息,请参阅 ServiceTypes 元素For more information, see ServiceTypes Element

StatelessServiceType 元素StatelessServiceType Element

描述无状态服务类型。Describes a stateless service type. 有关详细信息,请参阅 StatelessServiceType 元素For more information, see StatelessServiceType Element

CodePackage 元素CodePackage Element

描述支持定义的服务类型的代码包。Describes a code package that supports a defined service type. 当一种服务针对这些服务类型之一进行实例化时,可激活此清单中声明的所有代码包,方法是运行这些代码包的入口点。When a service is instantiated against one of these service types, all code packages declared in this manifest are activated by running their entry points. 生成的进程应在运行时注册所支持的服务类型。The resulting processes are expected to register the supported service types at run time. 当存在多个代码包时,每当系统查找任何一种声明的服务类型时,它们都会被激活。When there are multiple code packages, they are all activated whenever the system looks for any one of the declared service types. 有关详细信息,请参阅 CodePackage 元素For more information, see CodePackage Element

EntryPoint 元素EntryPoint Element

EntryPoint 指定的可执行文件通常是长时间运行的服务主机。The executable specified by EntryPoint is typically the long-running service host. 提供单独的设置入口点可避免长时间使用高特权运行服务主机。The presence of a separate setup entry point avoids having to run the service host with high privileges for extended periods of time. 由 EntryPoint 指定的可执行文件在 SetupEntryPoint 成功退出后运行。The executable specified by EntryPoint is run after SetupEntryPoint exits successfully. 如果总是终止或出现故障,则将监视并重启所产生的过程(再次从 SetupEntryPoint 开始)。The resulting process is monitored and restarted (beginning again with SetupEntryPoint) if it ever terminates or crashes. 有关详细信息,请参阅 EntryPoint 元素For more information, see EntryPoint Element

ContainerHost 元素ContainerHost Element

有关详细信息,请参阅 ContainerHost 元素For more information, see ContainerHost Element

ImageName 元素ImageName Element

https://hub.docker.com 或 Azure 容器注册表上的存储库和映像。The repo and image on https://hub.docker.com or Azure Container Registry. 有关详细信息,请参阅 ImageName 元素For more information, see ImageName Element

EnvironmentVariables 元素EnvironmentVariables Element

将环境变量传递给容器或 exe。Pass environment variables to your container or exe. 有关详细信息,请参阅 EnvironmentVariables 元素For more information, see EnvironmentVariables Element

EnvironmentVariable 元素EnvironmentVariable Element

环境变量。Environment variable. 有关详细信息,请参阅 EnvironmentVariable 元素For more information, see EnvironmentVariable Element

ConfigPackage 元素ConfigPackage Element

声明一个由 Name 属性命名的文件夹,该文件夹中包含 Settings.xml 文件。Declares a folder, named by the Name attribute, that contains a Settings.xml file. 此文件包含进程用户定义的键值对设置,进程可在运行时读回这些设置。This file contains sections of user-defined, key-value pair settings that the process can read back at run time. 升级期间,如果仅更改了 ConfigPackage 版本,则不重启正在运行的进程。During an upgrade, if only the ConfigPackage version has changed, then the running process is not restarted. 相反,回调会向进程通知配置设置已更改,以便可以重新动态加载这些设置。Instead, a callback notifies the process that configuration settings have changed so they can be reloaded dynamically. 有关详细信息,请参阅 ConfigPackage 元素For more information, see ConfigPackage Element

DataPackage 元素DataPackage Element

声明一个由 Name 属性命名的文件夹,该文件夹中包含静态数据文件。Declares a folder, named by the Name attribute, which contains static data files. 升级服务清单中所列的任何数据包时,Service Fabric 会回收主机和支持包中指定的所有 EXE 和 DLLHOST。Service Fabric will recycle all EXEs and DLLHOSTs specified in the host and support packages when any of the data packages listed in the service manifest are upgraded. 有关详细信息,请参阅 DataPackage 元素For more information, see DataPackage Element

Resources 元素Resources Element

描述此服务使用的资源,可以在不修改已编译代码的情况下声明,并可以在部署服务时更改。Describes the resources used by this service, which can be declared without modifying compiled code and changed when the service is deployed. 通过应用程序清单的 Principals 和 Policies 节控制对这些资源的访问。Access to these resources is controlled through the Principals and Policies sections of the application manifest. 有关详细信息,请参阅 Resources 元素For more information, see Resources Element

Endpoints 元素Endpoints Element

定义服务的终结点。Defines endpoints for the service. 有关详细信息,请参阅 Endpoints 元素For more information, see Endpoints Element

Endpoint 元素Endpoint Element

有关详细信息,请参阅 Endpoint 元素For more information, see Endpoint Element

BackEndService 服务清单元素BackEndService service manifest elements

ServiceManifest 元素ServiceManifest Element

以声明方式描述服务类型和版本。Declaratively describes the service type and version. 它列出组成一个服务包以支持一个或多个服务类型的独立可升级的代码、配置和数据包。It lists the independently upgradeable code, configuration, and data packages that together compose a service package to support one or more service types. 此外,还指定资源、诊断设置和服务元数据,例如服务类型、运行状况属性和负载均衡指标。Resources, diagnostics settings, and service metadata, such as service type, health properties, and load-balancing metrics, are also specified. 有关详细信息,请参阅 ServiceManifest 元素For more information, see ServiceManifest Element

ServiceTypes 元素ServiceTypes Element

定义此清单中的 CodePackage 支持哪些服务类型。Defines what service types are supported by a CodePackage in this manifest. 当一种服务针对这些服务类型之一进行实例化时,可激活此清单中声明的所有代码包,方法是运行这些代码包的入口点。When a service is instantiated against one of these service types, all code packages declared in this manifest are activated by running their entry points. 在清单级别而不是代码包级别声明服务类型。Service types are declared at the manifest level and not the code package level. 有关详细信息,请参阅 ServiceTypes 元素For more information, see ServiceTypes Element

StatelessServiceType 元素StatelessServiceType Element

描述无状态服务类型。Describes a stateless service type. 有关详细信息,请参阅 StatelessServiceType 元素For more information, see StatelessServiceType Element

CodePackage 元素CodePackage Element

描述支持定义的服务类型的代码包。Describes a code package that supports a defined service type. 当一种服务针对这些服务类型之一进行实例化时,可激活此清单中声明的所有代码包,方法是运行这些代码包的入口点。When a service is instantiated against one of these service types, all code packages declared in this manifest are activated by running their entry points. 生成的进程应在运行时注册所支持的服务类型。The resulting processes are expected to register the supported service types at run time. 当存在多个代码包时,每当系统查找任何一种声明的服务类型时,它们都会被激活。When there are multiple code packages, they are all activated whenever the system looks for any one of the declared service types. 有关详细信息,请参阅 CodePackage 元素For more information, see CodePackage Element

EntryPoint 元素EntryPoint Element

EntryPoint 指定的可执行文件通常是长时间运行的服务主机。The executable specified by EntryPoint is typically the long-running service host. 提供单独的设置入口点可避免长时间使用高特权运行服务主机。The presence of a separate setup entry point avoids having to run the service host with high privileges for extended periods of time. 由 EntryPoint 指定的可执行文件在 SetupEntryPoint 成功退出后运行。The executable specified by EntryPoint is run after SetupEntryPoint exits successfully. 如果总是终止或出现故障,则将监视并重启所产生的过程(再次从 SetupEntryPoint 开始)。The resulting process is monitored and restarted (beginning again with SetupEntryPoint) if it ever terminates or crashes. 有关详细信息,请参阅 EntryPoint 元素For more information, see EntryPoint Element

ContainerHost 元素ContainerHost Element

有关详细信息,请参阅 ContainerHost 元素For more information, see ContainerHost Element

ImageName 元素ImageName Element

https://hub.docker.com 或 Azure 容器注册表上的存储库和映像。The repo and image on https://hub.docker.com or Azure Container Registry. 有关详细信息,请参阅 ImageName 元素For more information, see ImageName Element

Commands 元素Commands Element

将以逗号分隔的命令列表传递给容器。Pass a comma delimited list of commands to the container. 有关详细信息,请参阅 Commands 元素For more information, see Commands Element

EnvironmentVariables 元素EnvironmentVariables Element

将环境变量传递给容器或 exe。Pass environment variables to your container or exe. 有关详细信息,请参阅 EnvironmentVariables 元素For more information, see EnvironmentVariables Element

EnvironmentVariable 元素EnvironmentVariable Element

环境变量。Environment variable. 有关详细信息,请参阅 EnvironmentVariable 元素For more information, see EnvironmentVariable Element

ConfigPackage 元素ConfigPackage Element

声明一个由 Name 属性命名的文件夹,该文件夹中包含 Settings.xml 文件。Declares a folder, named by the Name attribute, that contains a Settings.xml file. 此文件包含进程用户定义的键值对设置,进程可在运行时读回这些设置。This file contains sections of user-defined, key-value pair settings that the process can read back at run time. 升级期间,如果仅更改了 ConfigPackage 版本,则不重启正在运行的进程。During an upgrade, if only the ConfigPackage version has changed, then the running process is not restarted. 相反,回调会向进程通知配置设置已更改,以便可以重新动态加载这些设置。Instead, a callback notifies the process that configuration settings have changed so they can be reloaded dynamically. 有关详细信息,请参阅 ConfigPackage 元素For more information, see ConfigPackage Element

Resources 元素Resources Element

描述此服务使用的资源,可以在不修改已编译代码的情况下声明,并可以在部署服务时更改。Describes the resources used by this service, which can be declared without modifying compiled code and changed when the service is deployed. 通过应用程序清单的 Principals 和 Policies 节控制对这些资源的访问。Access to these resources is controlled through the Principals and Policies sections of the application manifest. 有关详细信息,请参阅 Resources 元素For more information, see Resources Element

Endpoints 元素Endpoints Element

定义服务的终结点。Defines endpoints for the service. 有关详细信息,请参阅 Endpoints 元素For more information, see Endpoints Element

Endpoint 元素Endpoint Element

有关详细信息,请参阅 Endpoint 元素For more information, see Endpoint Element