|
1 | 1 | # gRPC spring boot starter Examples
|
2 | 2 |
|
3 |
| -## Local Mode |
| 3 | +## Local Setup |
4 | 4 |
|
5 | 5 | 1. Try the local-grpc-server example first run:
|
6 | 6 |
|
|
16 | 16 |
|
17 | 17 | 3. Visit http://localhost:8080/ to see the result.
|
18 | 18 |
|
19 |
| -## Cloud Mode |
| 19 | +## Cloud Discovery Setup |
20 | 20 |
|
21 |
| -1. Try the cloud-eureka-server example first run: |
| 21 | +1. Choose a cloud discovery implementation: |
| 22 | + |
| 23 | + - `consul` |
| 24 | + - `eureka` |
| 25 | + - `nacos` |
| 26 | + |
| 27 | + > **Note:** In your actual application you are free to choose any cloud discovery implementation, |
| 28 | + > but only the above and `zookeeper` will automatically register the server at the discovery service. |
| 29 | + > So you might have to write a few extra lines in your server application. |
| 30 | + > Generic registration support is planned for a future release. |
| 31 | + > No additional configuration is required for clients. |
| 32 | + |
| 33 | +2. Start the discovery server (only the chosen one): |
22 | 34 |
|
23 | 35 | ````sh
|
| 36 | + # Consul |
| 37 | + docker run --name=consul -p 8500:8500 consul |
| 38 | + # Eureka |
24 | 39 | ./gradlew :example:cloud-eureka-server:bootRun
|
| 40 | + # Nacos |
| 41 | + docker run --env MODE=standalone --name nacos -d --rm -p 8848:8848 nacos/nacos-server |
25 | 42 | ````
|
26 | 43 |
|
27 |
| -2. Run zipkin-server |
28 |
| - |
29 |
| - https://github.com/openzipkin/zipkin#quick-start |
30 |
| - |
31 |
| -3. In a different terminal window run: |
| 44 | +3. Insert the selected implementation and start the server application (in a new terminal window): |
32 | 45 |
|
33 | 46 | ````sh
|
34 |
| - ./gradlew :example:cloud-grpc-server:bootRun |
| 47 | + ./gradlew -Pdiscovery=$discovery :example:cloud-grpc-server:bootRun |
35 | 48 | ````
|
36 | 49 |
|
37 |
| -4. In a different terminal window run: |
| 50 | +4. Insert the selected implementation and start the client application (in a new terminal window): |
38 | 51 |
|
39 | 52 | ````sh
|
40 |
| - ./gradlew :example:cloud-grpc-client:bootRun |
| 53 | + ./gradlew -Pdiscovery=$discovery :example:cloud-grpc-client:bootRun |
41 | 54 | ````
|
42 | 55 |
|
43 | 56 | 5. Visit http://localhost:8080/ to see the result.
|
|
0 commit comments