简体   繁体   中英

How do I set a valid ServiceDnsName in my docker-compose file when deploying to Service Fabric?

I am attempting to configure CI/CD in Visual Studio Team Services to a Service Fabric cluster from a docker-compose file, but in the last step of my release definition, using the step "Service Fabric Compose Deploy", I'm getting the error: ##[error]The ServiceDnsName for DefaultService 'myapp' is invalid. . The guide I'm using has a section that says:

If the service name that you specify in a Compose file is a fully qualified domain name (that is, it contains a dot [.]), the DNS name registered by Service Fabric is <ServiceName> (including the dot). If not, each path segment in the application name becomes a domain label in the service DNS name, with the first path segment becoming the top-level domain label.

For example, if the specified application name is fabric:/SampleApp/MyComposeApp, <ServiceName>.MyComposeApp.SampleApp would be the registered DNS name.

My current docker-compose file is:

version: '3'

services:
  myapp:
    image: myapp
    build:
      context: .\myapp
      dockerfile: Dockerfile

In the VSTS definition, the Application Name is set as fabric:/myapp .

How do I fix this? Ideally I would like my app to be accessible at yourendpointhere.eastus.cloudapp.azure.com/myapp . Is this possible?

Here's the log entry for the release step failure:

2018-02-14T18:30:00.8056376Z ##[section]Starting: Deploy docker-compose application to a Service Fabric cluster
2018-02-14T18:30:00.8060539Z ==============================================================================
2018-02-14T18:30:00.8060913Z Task         : Service Fabric Compose Deploy
2018-02-14T18:30:00.8061507Z Description  : Deploy a docker-compose application to a Service Fabric cluster.
2018-02-14T18:30:00.8061986Z Version      : 0.2.3
2018-02-14T18:30:00.8062279Z Author       : Microsoft Corporation
2018-02-14T18:30:00.8063154Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=847030)
2018-02-14T18:30:00.8063536Z ==============================================================================
2018-02-14T18:30:07.8698092Z Searching for path: D:\a\r1\a\**\docker-compose.yml
2018-02-14T18:30:07.8725249Z Found path: D:\a\r1\a\Drop\docker-compose\docker-compose.yml
2018-02-14T18:30:07.9023293Z Checking compose file
2018-02-14T18:30:16.8571892Z ##[warning]The Docker compose file contains the following 'keys' which are not supported. They will be ignored. 
'build' 
2018-02-14T18:30:17.1220353Z Imported cluster client certificate with thumbprint 'THUMBPRINT_REDACTED'.
2018-02-14T18:30:17.1899791Z 
2018-02-14T18:30:17.1907044Z Thumbprint                                Subject                                                                      
2018-02-14T18:30:17.1908148Z ----------                                -------                                                                      
2018-02-14T18:30:17.1909375Z THUMBPRINT_REDACTED                       CN=eastus.cloudapp.azure.com                                  
2018-02-14T18:30:23.8293246Z Successfully connected to cluster.
2018-02-14T18:30:23.8391402Z Encrypting the password with the Server Certificate.
2018-02-14T18:30:25.1024103Z ##[warning]The cluster's server certificate with thumbprint '********' is required in order to encrypt text but the certificate could not be found on the agent machine in the 'CurrentUser\My' certificate store location.
2018-02-14T18:30:25.7091733Z Creating application
2018-02-14T18:30:29.7025507Z ##[error]The ServiceDnsName for DefaultService 'myapp' is invalid.
FileName: D:\SvcFab\IB\131631066259308291\2fve3lf5.5tp\ApplicationManifest.xml
2018-02-14T18:30:29.9330549Z ##[section]Finishing: Deploy docker-compose application to a Service Fabric cluster

With the help of Microsoft support I was able to solve this issue.

The Application name was the problem. If you remove the "fabric:/" part of the application name it worked for me.

It is a documentation error. Microsoft support will update the documentation

At least now the VSTS steps works and is deployed to Service Fabric. I now get some errors in the Service Fabric itself but that is for another question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM