E. Staal
E. Staal

Reputation: 557

Service Fabric ServiceManifest parameterization Traefik Reverse Proxy

In my ServiceManifest I have the following configuration:

<ServiceTypes>
    <!-- This is the name of your ServiceType. 
         This name must match the string used in RegisterServiceType call in Program.cs. -->
    <StatelessServiceType ServiceTypeName="Web1Type">
      <Extensions>
        <Extension Name="Traefik">
          <Labels xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
            <Label Key="traefik.frontend.rule.hostname">Host: test.staal-it.nl#</Label>
            <Label Key="traefik.expose">true</Label>
            <Label Key="traefik.frontend.passHostHeader">true</Label>
          </Labels>
        </Extension>
      </Extensions>
    </StatelessServiceType>
  </ServiceTypes>

I would like to be able to replace test.staal-it.nl with a parameter from an ApplicationParameters file to make changes when I deploy this app to another environment. However, as far as I can see there's no override xml element available for Extension. How can this be done. See https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-service-model-schema for the schema definition

Upvotes: 1

Views: 453

Answers (2)

Diego Mendes
Diego Mendes

Reputation: 11361

AFAIK, is not possible to use replacement values on extensions, it might be in future releases.

The Extensions was an workaround to integrate Traefik with service fabric.

According to Traefik documentation, you can set these values via SF REST API

This blog post also gives a nice overview on how to use traefik on SF

The other approach you could take is using the traefik REST API: if you have control on your services, your service startup could call the traefik api and register itself, you would then add the settings to your service configuration like you would with normal settings.

Upvotes: 1

LoekD
LoekD

Reputation: 11470

As a workaround to using a parameter file, and if you use a release tool like VSTS, you can use a tokenizer to replace things for different environments. Or, on Linux, you could use something like sed + environment variables.

Upvotes: 1

Related Questions