Skip to content

Commit 0ff9618

Browse files
rokh-conduktorqboileau
andauthored
Use an external database for conduktor (#134)
* add conduktor in all compose & use an external database * add healthcheck * compose cli v1 => v2 * remove depends on * only target full.yml * fix test * Update conduktor.yml Co-authored-by: Quentin <qboileau@conduktor.io> * increase timeout * fix ci --------- Co-authored-by: Quentin <qboileau@conduktor.io>
1 parent 46df270 commit 0ff9618

File tree

8 files changed

+76
-45
lines changed

8 files changed

+76
-45
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ jobs:
5151
- name: run test multiple-schema-registry 7
5252
run: ./test.sh zk-multiple-kafka-multiple-schema-registry.yml 7
5353

54-
- name: run test full-stack 7
55-
run: ./test.sh full-stack.yml 7
54+
- name: run test full-stack 8
55+
run: ./test.sh full-stack.yml 8

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Just connect against `localhost:9092`. If you are on Mac or Windows and want to
99

1010
# kafka-stack-docker-compose
1111

12-
This replicates as well as possible real deployment configurations, where you have your zookeeper servers and kafka servers actually all distinct from each other. This solves all the networking hurdles that comes with Docker and docker-compose, and is compatible cross platform.
12+
This replicates as well as possible real deployment configurations, where you have your zookeeper servers and kafka servers actually all distinct from each other. This solves all the networking hurdles that comes with Docker and docker compose, and is compatible cross platform.
1313

1414
**UPDATE**: No /etc/hosts file changes are necessary anymore. Explanations at: https://rmoff.net/2018/08/02/kafka-listeners-explained/
1515

@@ -65,10 +65,10 @@ password: `admin`
6565

6666
Run with:
6767
```
68-
docker-compose -f full-stack.yml up
69-
docker-compose -f full-stack.yml down
68+
docker compose -f full-stack.yml up
69+
docker compose -f full-stack.yml down
7070
```
71-
** Note: if you find that you can not connect to [localhost:8080](http://localhost:8080/) please run `docker-compose -f full-stack.yml build` to rebuild the port mappings.
71+
** Note: if you find that you can not connect to [localhost:8080](http://localhost:8080/) please run `docker compose -f full-stack.yml build` to rebuild the port mappings.
7272

7373
## Single Zookeeper / Single Kafka
7474

@@ -80,8 +80,8 @@ This configuration fits most development requirements.
8080

8181
Run with:
8282
```
83-
docker-compose -f zk-single-kafka-single.yml up
84-
docker-compose -f zk-single-kafka-single.yml down
83+
docker compose -f zk-single-kafka-single.yml up
84+
docker compose -f zk-single-kafka-single.yml down
8585
```
8686

8787
## Single Zookeeper / Multiple Kafka
@@ -94,8 +94,8 @@ If you want to have three brokers and experiment with kafka replication / fault-
9494

9595
Run with:
9696
```
97-
docker-compose -f zk-single-kafka-multiple.yml up
98-
docker-compose -f zk-single-kafka-multiple.yml down
97+
docker compose -f zk-single-kafka-multiple.yml up
98+
docker compose -f zk-single-kafka-multiple.yml down
9999
```
100100

101101
## Multiple Zookeeper / Single Kafka
@@ -108,8 +108,8 @@ If you want to have three zookeeper nodes and experiment with zookeeper fault-to
108108

109109
Run with:
110110
```
111-
docker-compose -f zk-multiple-kafka-single.yml up
112-
docker-compose -f zk-multiple-kafka-single.yml down
111+
docker compose -f zk-multiple-kafka-single.yml up
112+
docker compose -f zk-multiple-kafka-single.yml down
113113
```
114114

115115

@@ -122,8 +122,8 @@ If you want to have three zookeeper nodes and three kafka brokers to experiment
122122

123123
Run with:
124124
```
125-
docker-compose -f zk-multiple-kafka-multiple.yml up
126-
docker-compose -f zk-multiple-kafka-multiple.yml down
125+
docker compose -f zk-multiple-kafka-multiple.yml up
126+
docker compose -f zk-multiple-kafka-multiple.yml down
127127
```
128128

129129
# FAQ
@@ -132,11 +132,11 @@ docker-compose -f zk-multiple-kafka-multiple.yml down
132132

133133
**Q: Kafka's log is too verbose, how can I reduce it?**
134134

135-
A: Add the following line to your docker-compose environment variables: `KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"`. Full logging control can be accessed here: https://github.com/confluentinc/cp-docker-images/blob/master/debian/kafka/include/etc/confluent/docker/log4j.properties.template
135+
A: Add the following line to your docker compose environment variables: `KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"`. Full logging control can be accessed here: https://github.com/confluentinc/cp-docker-images/blob/master/debian/kafka/include/etc/confluent/docker/log4j.properties.template
136136

137137
**Q: How do I delete data to start fresh?**
138138

139-
A: Your data is persisted from within the docker compose folder, so if you want for example to reset the data in the full-stack docker compose, do a `docker-compose -f full-stack.yml down`.
139+
A: Your data is persisted from within the docker compose folder, so if you want for example to reset the data in the full-stack docker compose, do a `docker compose -f full-stack.yml down`.
140140

141141
**Q: Can I change the zookeeper ports?**
142142

conduktor.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: '3.8'
2+
3+
services:
4+
5+
postgresql:
6+
image: postgres:14
7+
hostname: postgresql
8+
volumes:
9+
- pg_data:/var/lib/postgresql/data
10+
environment:
11+
POSTGRES_DB: "conduktor-platform"
12+
POSTGRES_USER: "conduktor"
13+
POSTGRES_PASSWORD: "some_password"
14+
POSTGRES_HOST_AUTH_METHOD: "scram-sha-256"
15+
16+
conduktor-platform:
17+
image: conduktor/conduktor-platform:latest
18+
ports:
19+
- "8080:8080"
20+
volumes:
21+
- conduktor_data:/var/conduktor
22+
environment:
23+
CDK_ORGANIZATION_NAME: "demo"
24+
CDK_ADMIN_EMAIL: "admin@admin.io"
25+
CDK_ADMIN_PASSWORD: "admin"
26+
CDK_DATABASE_URL: "postgresql://conduktor:some_password@postgresql:5432/conduktor-platform"
27+
CDK_CLUSTERS_0_ID: "default"
28+
CDK_CLUSTERS_0_NAME: "My Local Kafka Cluster"
29+
CDK_CLUSTERS_0_COLOR: "#0013E7"
30+
CDK_CLUSTERS_0_BOOTSTRAPSERVERS: "PLAINTEXT://kafka1:19092"
31+
CDK_CLUSTERS_0_SCHEMAREGISTRY_URL: "http://kafka-schema-registry:8081"
32+
CDK_CLUSTERS_0_KAFKACONNECTS_0_URL: "http://kafka-connect:8083"
33+
CDK_CLUSTERS_0_KAFKACONNECTS_0_NAME: "full stack kafka connect"
34+
35+
volumes:
36+
pg_data: {}
37+
conduktor_data: {}

full-stack.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -126,28 +126,17 @@ services:
126126
- zoo1
127127
- kafka1
128128

129+
postgresql:
130+
extends:
131+
service: postgresql
132+
file: conduktor.yml
133+
129134
conduktor-platform:
130-
image: conduktor/conduktor-platform:latest
131-
ports:
132-
- "8080:8080"
133-
volumes:
134-
- conduktor_data:/var/conduktor
135-
depends_on:
136-
- kafka1
137-
- kafka-schema-registry
138-
- kafka-connect
139-
environment:
140-
CDK_ORGANIZATION_NAME: "demo"
141-
CDK_ADMIN_EMAIL: "admin@admin.io"
142-
CDK_ADMIN_PASSWORD: "admin"
143-
CDK_CLUSTERS_0_ID: "default"
144-
CDK_CLUSTERS_0_NAME: "My Local Kafka Cluster"
145-
CDK_CLUSTERS_0_COLOR: "#0013E7"
146-
CDK_CLUSTERS_0_BOOTSTRAPSERVERS: "PLAINTEXT://kafka1:19092"
147-
CDK_CLUSTERS_0_SCHEMAREGISTRY_URL: "http://kafka-schema-registry:8081"
148-
CDK_CLUSTERS_0_KAFKACONNECTS_0_URL: "http://kafka-connect:8083"
149-
CDK_CLUSTERS_0_KAFKACONNECTS_0_NAME: "full stack kafka connect"
135+
extends:
136+
service: conduktor-platform
137+
file: conduktor.yml
150138

151139
volumes:
140+
pg_data: {}
152141
conduktor_data: {}
153142

test.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ f () {
1414
# ${BASH_LINENO[0]} contains the line number in the script of that command
1515
# exit the script or return to try again, etc.
1616
# creating stack...
17-
docker-compose -f $file down
17+
docker compose -f $file down
1818
exit $errcode # or use some other value or do return instead
1919
}
2020
trap f ERR
2121

2222
all_great(){
2323
# for testing
2424
echo "Verifying Process"
25-
running=`docker-compose -f $1 ps | grep Up | wc -l`
25+
running=`docker compose -f $1 ps | grep Up | wc -l`
2626
if [ "$running" != "$2" ]; then
2727
# for logging
28-
docker-compose -f $1 ps
28+
docker compose -f $1 ps
2929
# debug
30-
docker-compose -f $1 logs
30+
docker compose -f $1 logs
3131
exit 1
3232
fi
3333
}
@@ -51,14 +51,15 @@ kafka_tests(){
5151
}
5252

5353
# creating stack...
54-
docker-compose -f $file up -d
55-
sleep 10
54+
docker compose -f $file down -v
55+
docker compose -f $file up -d
56+
sleep 30
5657
# logging
57-
docker-compose -f $file ps
58+
docker compose -f $file ps
5859
# tests
5960
all_great $1 $2
6061
kafka_tests $1
6162
all_great $1 $2
6263
# teardown
63-
docker-compose -f $file down
64+
docker compose -f $file down -v
6465
echo "Success!"

zk-multiple-kafka-multiple-schema-registry.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ services:
115115
SCHEMA_REGISTRY_HOST_NAME: kafka-schema-registry
116116
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'PLAINTEXT://kafka1:19092,PLAINTEXT://kafka2:19093,PLAINTEXT://kafka3:19094'
117117
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
118+

zk-single-kafka-multiple.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ services:
6969
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.authorizer.AclAuthorizer
7070
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
7171
depends_on:
72-
- zoo1
72+
- zoo1

zk-single-kafka-single.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ services:
3636
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "true"
3737
depends_on:
3838
- zoo1
39+
40+
41+

0 commit comments

Comments
 (0)