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

Custom Kafka topics / Connectors #19

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ The following enviroment variables can be used to configure Kafka Topic creation
| `KAFKA_TOPIC_CREATE_GEOJSONCONVERTER` | Whether to create topics for the GeoJSON Converter |
| `KAFKA_TOPIC_CREATE_CONFLICTMONITOR` | Whether to create topics for the Conflict Monitor |
| `KAFKA_TOPIC_CREATE_DEDUPLICATOR` | Whether to create topics for the Deduplicator |
| `KAFKA_TOPIC_CREATE_OTHER` | Whether to create topics for other applications, this is only useful when you attach a custom `kafka-topics-values.yaml` file with other topics |
| `KAFKA_TOPICS_VALUES_FILE` | Path to a custom `kafka-topics-values.yaml` file|
| `KAFKA_TOPIC_PARTITIONS` | Number of partitions |
| `KAFKA_TOPIC_REPLICAS` | Number of replicas |
| `KAFKA_TOPIC_MIN_INSYNC_REPLICAS` | Minumum number of in-sync replicas (for use with ack=all) |
Expand Down Expand Up @@ -174,7 +176,9 @@ The following environment variables can be used to configure Kafka Connectors:
| `CONNECT_CREATE_ODE` | Whether to create kafka connectors for the ODE |
| `CONNECT_CREATE_GEOJSONCONVERTER` | Whether to create topics for the GeojsonConverter |
| `CONNECT_CREATE_CONFLICTMONITOR` | Whether to create kafka connectors for the Conflict Monitor |
| `CONNECT_CREATE_DEDUPLICATOR` | Whether to create topics for the Deduplicator |
| `CONNECT_CREATE_DEDUPLICATOR` | Whether to create kafka connectors for the Deduplicator |
| `CONNECT_KAFKA_CONNECTORS_VALUES_FILE` | Path to a custom `kafka-connectors-values.yaml` file |
| `CONNECT_CREATE_OTHER` | Whether to create kafka connectors for other applications, this is only useful when you attach a custom `kafka-connectors-values.yaml` file with other connectors |

### Quick Run

Expand Down
6 changes: 5 additions & 1 deletion docker-compose-connect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ services:
CONNECT_CREATE_CONFLICTMONITOR: ${CONNECT_CREATE_CONFLICTMONITOR}
CONNECT_CREATE_DEDUPLICATOR: ${CONNECT_CREATE_DEDUPLICATOR}
CONNECT_CREATE_MECDEPOSIT: ${CONNECT_CREATE_MECDEPOSIT}
CONNECT_CREATE_OTHER: ${CONNECT_CREATE_OTHER}

MONGO_CONNECTOR_USERNAME: ${MONGO_ADMIN_DB_USER}
MONGO_CONNECTOR_PASSWORD: ${MONGO_ADMIN_DB_PASS:?}
MONGO_DB_IP: ${MONGO_IP}
MONGO_DB_NAME: ${MONGO_DB_NAME}
MONGO_DB_NAME: ${MONGO_DB_NAME}
volumes:
- ${CONNECT_KAFKA_CONNECTORS_VALUES_FILE:-./jikkou/kafka-connectors-values.yaml}:/kafka-connectors-values.yaml
4 changes: 4 additions & 0 deletions docker-compose-kafka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ services:
KAFKA_TOPIC_MIN_INSYNC_REPLICAS: ${KAFKA_TOPIC_MIN_INSYNC_REPLICAS}
KAFKA_TOPIC_RETENTION_MS: ${KAFKA_TOPIC_RETENTION_MS}
KAFKA_TOPIC_DELETE_RETENTION_MS: ${KAFKA_TOPIC_DELETE_RETENTION_MS}

KAFKA_TOPIC_CREATE_ODE: ${KAFKA_TOPIC_CREATE_ODE}
KAFKA_TOPIC_CREATE_GEOJSONCONVERTER: ${KAFKA_TOPIC_CREATE_GEOJSONCONVERTER}
KAFKA_TOPIC_CREATE_CONFLICTMONITOR: ${KAFKA_TOPIC_CREATE_CONFLICTMONITOR}
KAFKA_TOPIC_CREATE_DEDUPLICATOR: ${KAFKA_TOPIC_CREATE_DEDUPLICATOR}
KAFKA_TOPIC_CREATE_MECDEPOSIT: ${KAFKA_TOPIC_CREATE_MECDEPOSIT}
KAFKA_TOPIC_CREATE_OTHER: ${KAFKA_TOPIC_CREATE_OTHER}

KAFKA_SECURITY_PROTOCOL: ${KAFKA_SECURITY_PROTOCOL:-PLAINTEXT}
KAFKA_SASL_MECHANISM: ${KAFKA_SASL_MECHANISM}
Expand All @@ -84,6 +86,8 @@ services:
options:
max-size: "10m"
max-file: "5"
volumes:
- ${KAFKA_TOPICS_VALUES_FILE:-./jikkou/kafka-topics-values.yaml}:/kafka-topics-values.yaml

kafka-schema-registry:
profiles:
Expand Down
4 changes: 4 additions & 0 deletions jikkou/kafka-connectors-template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ spec:
{% if system.env.CONNECT_CREATE_MECDEPOSIT %}
{{ create_connector(values.apps.mecdeposit) }}
{% endif %}

{% if system.env.CONNECT_CREATE_OTHER %}
{{ create_connector(values.apps.other) }}
{% endif %}
4 changes: 4 additions & 0 deletions jikkou/kafka-connectors-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,7 @@ apps:
- topicName: topic.MecDepositMetrics
collectionName: MecDepositMetrics
generateTimestamp: true
# Allow for custom connectors to be added - users can override this file and add other kafka connectors here
other:
name: other
connectors:
4 changes: 4 additions & 0 deletions jikkou/kafka-topics-template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ spec:
{% if system.env.KAFKA_TOPIC_CREATE_MECDEPOSIT %}
{{ create_topics(values.apps.mecdeposit) }}
{% endif %}

{% if system.env.KAFKA_TOPIC_CREATE_OTHER %}
{{ create_topics(values.apps.other) }}
{% endif %}
5 changes: 5 additions & 0 deletions jikkou/kafka-topics-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,8 @@ apps:
- topic.MecDepositMetrics
tableTopics: {}
customTopics: {}
other:
name: other-topics
streamTopics: {}
tableTopics: {}
customTopics: {}
9 changes: 9 additions & 0 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ KAFKA_TOPIC_CREATE_GEOJSONCONVERTER=true # Create topics for GeoJSON Converte
KAFKA_TOPIC_CREATE_CONFLICTMONITOR=true # Create topics for Conflict Monitor
KAFKA_TOPIC_CREATE_DEDUPLICATOR=false # Create topics for Deduplicator
KAFKA_TOPIC_CREATE_MECDEPOSIT=false # Create topics for MecDeposit
KAFKA_TOPIC_CREATE_OTHER=false # Create topics for other applications

# Relative path to the Kafka topics values file, upper level directories are supported
KAFKA_TOPICS_VALUES_FILE="./jikkou/kafka-topics-values.yaml"

# Confluent Cloud Support
KAFKA_SECURITY_PROTOCOL=PLAINTEXT
Expand Down Expand Up @@ -121,5 +125,10 @@ CONNECT_CREATE_GEOJSONCONVERTER=true # Create kafka connectors to MongoDB for
CONNECT_CREATE_CONFLICTMONITOR=true # Create kafka connectors to MongoDB for Conflict Monitor
CONNECT_CREATE_DEDUPLICATOR=false # Create kafka connectors to MongoDB for Deduplicator
CONNECT_CREATE_MECDEPOSIT=false # Create kafka connectors to MongoDB for MecDeposit
CONNECT_CREATE_OTHER=false # Create kafka connectors to MongoDB for other applications

# Relative path to the Kafka connect connectors values file, upper level directories are supported
CONNECT_KAFKA_CONNECTORS_VALUES_FILE="./jikkou/kafka-connectors-values.yaml"


### Kafka connect variables - END ###