Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
*.sh text eol=lf
*.bash text eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
# IDE
.vscode/
.idea/
.vs/
*.swp
*.swo

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)
project(moderation-service)
enable_testing()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if(MSVC)
add_compile_options(/utf-8)
Expand Down
2 changes: 1 addition & 1 deletion configs/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ DATABASE_URL: "postgresql://esclient_devmodr:5C9C8NCFWGXR5m!R@pg4.sweb.ru:5433/e
HOST: "0.0.0.0"
PORT: "7006"

KAFKA_BROKERS: "localhost:9092"
KAFKA_BROKERS: "localhost:9093"
KAFKA_REQUEST_TOPIC: "moderation-request"
KAFKA_RESULT_TOPIC: "moderation-result"
KAFKA_CONSUMER_GROUP_ID: "moderation-consumer-group"
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ services:
image: bashj79/kafka-kraft
container_name: 'kafka'
ports:
- '9092:9092'
- '9093:9092'
environment:
KAFKA_ENABLE_KRAFT: 'yes'
ALLOW_PLAINTEXT_LISTENER: 'yes'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://localhost:9093'
volumes:
- kafka_data:/opt/kafka/kafka-logs
healthcheck:
Expand Down
18 changes: 14 additions & 4 deletions tools/common.just
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,28 @@ build-linux: fetch-proto
cmake --build build --config Release

build-windows: fetch-proto
conan install . --output-folder=build --build=missing
conan install . --output-folder=build --build=missing -s compiler.cppstd=20
cmake -S . -B build \
-G "Visual Studio 17 2022" \
-A x64 \
-DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
cmake --build build --config Release

kafka-container-up:
docker-compose up -d
MSYS_NO_PATHCONV=1 docker exec kafka /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic moderation-result --replication-factor 1 --partitions 3
MSYS_NO_PATHCONV=1 docker exec kafka /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --topic moderation-request --replication-factor 1 --partitions 3
@echo "Waiting for Kafka to be ready..."
@for i in 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; do \
if docker exec kafka nc -z localhost 9092 2>/dev/null; then \
echo "Kafka is ready!"; \
break; \
fi; \
echo "Waiting for Kafka... attempt $$i/30"; \
sleep 2; \
done
MSYS_NO_PATHCONV=1 docker exec kafka /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --if-not-exists --topic moderation-result --replication-factor 1 --partitions 3
MSYS_NO_PATHCONV=1 docker exec kafka /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --if-not-exists --topic moderation-request --replication-factor 1 --partitions 3

kafka-container-down:
MSYS_NO_PATHCONV=1 docker exec kafka /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic moderation-request
Expand Down
Loading