Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service Fabric Application settings not being overriden by Application Manifest parameters #155

Closed
nuno-barreiro opened this issue Oct 30, 2018 · 3 comments

Comments

@nuno-barreiro
Copy link

Need some help understanding why the configuration settings of a service fabric application aren't being overriden by the values defined in the application manifest, as expected. Curently I have some settings defined for my two different environments: the default settings are for the final Azure cluster and I have a custom publish profile for my local dev cluster.

Below what I have for each file:

SampleServFabricApp/ApplicationPackageRoot/ApplicationManifest.xml

<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="SampleServFabricAppType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateFindValue" DefaultValue="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
    <Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames" DefaultValue="*.thefinaldomain.com" />
    <Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints" DefaultValue="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
    <Parameter Name="SampleServFabricApp_PartitionCount" DefaultValue="10" />
    <Parameter Name="SampleServFabricApp_MinReplicaSetSize" DefaultValue="3" />
    <Parameter Name="SampleServFabricApp_TargetReplicaSetSize" DefaultValue="3" />
  </Parameters>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="SampleServFabricApp.EndpointPkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="SampleServFabricApp_MessageTransportConfig">
            <Parameter Name="CertificateFindValue" Value="[SampleServFabricApp_MessageTransportConfig_CertificateFindValue]" />
            <Parameter Name="CertificateRemoteCommonNames" Value="[SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames]" />
            <Parameter Name="CertificateRemoteThumbprints" Value="[SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <DefaultServices>
    <Service Name="SampleServFabricAppActorService" GeneratedIdRef="e07529c2-2426-4065-b621-90033a78704c|Persisted">
      <StatefulService ServiceTypeName="SampleServFabricAppActorServiceType" TargetReplicaSetSize="[SampleServFabricApp_TargetReplicaSetSize]" MinReplicaSetSize="[SampleServFabricApp_MinReplicaSetSize]">
        <UniformInt64Partition PartitionCount="[SampleServFabricApp_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
      </StatefulService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

SampleServFabricApp/ApplicationParameters/dev_cluster.xml

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/SampleServFabricApp" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateFindValue" Value="4826f9a3ac95bca949fab19ea136e197" />
    <Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames" Value="ServiceFabricDevClusterCert" />
    <Parameter Name="SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints" Value="4826f9a3ac95bca949fab19ea136e197" />
  </Parameters>
</Application>

SampleServFabricApp.Endpoint/PackageRoot/Config/Settings.xml

<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Section Name="SampleServFabricApp_MessageTransportConfig">
    <Parameter Name="MaxMessageSize" Value="10000000" />
    <Parameter Name="SecurityCredentialsType" Value="X509" />
    <Parameter Name="CertificateFindType" Value="FindByThumbprint" />
    <Parameter Name="CertificateFindValue" Value="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
    <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
    <Parameter Name="CertificateStoreName" Value="My" />
    <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
    <Parameter Name="CertificateRemoteCommonNames" Value="*.thefinaldomain.com" />
    <Parameter Name="CertificateRemoteThumbprints" Value="e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764" />
  </Section>
</Settings>

When publishing the application to the local cluster, I can see in the output the log when creating the application and it seems the parameters are ok:

2>Creating application... 2> 2> 2>ApplicationName :
fabric:/SampleServFabricApp 2>ApplicationTypeName :
SampleServFabricAppType 2>ApplicationTypeVersion : 1.0.0
2>ApplicationParameters : {
"SampleServFabricApp_MessageTransportConfig_CertificateRemoteThumbprints"
= 2> "4826f9a3ac95bca949fab19ea136e197"; 2> "SampleServFabricApp_MessageTransportConfig_CertificateRemoteCommonNames"
= 2> "ServiceFabricDevClusterCert"; 2> "SampleServFabricApp_MessageTransportConfig_CertificateFindValue" =
2> "4826f9a3ac95bca949fab19ea136e197"; } 2>
2>Create application succeeded.

But using the service explorer I can see that errors occurred during the application startup and if I check the event log I can see the following error:

failed to set security settings to { provider=SSL
protection=EncryptAndSign certType = '' store='LocalMachine/My'
findValue='FindByThumbprint:e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764'
remoteCertThumbprints='e47c0e4b80e9b83e39e5e1dc35610b6b84a3b764'
remoteX509Names=('*.thefinaldomain.com',issuer=)
certChainFlags=40000000 isClientRoleInEffect=false
claimBasedClientAuthEnabled=false }: FABRIC_E_CERTIFICATE_NOT_FOUND

Some things I've already tried:

  • Used Service Fabric explorer and confirmed that the Parameters under the Details tab of the application are correct and match the parameters that have been sent to the deployment script according to the Output window;
  • Confirmed that the contents of the "Settings.xml" file under "C:\SfDevCluster\Data_App_Node_0\SampleServFabricAppType_App18\SampleServFabricApp.EndpointPkg.Config.1.0.0" are equal to the contents of the "SampleServFabricApp.Endpoint/PackageRoot/Config/Settings.xml";

As you can see it seems that the deployment process assumes the correct overridden values, but the application doesn't work and event viewer shows the default values instead of the ones used during deployment.

@suchiagicha
Copy link
Contributor

@lusocoding
This is a known issue and has been fixed in next sdk release (3.3) .
For the workaround , you can use below Api's to read these settings from config package and then create FabricTransportSettings programmatically.

var configurationPackage = Context.CodePackageActivationContext.GetConfigurationPackageObject("Config");
var maxMessageSize = configurationPackage.Settings.Sections["TransportConfig"].Parameters["MaxMessageSize"];

@nuno-barreiro
Copy link
Author

Hi @suchiagicha, thanks for the reply. Is there any estimate on the release date for the v3.3?

@suchiagicha
Copy link
Contributor

ETA is couple of weeks,

@amanbha amanbha closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants