Testing Azure Service Fabric on macOS using Docker

68 Views Asked by At

I am on a MacBook and have deployed a Node.js application as a Guest Executable to Azure Service Fabric. I've done that following the Set up your development environment on macOS X Azure guide.

I can access the Service Fabric Explorer and the application looks to have been deployed, but I am unclear on how to test it or where to access the logs to confirm the application is in fact running.

Service Fabric Explorer

I am familiar enough with Docker but not Service Fabric. Any guidance on how I could test the service through Postman or access the service logs to validate it is running? Attempting to hit the service using http://172.17.0.2:3000/api/ fails to connect and there is little documentation on accessing logs for a service instance.

For more context, I started Service Fabric using the below command and configured forwarding port 3000, which is what my service runs on.

docker run --name sftestcluster -d -v /var/run/docker.sock:/var/run/docker.sock -p 19080:19080 -p 19000:19000 -p 3000:3000 -p 25100-25200:25100-25200 mcr.microsoft.com/service-fabric/onebox:u18

ServiceManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="Experience_ServicePkg" Version="1.0.0"
                 xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
   <ServiceTypes>
      <StatelessServiceType ServiceTypeName="Experience_ServiceType" UseImplicitHost="true">
   </StatelessServiceType>
   </ServiceTypes>
   
   <CodePackage Name="code" Version="1.0.0">
      <SetupEntryPoint>
         <ExeHost>
            <Program>npm-install.sh</Program>
         </ExeHost>
      </SetupEntryPoint>
      <EntryPoint>
         <ExeHost>
            <Program>start.sh</Program>
            <WorkingFolder>CodeBase</WorkingFolder>
            <ConsoleRedirection FileRetentionCount="5" FileMaxSizeInKb="2048"/>
         </ExeHost>
      </EntryPoint>
   </CodePackage>
   <Resources>
      <Endpoints>
         <Endpoint Name="Experience_ServiceTypeEndpoint" Protocol="http" Port="3000"  UriScheme="http" PathSuffix="api/" Type="Input" />
      </Endpoints>
   </Resources>
 </ServiceManifest>

ApplicationManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest  ApplicationTypeName="Service_Fabric_Hello_WorldType" ApplicationTypeVersion="1.0.0"
                      xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   
   <ServiceManifestImport>
      <ServiceManifestRef ServiceManifestName="Experience_ServicePkg" ServiceManifestVersion="1.0.0" />
   </ServiceManifestImport>
   
   <DefaultServices>
      <Service Name="Experience_Service">
         <StatelessService ServiceTypeName="Experience_ServiceType" InstanceCount="3">
            <SingletonPartition />
         </StatelessService>
      </Service>
   </DefaultServices>
   
</ApplicationManifest>
0

There are 0 best solutions below