Skip to content

Commit 0609779

Browse files
committed
sys.exit when create topic fails
1 parent 4761c32 commit 0609779

File tree

4 files changed

+79
-62
lines changed

4 files changed

+79
-62
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
- ghcr.io/tansu-io/tansu:latest
2323
runs-on: ${{matrix.os}}
2424
env:
25-
ADVERTISED_LISTENER_URL: tcp://[::]:9092
25+
ADVERTISED_LISTENER_URL: tcp://localhost:9092
2626
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
2727
AWS_ALLOW_HTTP: true
2828
AWS_DEFAULT_REGION: auto
2929
AWS_ENDPOINT: http://minio:9000
3030
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
3131
CLUSTER_ID: kafka-python-integration
32-
PROMETHEUS_LISTENER_URL: tcp://[::]:9100
32+
PROMETHEUS_LISTENER_URL: tcp://localhost:9100
3333
RUST_BACKTRACE: 1
3434
RUST_LOG: warn,tansu_server=debug,tansu_storage=debug,tansu_schema_registry=debug
3535
STORAGE_ENGINE: ${{matrix.storage}}

compose.yaml

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,66 @@
11
---
22
services:
3-
db:
4-
image: ${POSTGRES_IMAGE:-postgres:17}
5-
environment:
6-
PGUSER: postgres
7-
POSTGRES_PASSWORD: postgres
8-
ports:
9-
- 5432:5432
10-
volumes:
11-
- db:/var/lib/postgresql/data
12-
- ./etc/initdb.d/:/docker-entrypoint-initdb.d/
13-
healthcheck:
14-
test: /usr/bin/pg_isready
15-
interval: 5s
16-
timeout: 10s
17-
retries: 5
18-
pull_policy: missing
19-
minio:
20-
image: quay.io/minio/minio
21-
command: server /data --console-address ":9001"
22-
volumes:
23-
- minio:/data
24-
ports:
25-
- 9000:9000
26-
- 9001:9001
27-
environment:
28-
MINIO_PROMETHEUS_AUTH_TYPE: public
29-
healthcheck:
30-
test: timeout 5s bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1
31-
interval: 5s
32-
retries: 1
33-
start_period: 5s
34-
timeout: 5s
35-
tansu:
36-
image: ${TANSU_IMAGE}
37-
restart: unless-stopped
38-
environment:
39-
CLUSTER_ID: ${CLUSTER_ID}
40-
ADVERTISED_LISTENER_URL: ${ADVERTISED_LISTENER_URL}
41-
PROMETHEUS_LISTENER_URL: ${PROMETHEUS_LISTENER_URL}
42-
STORAGE_ENGINE: ${STORAGE_ENGINE}
43-
RUST_BACKTRACE: ${RUST_BACKTRACE}
44-
RUST_LOG: ${RUST_LOG}
45-
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
46-
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
47-
AWS_ENDPOINT: ${AWS_ENDPOINT}
48-
AWS_ALLOW_HTTP: ${AWS_ALLOW_HTTP}
49-
volumes:
50-
- ./etc/schema/:/schema/
51-
ports:
52-
- 9092:9092
53-
- 9100:9100
54-
pull_policy: always
3+
db:
4+
image: ${POSTGRES_IMAGE:-postgres:17}
5+
environment:
6+
PGUSER: postgres
7+
POSTGRES_PASSWORD: postgres
8+
ports:
9+
- 5432:5432
10+
volumes:
11+
- db:/var/lib/postgresql/data
12+
- ./etc/initdb.d/:/docker-entrypoint-initdb.d/
13+
healthcheck:
14+
test: /usr/bin/pg_isready
15+
interval: 5s
16+
timeout: 10s
17+
retries: 5
18+
pull_policy: missing
19+
minio:
20+
image: quay.io/minio/minio
21+
command: server /data --console-address ":9001"
22+
volumes:
23+
- minio:/data
24+
ports:
25+
- 9000:9000
26+
- 9001:9001
27+
environment:
28+
MINIO_PROMETHEUS_AUTH_TYPE: public
29+
healthcheck:
30+
test: timeout 5s bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1
31+
interval: 5s
32+
retries: 1
33+
start_period: 5s
34+
timeout: 5s
35+
tansu:
36+
image: ${TANSU_IMAGE}
37+
restart: unless-stopped
38+
environment:
39+
CLUSTER_ID: ${CLUSTER_ID}
40+
ADVERTISED_LISTENER_URL: ${ADVERTISED_LISTENER_URL}
41+
PROMETHEUS_LISTENER_URL: ${PROMETHEUS_LISTENER_URL}
42+
STORAGE_ENGINE: ${STORAGE_ENGINE}
43+
RUST_BACKTRACE: ${RUST_BACKTRACE}
44+
RUST_LOG: ${RUST_LOG}
45+
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
46+
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
47+
AWS_ENDPOINT: ${AWS_ENDPOINT}
48+
AWS_ALLOW_HTTP: ${AWS_ALLOW_HTTP}
49+
volumes:
50+
- ./etc/schema/:/schema/
51+
command: --kafka-cluster-id ${CLUSTER_ID}
52+
--kafka-listener-url tcp://0.0.0.0:9092/
53+
--kafka-advertised-listener-url ${ADVERTISED_LISTENER_URL}
54+
--storage-engine ${STORAGE_ENGINE}
55+
--schema-registry file:///schema
56+
ports:
57+
- 9092:9092
58+
- 9100:9100
59+
pull_policy: always
5560
volumes:
56-
db:
57-
driver: local
58-
minio:
59-
driver: local
60-
grafana:
61-
driver: local
61+
db:
62+
driver: local
63+
minio:
64+
driver: local
65+
grafana:
66+
driver: local

example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
import threading, time
2+
import sys, threading, time
33

44
from kafka import KafkaAdminClient, KafkaConsumer, KafkaProducer
55
from kafka.admin import NewTopic
@@ -57,7 +57,7 @@ def main():
5757
replication_factor=1)
5858
admin.create_topics([topic])
5959
except Exception:
60-
pass
60+
sys.exit(3)
6161

6262
tasks = [
6363
Producer(),

justfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
set dotenv-load
22

3+
docker-compose-up:
4+
docker compose up --detach
5+
6+
docker-compose-down:
7+
docker compose down --volumes
8+
9+
docker-compose-ps:
10+
docker compose ps
11+
12+
docker-compose-logs:
13+
docker compose logs
14+
315
codespace-create:
416
gh codespace create \
517
--repo $(gh repo view --json nameWithOwner --jq .nameWithOwner) \

0 commit comments

Comments
 (0)