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

feat: Added kafka service #1565

Merged
merged 13 commits into from
Nov 15, 2024
Merged

feat: Added kafka service #1565

merged 13 commits into from
Nov 15, 2024

Conversation

Alexnortung
Copy link
Contributor

Here is a rough implementation of a kafka service for devenv.

I think there are definetely place for configuration options. but I am not sure how we can implement this properly. So feedback would be appreciated :)

closes #1563

@Alexnortung Alexnortung changed the title feat: WIP: Added kafka feat: Added kafka Oct 31, 2024
@Alexnortung Alexnortung changed the title feat: Added kafka feat: Added kafka service Oct 31, 2024
@Alexnortung
Copy link
Contributor Author

Update: I have added initial connectors to kafka connect, but they don't seem to persist when i restart kafka connect, not sure why.

@Alexnortung
Copy link
Contributor Author

Okay, I figured it out, you could just pass the connectors to the start command

@sandydoo
Copy link
Member

Take a look at https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/misc/apache-kafka.nix. You should be able to reuse large parts of this, particularly the config/settings handling, and ideally keep a similar interface.

@Alexnortung
Copy link
Contributor Author

Alexnortung commented Nov 1, 2024

Hey @sandydoo thanks for the feedback!
I have now used many of the options provided in the NixOS module. However I have tweaked some defaults, so that it just works without having the user configure anything but enable = true.

I probably also need to create settings for kafka connect.

I would also like to have some kind of readiness probe for kafka.

TODO:

  • settings for kafka connect
  • readiness probe for kafka
  • make kafka connect start after kafka

@Alexnortung Alexnortung marked this pull request as draft November 1, 2024 10:03
@sandydoo
Copy link
Member

sandydoo commented Nov 1, 2024

However I have tweaked some defaults, so that it just works without having the user configure anything but enable = true.

That's the right approach.

@Alexnortung, is there a basic test we could add for this to make sure it launches? I'm not familiar with Kafka, but maybe a ping/healthcheck/queue-unqueue type of thing. See the examples and tests directories.

@Alexnortung
Copy link
Contributor Author

Hi @sandydoo I have Added settings to kafka connect and added a test for kafka.
I also wanted to add readiness probe to kafka, but it seems like something weird is going on when you add readiness probe to the service. Do you have any suggestions?

@Alexnortung Alexnortung marked this pull request as ready for review November 1, 2024 12:25
@@ -0,0 +1,3 @@
set -e

kafka-topics.sh --list --bootstrap-server localhost:9092
Copy link
Member

Choose a reason for hiding this comment

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

Where does kafka-topics.sh come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's part of the apacheKafka package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you prefer we could probably also do a curl since the script is probably just calling an endpoint in kafka

Copy link
Member

Choose a reason for hiding this comment

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

yeah let's do just curl

Copy link
Contributor Author

@Alexnortung Alexnortung Nov 14, 2024

Choose a reason for hiding this comment

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

I'm sorry, after looking at the docs, it looks like it is only kafka connect which got a REST API, not Kafka.
Is there any issues in using their own client?

@Alexnortung
Copy link
Contributor Author

Am I missing something since the github actions are failing?

@domenkozar
Copy link
Member

Am I missing something since the github actions are failing?

some of them fail, but you'll see kafka being run in the test action

@Alexnortung
Copy link
Contributor Author

I have now also added readiness probes for kafka and kafka connect. I have also added kafka as a dependency to kafka connect, so that kafka connect doesn't fail to start if kafka is not started correctly or is using more time than usual.

@domenkozar domenkozar merged commit 9dba449 into cachix:main Nov 15, 2024
256 of 275 checks passed
@Alexnortung Alexnortung deleted the kafka branch November 15, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apache Kafka service
3 participants