Telefonica / prometheus-kafka-adapter

Use Kafka as a remote storage database for Prometheus (remote write only)
Apache License 2.0
364 stars 135 forks source link

Describe better build pattern #59

Closed johnseekins closed 3 years ago

johnseekins commented 3 years ago

With confluent-kafka-go and librdkafka, we can still build a static binary that is re-distributable. It just requires adding the -tags static switch to the build command.

palmerabollo commented 3 years ago

Thanks John for your first contribution. @jpfe-tid what do you think?

johnseekins commented 3 years ago

Generally, I'd argue updating to a newer version of confluent-kafka-go would be good. I guess with >=1.4 you no longer need to package librdkafka yourself?

jpfe-tid commented 3 years ago

Thanks @johnseekins.

Generally, I'd argue updating to a newer version of confluent-kafka-go would be good. I guess with >=1.4 you no longer need to package librdkafka yourself?

Agree on that. I prefer to update confluent-kafka-go and keep the build process minimal.

Even after the changes proposed at #61, I can't build your PR. Here is the log:

Step 6/10 : RUN go build -tags static -o /prometheus-kafka-adapter
 ---> Running in 6867ff88d562
# github.com/confluentinc/confluent-kafka-go/kafka
gcc: error: /usr/lib/librdkafka-static.a: No such file or directory
The command '/bin/sh -c go build -tags static -o /prometheus-kafka-adapter' returned a non-zero code: 2
jpfe-tid commented 3 years ago

@johnseekins I sent PR #63 which updates confluent-kafka-go to 1.6.1. it required switching build base image from alpine to debian buster.

johnseekins commented 3 years ago

This is much better than what I did. Great!

jpfe-tid commented 3 years ago

@johnseekins please help us trying the proposed changes looking for stability issues. Thanks for being a prometheus-kafka-adapter user 🙂