-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·65 lines (50 loc) · 1.24 KB
/
run
File metadata and controls
executable file
·65 lines (50 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -Eeuo pipefail
run-help() {
cat <<-EOF
Usage: run <command>
Where <command> is one of:
- kafka Kafka related commands
- mongo Mongo related commands
- pg Postgres related commands
EOF
}
run-kafka() {
"run-kafka-${@:-help}"
}
run-kafka-help() {
cat <<-EOF
Usage: run kafka <command>
Where <command> is one of:
- topics List topics
- consume <topic> Consume events from <topic>
- produce <topic> Produce evebts to <topic>
EOF
}
kf_do() {
docker run -it --rm --network host confluentinc/cp-kafka:7.5.0 "$@" --bootstrap-server localhost:19092
}
kf_topics() {
kf_do kafka-topics --list
}
kf_produce() {
kf_do kafka-console-producer --topic "${@:-test}"
}
kf_consume() {
kf_do kafka-console-consumer --topic "${@:-test}"
}
run-mongo() {
"run-mongo-${@:-help}"
}
run-mongo-help() {
cat <<-EOF
Usage: run mongo <command>
Where <command> can be one of:
- compass <url> Connect to <url> using compass, defaults to "username:password@localhost:27017"
EOF
}
mongo_default_url='username:password@localhost:27017/?replicaSet=rs0&directConnection=true'
run-mongo-compass() {
mongodb-compass-isolated "mongodb://${1:-$mongo_default_url}"
}
"run-${@:-help}"