diff --git a/spring-cloud-sleuth-samples/README.adoc b/spring-cloud-sleuth-samples/README.adoc index 602959205..3dc8573a0 100644 --- a/spring-cloud-sleuth-samples/README.adoc +++ b/spring-cloud-sleuth-samples/README.adoc @@ -35,9 +35,10 @@ image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-sleuth/master Instead of POSTing trace data directly to a Zipkin server, you can export them over https://raw.githubusercontent.com/spring-cloud/spring-cloud-stream[Spring Cloud Stream]. -1. Build the Zipkin Stream sample with Maven and run it via its `docker-compose.yml` (which also starts the required middleware and the Zipkin UI). +1. Run the RabbitMQ middleware for Zipkin (you can use `docker-compose.yml`). +2. Build the Zipkin Stream sample with Maven and run it. 7. Run the `spring-cloud-sleuth-sample-stream` app and interact with it in a browser, just like the vanilla sample. If you are using a VM to run docker you might need to tunnel port 5672 to localhost, or change the `spring.rabbbitmq.host`. -9. Go to `http://localhost:9411` for Zipkin's UI (if you are using boot2docker the host will be different) +9. Go to `http://localhost:9411` for Zipkin's UI The UI should look more or less like this: diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/Dockerfile b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/Dockerfile deleted file mode 100644 index 840422f69..000000000 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM springio/java8 -RUN chmod 777 -R /tmp -VOLUME /tmp -VOLUME /app -EXPOSE 9411 8000 -RUN groupadd -g 1000 spring -RUN useradd -u 1000 -g 1000 -ms /bin/bash spring -VOLUME /home/spring -ENV HOME /home/spring -USER spring -WORKDIR /app/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream -CMD ["../../mvnw", "spring-boot:run"] diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/README.md b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/README.md index c708acf8c..d91373fcb 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/README.md +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/README.md @@ -1,15 +1,26 @@ # Running a Zipkin Server -There are 3 parts to Zipkin: the instrumented client apps, the backend database and the Zipkin server. The database for this implementation is MySQL. +There are 3 parts to Zipkin: + +- the instrumented client apps +- the backend database (defaults to in-memory db) +- the Zipkin server ## Zipkin Services -Run this app using the docker-compose provided. +Run the Zipkin (remember to have RabbitMQ running) by + +either running Spring Boot Maven plugin: ``` -$ docker-compose build zipkin -$ docker-compose up -... +./mvnw spring-boot:run --projects spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream +``` + +or running the packaged app from the root: + +``` +./mvnw package --projects spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream +java -jar spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/target/spring-cloud-sleuth-sample-zipkin-stream-1.0.0.BUILD-SNAPSHOT-exec.jar ``` and test it @@ -19,12 +30,10 @@ $ curl localhost:9411/api/v1/services ["zipkin-query"] ``` -The app might fail to start if mysql is not available when it needs it. If that happens you can just start it separately: just keep running `docker-compose up` until it works. - - ## Instrumenting Apps -Depend on [Spring Cloud Sleuth Stream](https://github.com/spring-cloud-spring-cloud-sleuth) and the rabbit binder (`spring-cloud-starter-stream-rabbit`). +Depend on [Spring Cloud Sleuth Stream](https://github.com/spring-cloud-spring-cloud-sleuth) and the +rabbit binder (`spring-cloud-starter-stream-rabbit`). Once the apps start publishing spans they will appear in the span store as well. @@ -33,5 +42,5 @@ Once the apps start publishing spans they will appear in the span store as well. You can run this app in an IDE and still use docker-compose to create the middleware: ``` -$ docker-compose up rabbitmq mysql +$ docker-compose up rabbitmq ``` diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/docker-compose.yml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/docker-compose.yml index 9fbbd6072..ed5568055 100644 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/docker-compose.yml +++ b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin-stream/docker-compose.yml @@ -1,31 +1,7 @@ -mysql: - image: mysql - ports: - - 3306:3306 - environment: - - MYSQL_ROOT_PASSWORD=root - - MYSQL_DATABASE=test rabbitmq: image: rabbitmq:management expose: - 5672 ports: - 5672:5672 - - 15672:15672 -zipkin: - build: . - volumes: - - ../..:/app - - ~:/home/spring - environment: - - MYSQL_HOST=mysql - - RABBIT_HOST=rabbitmq - # - JAVA_OPTS=your jvm params here - ports: - # Historical port used for the Zipkin HTTP Api - - 9411:9411 - # Zipkin UI used to be on a separate process listening on port 8080 - - 8080:9411 - links: - - mysql - - rabbitmq + - 15672:15672 \ No newline at end of file diff --git a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin/docker-compose.yml b/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin/docker-compose.yml deleted file mode 100644 index 9b9419f40..000000000 --- a/spring-cloud-sleuth-samples/spring-cloud-sleuth-sample-zipkin/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '2' - -services: - storage: - image: openzipkin/zipkin-mysql:1.39.3 - container_name: mysql - ports: - - 3306:3306 - query: - image: openzipkin/zipkin-java:0.11.0 - environment: - - STORAGE_TYPE=mysql - - MYSQL_HOST=mysql - ports: - # Listen port for the Scribe transport - - 9410:9410 - # Historical port used for the Zipkin HTTP Api - - 9411:9411 - # Zipkin UI used to be on a separate process listening on port 8080 - - 8080:9411 - depends_on: - - storage diff --git a/spring-cloud-sleuth-zipkin/docker-compose.yml b/spring-cloud-sleuth-zipkin/docker-compose.yml deleted file mode 100644 index 9b9419f40..000000000 --- a/spring-cloud-sleuth-zipkin/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '2' - -services: - storage: - image: openzipkin/zipkin-mysql:1.39.3 - container_name: mysql - ports: - - 3306:3306 - query: - image: openzipkin/zipkin-java:0.11.0 - environment: - - STORAGE_TYPE=mysql - - MYSQL_HOST=mysql - ports: - # Listen port for the Scribe transport - - 9410:9410 - # Historical port used for the Zipkin HTTP Api - - 9411:9411 - # Zipkin UI used to be on a separate process listening on port 8080 - - 8080:9411 - depends_on: - - storage