Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
4754a1e1
Commit
4754a1e1
authored
Feb 13, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
an attempt at some sidecar documentation
fixes gh-201
parent
fc7cc491
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
0 deletions
+99
-0
spring-cloud-netflix.adoc
docs/src/main/asciidoc/spring-cloud-netflix.adoc
+99
-0
No files found.
docs/src/main/asciidoc/spring-cloud-netflix.adoc
View file @
4754a1e1
...
...
@@ -824,3 +824,101 @@ still specified by configuring "zuul.routes.*", but there is no service discover
----
maps all paths in "/api/**" to the Zuul filter chain.
=== Polyglot support with Sidecar
Do you have non-jvm languages you want to take advantage of Eureka, Ribbon and
Config Server? The Spring Cloud Netflix Sidecar was inspired by
https://github.com/Netflix/Prana[Netflix Prana]. It includes a simple http api
to get all of the instances (ie host and port) for a given service. You can
also proxy service calls through an embedded Zuul proxy which gets its route
entries from Eureka. The Spring Cloud Config Server can be accessed directly
via host lookup or through the Zuul Proxy. The non-jvm app should implement
a health check so the Sidecar can report to eureka if the app is up or down.
To enable the Sidecar, create a Spring Boot application with `@EnableSidecar`.
This annotation includes `@EnableCircuitBreaker`, `@EnableDiscoveryClient`,
and `@EnableZuulProxy`. Run the resulting application on the same host as the
non-jvm application.
To configure the side car add `sidecar.port` and `sidecar.health-uri` to `application.yml`.
The `sidecar.port` property is the port the non-jvm app is listening on. This
is so the Sidecar can properly register the app with Eureka. The `sidecar.health-uri`
is a uri accessible on the non-jvm app that mimicks a Spring Boot health
indicator. It should return a json document like the following:
.health-uri-document
[source,json]
----
{
"status":"UP"
}
----
Here is an example application.yml for a Sidecar application:
.application.yml
[source,yaml]
----
server:
port: 5678
spring:
application:
name: sidecar
sidecar:
port: 8000
health-uri: http://localhost:8000/health.json
----
The api for the `DiscoveryClient.getInstances()` method is `/hosts/{serviceId}`.
Here is an example response for `/hosts/customers` that returns two instances on
different hosts. This api is accessible to the non-jvm app (if the sidecar is
on port 5678) at `http://localhost:5678/hosts/{serviceId}`.
./hosts/customers
[source,json]
----
[
{
"host": "myhost",
"port": 9000,
"uri": "http://myhost:9000",
"serviceId": "CUSTOMERS",
"secure": false
},
{
"host": "myhost2",
"port": 9000,
"uri": "http://myhost2:9000",
"serviceId": "CUSTOMERS",
"secure": false
}
]
----
The Zuul proxy automatically adds routes for each service known in eureka to
`/<serviceId>`, so the customers service is available at `/customers`. The
Non-jvm app can access the customer service via `http://localhost:5678/customers`
(assuming the sidecar is listening on port 5678).
If the Config Server is registered with Eureka, non-jvm application can access
it via the Zuul proxy. If the serviceId of the ConfigServer is `configserver`
and the Sidecar is on port 5678, then it can be accessed at
http://localhost:5678/configserver
Non-jvm app can take advantage of the Config Server's ability to return YAML
documents. For example, a call to http://sidecar.local.spring.io:5678/configserver/default-master.yml
might result in a YAML document like the following
[source,yaml]
----
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
password: password
info:
description: Spring Cloud Samples
url: https://github.com/spring-cloud-samples
----
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment