Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: add pulsar example #3789

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test_readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,9 @@ jobs:
build-bin/docker/docker_test_image openzipkin/zipkin-rabbitmq:test
env:
DOCKER_FILE: docker/test-images/zipkin-rabbitmq/Dockerfile
- name: docker/test-images/zipkin-pulsar/README.md
run: |
build-bin/docker/docker_build openzipkin/zipkin-pulsar:test &&
build-bin/docker/docker_test_image openzipkin/zipkin-pulsar:test
env:
DOCKER_FILE: docker/test-images/zipkin-pulsar/Dockerfile
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ base layer `openzipkin/zipkin`, and setting up schema where relevant.
* [ghcr.io/openzipkin/zipkin-eureka](test-images/zipkin-eureka/README.md) - runs Eureka
* [ghcr.io/openzipkin/zipkin-kafka](test-images/zipkin-kafka/README.md) - runs both Kafka+ZooKeeper
* [ghcr.io/openzipkin/zipkin-mysql](test-images/zipkin-mysql/README.md) - runs MySQL initialized with Zipkin's schema
* [ghcr.io/openzipkin/zipkin-pulsar](test-images/zipkin-pulsar/README.md) - runs Pulsar
* [ghcr.io/openzipkin/zipkin-rabbitmq](test-images/zipkin-rabbitmq/README.md) - runs RabbitMQ
* [ghcr.io/openzipkin/zipkin-ui](test-images/zipkin-ui/README.md) - serves the (Lens) UI directly with NGINX

Expand Down
12 changes: 12 additions & 0 deletions docker/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ $ docker compose -f docker-compose-rabbitmq.yml up
Then configure the [RabbitMQ sender](https://github.com/openzipkin/zipkin-reporter-java/blob/master/amqp-client/src/main/java/zipkin2/reporter/amqp/RabbitMQSender.java)
using a `host` value of `localhost` or a non-local hostname if in docker.


## Pulsar
reta marked this conversation as resolved.
Show resolved Hide resolved

You can collect traces from [Pulsar](../test-images/zipkin-pulsar/README.md) in addition to HTTP, using the
`docker-compose-pulsar.yml` file. This configuration starts `zipkin` and `zipkin-pulsar` in their
own containers.

To add Pulsar configuration, run:
```bash
$ docker compose -f docker-compose-pulsar.yml up
```

## Eureka

You can register Zipkin for service discovery in [Eureka](../test-images/zipkin-eureka/README.md)
Expand Down
36 changes: 36 additions & 0 deletions docker/test-images/zipkin-pulsar/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Copyright The OpenZipkin Authors
# SPDX-License-Identifier: Apache-2.0
#

# Use latest from https://hub.docker.com/r/apachepulsar/pulsar/tags
ARG pulsar_version=4.0.2

# We copy files from the context into a scratch container first to avoid a problem where docker and
# docker compose don't share layer hashes https://github.com/docker/compose/issues/883 normally.
# COPY --from= works around the issue.
FROM scratch as scratch

WORKDIR /docker-bin
COPY build-bin/docker/docker-healthcheck /docker-bin/

ARG pulsar_version

FROM apachepulsar/pulsar:${pulsar_version} as zipkin-pulsar
LABEL pulsar-version=$pulsar_version
LABEL org.opencontainers.image.description="Apache Pulsar on Alpine Linux"

# Add HEALTHCHECK and ENTRYPOINT scripts into the default search path
COPY --from=scratch /docker-bin/* /usr/local/bin/
# We use start period of 30s to avoid marking the container unhealthy on slow or contended CI hosts
HEALTHCHECK --interval=1s --start-period=30s --timeout=5s CMD ["docker-healthcheck"]

# Usually, we read env set from pid 1 to get docker-healthcheck parameters.
# However, pulsar-server has to start as root even if permissions are dropped
# later. So, we expose it in the Dockerfile instead.
ENV HEALTHCHECK_PORT=8080
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we check the service port 6650 (esp if we are using tcp)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified it to HTTP on port 8080, which is enough for the healthcheck.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok mainly I was concerned about race condition where 8080 is ready, but service port not. If this becomes a problem we can revisit

ENV HEALTHCHECK_KIND=http
ENV HEALTHCHECK_PATH=/admin/v2/clusters/standalone
ENV PULSAR_LOG_ROOT_LEVEL=WARN
EXPOSE 8080 6650
CMD ["bin/pulsar", "standalone"]
10 changes: 10 additions & 0 deletions docker/test-images/zipkin-pulsar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## zipkin-pulsar Docker image

The `zipkin-pulsar` testing image runs Pulsar for Pulsar collector integration.

To build `openzipkin/zipkin-pulsar:test`, from the top-level of the repository, run:
```bash
$ DOCKER_FILE=docker/test-images/zipkin-pulsar/Dockerfile build-bin/docker/docker_build openzipkin/zipkin-pulsar:test
```

You can use the env variable `PULSAR_LOG_ROOT_LEVEL` to change the log level for Pulsar. Defaults to "WARN".
Loading