mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 19:30:49 +08:00 
			
		
		
		
	Make Ocelot work with service fabric DNS and naming service for guest exe and stateless (#242)
* test for issue * added service fabric sample * working!! * changed sample naming to Ocelot * removed files we dont need * removed files we dont need * updated sample gitignore * updated sample gitignore * getting ocelot to work with service fabric using the reverse proxy * #238 - added support for service fabric discovery provider, proxies requests through naming service, wont work on partioned service fabric services yet * #238 - Manually tested service fabric using sample..all seems OK. Made some changes after testing, added docs * #238 - added docs for servic fabric
This commit is contained in:
		@@ -6,16 +6,18 @@ for the downstream service Ocelot is forwarding a request to. At the moment this
 | 
			
		||||
GlobalConfiguration section which means the same service discovery provider will be used for all ReRoutes
 | 
			
		||||
you specify a ServiceName for at ReRoute level. 
 | 
			
		||||
 | 
			
		||||
At the moment the only supported service discovery provider is Consul. The following is required in the 
 | 
			
		||||
GlobalConfiguration. The Provider is required and if you do not specify a host and port the Consul default
 | 
			
		||||
Consul
 | 
			
		||||
^^^^^^
 | 
			
		||||
 | 
			
		||||
The following is required in the GlobalConfiguration. The Provider is required and if you do not specify a host and port the Consul default
 | 
			
		||||
will be used.
 | 
			
		||||
 | 
			
		||||
.. code-block:: json
 | 
			
		||||
 | 
			
		||||
    "ServiceDiscoveryProvider": {
 | 
			
		||||
            "Host": "localhost",
 | 
			
		||||
            "Port": 9500
 | 
			
		||||
        }
 | 
			
		||||
        "Host": "localhost",
 | 
			
		||||
        "Port": 9500
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
In the future we can add a feature that allows ReRoute specfic configuration. 
 | 
			
		||||
 | 
			
		||||
@@ -35,4 +37,4 @@ and LeastConnection algorithm you can use. If no load balancer is specified Ocel
 | 
			
		||||
        "UseServiceDiscovery": true
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
When this is set up Ocelot will lookup the downstream host and port from the service discover provider and load balance requests across any available services.
 | 
			
		||||
When this is set up Ocelot will lookup the downstream host and port from the service discover provider and load balance requests across any available services.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								docs/features/servicefabric.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								docs/features/servicefabric.rst
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
Service Fabric
 | 
			
		||||
==============
 | 
			
		||||
 | 
			
		||||
If you have services deployed in Service Fabric you will normally use the naming service to access them.
 | 
			
		||||
 | 
			
		||||
The following example shows how to set up a ReRoute that will work in Service Fabric. The most important thing is the ServiceName which is made up of the 
 | 
			
		||||
Service Fabric application name then the specific service name. We also need to set UseServiceDiscovery as true and set up the ServiceDiscoveryProvider in 
 | 
			
		||||
GlobalConfiguration. The example here shows a typical configuration. It assumes service fabric is running on localhost and that the naming service is on port 19081.
 | 
			
		||||
 | 
			
		||||
The example below is taken from the samples folder so please check it if this doesnt make sense!
 | 
			
		||||
 | 
			
		||||
.. code-block:: json
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        "ReRoutes": [
 | 
			
		||||
            {
 | 
			
		||||
            "DownstreamPathTemplate": "/api/values",
 | 
			
		||||
            "UpstreamPathTemplate": "/EquipmentInterfaces",
 | 
			
		||||
            "UpstreamHttpMethod": [
 | 
			
		||||
                "Get"
 | 
			
		||||
            ],
 | 
			
		||||
            "DownstreamScheme": "http",
 | 
			
		||||
            "ServiceName": "OcelotServiceApplication/OcelotApplicationService",
 | 
			
		||||
            "UseServiceDiscovery" :  true
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "GlobalConfiguration": {
 | 
			
		||||
            "RequestIdKey": "OcRequestId",
 | 
			
		||||
            "ServiceDiscoveryProvider": {
 | 
			
		||||
                "Host": "localhost",
 | 
			
		||||
                "Port": 19081,
 | 
			
		||||
                "Type": "ServiceFabric"
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -22,6 +22,7 @@ Thanks for taking a look at the Ocelot documentation. Please use the left hand n
 | 
			
		||||
   features/routing
 | 
			
		||||
   features/requestaggregation
 | 
			
		||||
   features/servicediscovery
 | 
			
		||||
   features/servicefabric
 | 
			
		||||
   features/authentication
 | 
			
		||||
   features/authorisation
 | 
			
		||||
   features/administration
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user