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

dockerized wordcount example #17

Merged
merged 2 commits into from
Jul 19, 2017

Conversation

sebastianneubauer
Copy link

This add a docker-compose project to the wordcount example. Additionally to the native execution, the very same example can now be executed with docker in several services:

  • kafka: a kafka server
  • kafka-manager: a gui to see what is happening in kafka (configure the zookeeper: kafka:2181)
  • wordcount: the wordcount kafka streams example app
  • source_client: a trivial client which writes to kafka
  • kafka-debug: a trivial consumer for the kafka output stream of the wordcount example

If you like this, one can easily dockerize the other examples and even the integration tests can be automated using docker-compose

If you have any questions, just ask, this is an early demo, I am happy to incorporate any suggestions...

@ah-
Copy link
Contributor

ah- commented Jul 17, 2017

Cool, thanks! Will give this a go tomorrow.

#RUN pip install -e git+https://github.com/confluentinc/confluent-kafka-python.git#egg=confluent-kafka
RUN pip install -e ../../

CMD ["python", "source_client.py"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting this:

$ docker logs docker_source_client_1
python: can't open file 'source_client.py': [Errno 2] No such file or directory

I guess this file is just missing, could you add it?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, my fault...added now!


WORKDIR /code/examples/wordcount/
RUN pip --version
#RUN pip install -e git+https://github.com/confluentinc/confluent-kafka-python.git#egg=confluent-kafka
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably the pip install below should pull this in, do you remember why you have the commented out pip install confluent-kafka-python here?

Getting this:

$ docker logs docker_wordcount_1
Traceback (most recent call last):
  File "example.py", line 13, in <module>
    from winton_kafka_streams.processor import BaseProcessor, TopologyBuilder
  File "/code/winton_kafka_streams/processor/__init__.py", line 10, in <module>
    from ._stream_thread import StreamThread
  File "/code/winton_kafka_streams/processor/_stream_thread.py", line 10, in <module>
    from confluent_kafka import KafkaError
ModuleNotFoundError: No module named 'confluent_kafka'

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the reason this does not get pulled in automatically for us might be a quirk in our local setup @ah-

Copy link
Author

@sebastianneubauer sebastianneubauer Jul 19, 2017

Choose a reason for hiding this comment

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

confluent_kafka is a dependency in your setup.py, so with RUN pip install -e ../../ it should be pulled in...Can you find out if it doesn't get installed (add RUN pip freeze to the Dockerfile in the wordcount folder) or if there is a different problem? you can build the service with docker-compose build wordcount

Copy link
Contributor

@llawall llawall left a comment

Choose a reason for hiding this comment

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

This all runs and looks good and we are happy to merge as it is.

Thanks @sebastianneubauer !

@llawall llawall merged commit bac4048 into wintoncode:master Jul 19, 2017
@sebastianneubauer
Copy link
Author

Great thanks! If I have time I will look into the other examples too...
What about the tests, are there integration-tests that currently need a running kafka to succeed? That could be addressed by docker-compose too...

@sebastianneubauer sebastianneubauer deleted the dockerized_wordcount branch July 19, 2017 10:48
@ah-
Copy link
Contributor

ah- commented Jul 20, 2017

Yes, that sounds like a good idea. Initially was going to look at https://github.com/dpkp/kafka-python/blob/master/test/fixtures.py and https://github.com/edenhill/trivup and just re-use one of them, but Docker would make it a bit easier to get it to work reliably.

@llawall
Copy link
Contributor

llawall commented Jul 20, 2017

@sebastianneubauer : a quick note to say that we are considering requiring a CLA to be signed for contributions so I'll be in touch next week if this goes ahead.

Looking forward to your docker-compose based test harness - this will be a big help to ensure consistent testing.

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.

3 participants