Skip to content

Commit

Permalink
docs: simplify setup
Browse files Browse the repository at this point in the history
  • Loading branch information
snandam committed Sep 4, 2024
1 parent 63227ff commit 0d8212a
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ services:
container_name: application_team-consumer
build:
context: .
dockerfile: kafka_client.dockerfile
dockerfile: ../kafka_client.dockerfile
args:
OCKAM_VERSION: ${OCKAM_VERSION:-latest}
volumes:
- ./ockam-node.yaml:/ockam-node.yaml
environment:
ENROLLMENT_TICKET: ${CONSUMER_ENROLLMENT_TICKET:-}
OCKAM_DEVELOPER: ${OCKAM_DEVELOPER:-false}
Expand All @@ -22,7 +24,14 @@ services:
command:
- -c
- (
sleep 14;
set -e

sleep 10

ockam node create ./ockam-node.yaml --enrollment-ticket $${ENROLLMENT_TICKET} &

sleep 14

echo "";
echo "Messages sent from producers will appear shortly.";
echo "It may take a couple of minutes for the first message to appear.";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
relay: consumer
# Declare Kafka Inlet, bind on localhost.
# The destination is the 'redpanda_outlet_node' node, reachable through
# the project relay named 'redpanda'.
kafka-inlet:
from: 127.0.0.1:9092
to: /project/default/service/forward_to_redpanda/secure/api
avoid-publishing: true
encrypted-field: pii
allow-producer: producer
allow: redpanda

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,44 @@ services:
container_name: application_team-producer
build:
context: .
dockerfile: kafka_client.dockerfile
dockerfile: ../kafka_client.dockerfile
volumes:
- ./ockam-node.yaml:/ockam-node.yaml
environment:
ENROLLMENT_TICKET: ${PRODUCER_ENROLLMENT_TICKET:-}
OCKAM_DEVELOPER: ${OCKAM_DEVELOPER:-false}
networks:
- application_team
command:
- -c
- (
MESSAGES=(
'{"id":"1234","first_name":"Red","age":22,"job":"writer","pii":{"last_name":"Jones","ssn":"777-223-4344","zip":98208}}'
'{"id":"5678","first_name":"Blue","age":35,"job":"developer","pii":{"last_name":"Smith","ssn":"555-867-5309","zip":10001}}'
'{"id":"9012","first_name":"Green","age":28,"job":"designer","pii":{"last_name":"Johnson","ssn":"123-456-7890","zip":60601}}'
'{"id":"3456","first_name":"Yellow","age":41,"job":"manager","pii":{"last_name":"Brown","ssn":"999-888-7777","zip":90210}}'
'{"id":"7890","first_name":"Purple","age":19,"job":"student","pii":{"last_name":"Davis","ssn":"111-222-3333","zip":20001}}'
'{"id":"2345","first_name":"Orange","age":55,"job":"consultant","pii":{"last_name":"Wilson","ssn":"444-555-6666","zip":75001}}'
'{"id":"6789","first_name":"Pink","age":33,"job":"artist","pii":{"last_name":"Taylor","ssn":"888-999-0000","zip":80202}}'
'{"id":"0123","first_name":"Gray","age":47,"job":"scientist","pii":{"last_name":"Anderson","ssn":"222-333-4444","zip":94103}}'
);
sleep 20;
for n in {0..7}; do
sleep 2;
echo -n $${MESSAGES[n]} | kafka-console-producer.sh
--topic demo
--bootstrap-server 127.0.0.1:9092
--producer-property request.timeout.ms=30000;
done;
tail -f /dev/null
- |
set -e
sleep 17
ockam node create -vv ./ockam-node.yaml --enrollment-ticket $${ENROLLMENT_TICKET} &
sleep 20
MESSAGES=(
'{"id":"1234","first_name":"Red","age":22,"job":"writer","pii":{"last_name":"Jones","ssn":"777-223-4344","zip":98208}}'
'{"id":"5678","first_name":"Blue","age":35,"job":"developer","pii":{"last_name":"Smith","ssn":"555-867-5309","zip":10001}}'
'{"id":"9012","first_name":"Green","age":28,"job":"designer","pii":{"last_name":"Johnson","ssn":"123-456-7890","zip":60601}}'
'{"id":"3456","first_name":"Yellow","age":41,"job":"manager","pii":{"last_name":"Brown","ssn":"999-888-7777","zip":90210}}'
'{"id":"7890","first_name":"Purple","age":19,"job":"student","pii":{"last_name":"Davis","ssn":"111-222-3333","zip":20001}}'
'{"id":"2345","first_name":"Orange","age":55,"job":"consultant","pii":{"last_name":"Wilson","ssn":"444-555-6666","zip":75001}}'
'{"id":"6789","first_name":"Pink","age":33,"job":"artist","pii":{"last_name":"Taylor","ssn":"888-999-0000","zip":80202}}'
'{"id":"0123","first_name":"Gray","age":47,"job":"scientist","pii":{"last_name":"Anderson","ssn":"222-333-4444","zip":94103}}'
)
for n in {0..7}; do
sleep 2
echo "Sending message: $${MESSAGES[n]}"
echo -n "$${MESSAGES[n]}" | kafka-console-producer.sh \
--topic demo \
--bootstrap-server 127.0.0.1:9092 \
--producer-property request.timeout.ms=30000
done
# Keep the container running
tail -f /dev/null

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Declare Kafka Inlet, bind on localhost.
# The destination is the 'redpanda operator node, reachable through
# the project relay named 'redpanda'.
kafka-inlet:
from: 127.0.0.1:9092
to: /project/default/service/forward_to_redpanda/secure/api
consumer: /project/default/service/forward_to_consumer/secure/api
avoid-publishing: true
encrypted-field: pii
allow-consumer: consumer
allow: redpanda

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ ENV PATH "/sbin:/opt/kafka/bin/:$PATH"
# Install Ockam
COPY --from=builder /ockam /usr/local/bin/ockam

# Copy the script that will be used as entrypoint
COPY run_ockam.sh /run_ockam.sh
RUN chmod +x /run_ockam.sh
ENTRYPOINT ["/run_ockam.sh"]
# Set environment variable for enrollment ticket
ENV ENROLLMENT_TICKET=""

# Set the entrypoint to run bash
ENTRYPOINT ["/bin/bash"]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ services:
# how the node is set up.
ockam:
depends_on: [redpanda]
build:
context: .
dockerfile: ../ockam.dockerfile
args:
OCKAM_VERSION: ${OCKAM_VERSION:-latest}
image: ghcr.io/build-trust/ockam:latest
environment:
ENROLLMENT_TICKET: ${ENROLLMENT_TICKET:-}
OCKAM_DEVELOPER: ${OCKAM_DEVELOPER:-false}
REDPANDA_ADDRESS: "redpanda"
networks:
- redpanda_operator
command: >
node create -vv --foreground /ockam-node.yaml
--enrollment-ticket ${ENROLLMENT_TICKET:-}
volumes:
- ./ockam-node.yaml:/ockam-node.yaml
redpanda:
image: docker.redpanda.com/redpandadata/redpanda:v24.1.5
environment:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This node will be reachable in the project
# using the address 'forward_to_redpanda'.
relay: redpanda

# Declare a Kafka Outlet, with a local destination.
kafka-outlet:
bootstrap-server: ${REDPANDA_ADDRESS}:9092
allow: inlet

This file was deleted.

0 comments on commit 0d8212a

Please sign in to comment.