Skip to content

Commit

Permalink
docker: uses Armeria for end-to-end Eureka example (#3691)
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
codefromthecrypt authored Jan 14, 2024
1 parent a882a22 commit 87ec1c1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docker/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ You can register Zipkin for service discovery in [Eureka](../test-images/zipkin-
using the `docker-compose-eureka.yml` file. This configuration starts `zipkin` and `zipkin-eureka`
in their own containers.

To register Zipkin in Eureka, run:
When `zipkin` starts, it registers its endpoint into `eureka`. Then, the two [example services](#example)
discover zipkin's endpoint from `eureka` and use it to send spans.

To try this out, run:
```bash
$ docker-compose -f docker-compose-eureka.yml up
$ docker-compose -f docker-compose.yml -f docker-compose-eureka.yml up
```

## Example
Expand Down
27 changes: 27 additions & 0 deletions docker/examples/docker-compose-eureka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,33 @@ services:
service: zipkin
environment:
- EUREKA_SERVICE_URL=http://eureka:8761/eureka/v2
- EUREKA_HOSTNAME=zipkin
depends_on:
eureka:
condition: service_healthy

# Generate traffic by hitting http://localhost:8081
frontend:
image: ghcr.io/openzipkin/brave-example:armeria
container_name: frontend
entrypoint: start-frontend
environment:
- EUREKA_SERVICE_URL=http://eureka:8761/eureka/v2
ports:
- 8081:8081
depends_on:
backend:
condition: service_healthy
zipkin:
condition: service_healthy

# Serves the /api endpoint the frontend uses
backend:
image: ghcr.io/openzipkin/brave-example:armeria
container_name: backend
entrypoint: start-backend
environment:
- EUREKA_SERVICE_URL=http://eureka:8761/eureka/v2
depends_on:
zipkin:
condition: service_healthy
4 changes: 4 additions & 0 deletions zipkin-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ Example usage:
$ EUREKA_SERVICE_URL=http://localhost:8761/eureka/v2 java -jar zipkin.jar
```

If you are using a containerized environment, you may need to set `EUREKA_HOSTNAME` to avoid
detecting the wrong hostname. For example, if using docker-compose, set `EUREKA_HOSTNAME` to
zipkin's `container_name`.

Note: Eureka server registration only includes host and port details. Tracers need to resolve this
to the POST endpoint "/api/v2/spans".

Expand Down

0 comments on commit 87ec1c1

Please sign in to comment.