Kafka in Python with Gramine-SGX #1709
dimakuv
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I recently tried Apache Kafka with Kafka Python (
confluent-kafkaPython package).Latest Gramine (v1.6) works without any problems, at least on the example Kafka Producer and Kafka Consumer Python scripts that I was given.
Here I'll describe how to adapt our existing Python CI example to Kafka Python. Unfortunately I was given a private Kafka instance, with closed-source Python scripts. So I anonymize these parts.
Preparation
I tried on Ubuntu 20.04, with Gramine v1.6. First, install Kafka:
# sudo needed to install into system-wide Python dirs where Gramine Python example looks for files $ sudo pip3 install confluent-kafkaFor Kafka Python example, I copy-pasted the existing Gramine Python example into a new dir:
There are the new files I added:
The
kafka-consumer.pyscript basically does this:The
kafka-producer.pyscript basically does this:Gramine manifest
The manifest is modified like this:
NOTE: Many parts of the original Python manifest can be removed, as they are not required by Kafka. Left as an exercise for readers.
Running
I ran my example scripts like this:
gramine-sgx python scripts/kafka-producer.py \ --auth kafka-ca.pem kafka-user.pem kafka-user.key <passphrase> \ <kafka-broker-address>:9092 TestTopic example.jsongramine-sgx python scripts/kafka-consumer.py \ --auth kafka-ca.pem kafka-user.pem kafka-user.key <passphrase> \ <kafka-broker-address>:9092 INTEL latest TestTopicBeta Was this translation helpful? Give feedback.
All reactions