Skip to content

Commit b32f2a3

Browse files
committed
--wip-- [skip ci]
1 parent e76d1d5 commit b32f2a3

File tree

3 files changed

+78
-20
lines changed

3 files changed

+78
-20
lines changed

docker-compose.yml

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,58 @@
11
version: "3.8"
22

33
services:
4-
zookeeper:
5-
image: confluentinc/cp-zookeeper
6-
hostname: zookeeper
7-
ports:
8-
- 2182:2181
9-
environment:
10-
SERVICE_NAME: zookeeper
11-
ZOOKEEPER_CLIENT_PORT: 2181
12-
13-
kafka:
14-
image: confluentinc/cp-kafka:latest
15-
hostname: localhost
4+
# Redpanda cluster
5+
redpanda-1:
6+
image: docker.redpanda.com/redpandadata/redpanda:v23.1.1
7+
container_name: redpanda-1
8+
command:
9+
- redpanda
10+
- start
11+
- --smp
12+
- '1'
13+
- --reserve-memory
14+
- 0M
15+
- --overprovisioned
16+
- --node-id
17+
- '1'
18+
- --kafka-addr
19+
- PLAINTEXT://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092
20+
- --advertise-kafka-addr
21+
- PLAINTEXT://redpanda-1:29092,OUTSIDE://localhost:9092
22+
- --pandaproxy-addr
23+
- PLAINTEXT://0.0.0.0:28082,OUTSIDE://0.0.0.0:8082
24+
- --advertise-pandaproxy-addr
25+
- PLAINTEXT://redpanda-1:28082,OUTSIDE://localhost:8082
26+
- --rpc-addr
27+
- 0.0.0.0:33145
28+
- --advertise-rpc-addr
29+
- redpanda-1:33145
1630
ports:
31+
# - 8081:8081
32+
- 8082:8082
1733
- 9092:9092
18-
links:
19-
- zookeeper:zookeeper
34+
- 9644:9644
35+
- 28082:28082
36+
- 29092:29092
37+
38+
redpanda-console:
39+
image: docker.redpanda.com/redpandadata/console:v2.2.2
40+
container_name: redpanda-console
41+
entrypoint: /bin/sh
42+
command: -c "echo \"$$CONSOLE_CONFIG_FILE\" > /tmp/config.yml; /app/console"
2043
environment:
21-
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
22-
KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://$KAFKA_TEST_BROKER:9092"
23-
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
24-
KAFKA_CREATE_TOPICS:
44+
CONFIG_FILEPATH: /tmp/config.yml
45+
CONSOLE_CONFIG_FILE: |
46+
kafka:
47+
brokers: ["kafka:9092"]
48+
schemaRegistry:
49+
enabled: false
50+
redpanda:
51+
adminApi:
52+
enabled: false
53+
connect:
54+
enabled: false
55+
ports:
56+
- 8080:8080
57+
depends_on:
58+
- redpanda-1

src/Kafka/Admin.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Kafka.Internal.Setup
88

99
import Kafka.Types
1010
import Kafka.Admin.AdminProperties
11+
import Kafka.Admin.Types
1112

1213
data KAdmin = KAdmin {
1314
adminKafka :: !Kafka
@@ -24,3 +25,5 @@ newKAdmin properties = liftIO $ do
2425
Left err -> pure $ Left $ KafkaError err
2526
Right kafka -> pure $ Right $ KAdmin (Kafka kafka) kafkaConfig
2627

28+
--- CREATE TOPIC ---
29+

src/Kafka/Admin/Types.hs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
module Kafka.Admin.Types where
22

3+
import Data.Map
4+
5+
import Kafka.Types
36
import Kafka.Internal.Setup
47

58
data KafkaAdmin = KafkaAdmin {
6-
adminProperties :: !Kafka
7-
, kpKafkaConf :: !KafkaConf
9+
kcKafkaPtr :: !Kafka
10+
, kcKafkaConf :: !KafkaConf
811
}
12+
13+
instance HasKafka KafkaAdmin where
14+
getKafka = kcKafkaPtr
15+
{-# INLINE getKafka #-}
16+
17+
instance HasKafkaConf KafkaAdmin where
18+
getKafkaConf = kcKafkaConf
19+
{-# INLINE getKafkaConf #-}
20+
21+
newtype PartitionsCount = PartitionsCount { unPartitionsCount :: Int } deriving (Show, Eq)
22+
newtype ReplicationFactor = ReplicationFactor { unReplicationFactor :: Int } deriving (Show, Eq)
23+
24+
data NewTopic = NewTopic {
25+
topicName :: TopicName
26+
, topicPartitions :: PartitionsCount
27+
, topicReplicationFactor :: ReplicationFactor
28+
, topicConfig :: Map String String
29+
} deriving (Show)

0 commit comments

Comments
 (0)