Skip to content

Commit 812875b

Browse files
committed
better run.sh
1 parent 765276c commit 812875b

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

run.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
11
#!/usr/bin/env bash
22
export CLASSPATH="$(find target/ -type f -name '*.jar'| grep '\-package' | tr '\n' ':')"
3-
connect-standalone config/worker.properties config/GitHubSourceConnectorExample.properties
3+
if hash docker 2>/dev/null; then
4+
# for docker lovers
5+
docker run -e CLASSPATH=$CLASSPATH \
6+
--net=host --rm \
7+
-v $(pwd):/kafka-connect-github-source \
8+
-w /kafka-connect-github-source \
9+
confluentinc/cp-kafka-connect:3.2.0 \
10+
connect-standalone config/worker.properties config/GitHubSourceConnectorExample.properties
11+
elif hash connect-standalone 2>/dev/null; then
12+
# for mac users who used homebrew
13+
connect-standalone config/worker.properties config/GitHubSourceConnectorExample.properties
14+
elif [[ -z $KAFKA_HOME ]]; then
15+
# for people who installed kafka vanilla
16+
$KAFKA_HOME/bin/connect-standalone.sh $KAFKA_HOME/etc/schema-registry/connect-avro-standalone.properties config/MySourceConnector.properties
17+
elif [[ -z $CONFLUENT_HOME ]]; then
18+
# for people who installed kafka confluent flavour
19+
$CONFLUENT_HOME/bin/connect-standalone $CONFLUENT_HOME/etc/schema-registry/connect-avro-standalone.properties config/MySourceConnector.properties
20+
else
21+
printf "Couldn't find a suitable way to run kafka connect for you.\n \
22+
Please install Docker, or download the kafka binaries and set the variable KAFKA_HOME."
23+
fi;

0 commit comments

Comments
 (0)