Loading .env.example +9 −0 Original line number Diff line number Diff line Loading @@ -16,3 +16,12 @@ USER_ID=1000 # IDE XDEBUG_IDE_KEY=myproject # Redis REDIS_PORT=6379 # Kafka/zookeeper ZOOKEEPER_CLIENT_PORT=2181 ZOOKEEPER_PORT=22181 KAFKA_BROKER_ID=1 KAFKA_PORT=29092 No newline at end of file Makefile +33 −2 Original line number Diff line number Diff line Loading @@ -4,10 +4,15 @@ COMPOSE_PREFIX_CMD := DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 COMMAND ?= /bin/sh DC=docker-compose KAFKA_SERVERS=kafka:29092 KAFKA_CONTAINER=kafka EXEC_KAFKA=$(COMPOSE_PREFIX_CMD) $(DC) exec $(KAFKA_CONTAINER) # -------------------------- .PHONY: deploy up build-up build down start stop logs images ps command \ command-root shell-root shell restart rm help command-root shell-root shell shell-kafka create-kafka-topic restart rm help deploy: ## Start using Prod Image in Prod Mode ${COMPOSE_PREFIX_CMD} docker compose -f compose.prod.yaml up --build -d Loading Loading @@ -52,6 +57,12 @@ shell-root: ## Enter container shell as root shell: ## Enter container shell @${COMPOSE_PREFIX_CMD} docker compose exec app /bin/sh shell-kafka: ## Run bash shell in kafka container. @${COMPOSE_PREFIX_CMD} docker compose exec kafka /bin/sh create-kafka-topic: ## Create kafka topic $(MAKE) topic-create send_topic restart: ## Restart container @${COMPOSE_PREFIX_CMD} docker compose restart Loading @@ -65,3 +76,23 @@ help: ## Show this help. @echo "\n\nMake Application Docker Images and Containers using Docker-Compose files" @echo "Make sure you are using \033[0;32mDocker Version >= 20.1\033[0m & \033[0;32mDocker-Compose >= 1.27\033[0m " @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m ENV=<prod|dev> (default: dev)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) .PHONY: topics topic topic-create producer-create consumer-groups consumer-group topics: ## Display list of topics $(EXEC_KAFKA) kafka-topics --list --bootstrap-server $(KAFKA_SERVERS) topic: ## Describe existing topic $(EXEC_KAFKA) kafka-topics --describe --bootstrap-server $(KAFKA_SERVERS) --topic $(filter-out $@,$(MAKECMDGOALS)) topic-create: ## Create new topic $(EXEC_KAFKA) kafka-topics --create --bootstrap-server $(KAFKA_SERVERS) --topic $(filter-out $@,$(MAKECMDGOALS)) producer-create: ## Create a topic producer $(EXEC_KAFKA) kafka-console-producer --bootstrap-server $(KAFKA_SERVERS) --topic $(filter-out $@,$(MAKECMDGOALS)) consumer-groups: ## Display list of consumer group $(EXEC_KAFKA) kafka-consumer-groups --list --bootstrap-server $(KAFKA_SERVERS) consumer-group: ## Describe existing consumer group $(EXEC_KAFKA) kafka-consumer-groups --describe --bootstrap-server $(KAFKA_SERVERS) --group $(filter-out $@,$(MAKECMDGOALS)) No newline at end of file app/.env.example +8 −0 Original line number Diff line number Diff line Loading @@ -13,3 +13,11 @@ JWT_PASSPHRASE= MAILER_ADDRESS= MAILER_DSN=smtp://user:pass@smtp.example.com:port ###< symfony/mailer ### CODE_TTL=300 CONFIRM_TYPE=EMAIL ###> symfony/messenger ### MESSENGER_TRANSPORT_DSN=kafka:// KAFKA_BROKERS=kafka:9092 ###< symfony/messenger ### No newline at end of file app/composer.json +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", "ext-rdkafka": "*", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.12", "doctrine/doctrine-migrations-bundle": "^3.3", Loading @@ -19,6 +20,7 @@ "symfony/flex": "^2", "symfony/framework-bundle": "7.0.*", "symfony/mailer": "7.0.*", "symfony/messenger": "7.0.*", "symfony/mime": "7.0.*", "symfony/runtime": "7.0.*", "symfony/security-bundle": "7.0.*", Loading app/composer.lock +89 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "9ef02607d8522e77f2ce17f078546adb", "content-hash": "b38b50076633f562508d6896c57850ce", "packages": [ { "name": "doctrine/cache", Loading Loading @@ -3381,6 +3381,92 @@ ], "time": "2024-05-31T14:55:39+00:00" }, { "name": "symfony/messenger", "version": "v7.0.8", "source": { "type": "git", "url": "https://github.com/symfony/messenger.git", "reference": "ed7bccfe31e7f0bdb5b101f48b6027622a7a48cb" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/messenger/zipball/ed7bccfe31e7f0bdb5b101f48b6027622a7a48cb", "reference": "ed7bccfe31e7f0bdb5b101f48b6027622a7a48cb", "shasum": "" }, "require": { "php": ">=8.2", "psr/log": "^1|^2|^3", "symfony/clock": "^6.4|^7.0" }, "conflict": { "symfony/console": "<6.4", "symfony/event-dispatcher": "<6.4", "symfony/event-dispatcher-contracts": "<2.5", "symfony/framework-bundle": "<6.4", "symfony/http-kernel": "<6.4", "symfony/serializer": "<6.4" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "symfony/console": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", "symfony/process": "^6.4|^7.0", "symfony/property-access": "^6.4|^7.0", "symfony/rate-limiter": "^6.4|^7.0", "symfony/routing": "^6.4|^7.0", "symfony/serializer": "^6.4|^7.0", "symfony/service-contracts": "^2.5|^3", "symfony/stopwatch": "^6.4|^7.0", "symfony/validator": "^6.4|^7.0" }, "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Messenger\\": "" }, "exclude-from-classmap": [ "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Samuel Roze", "email": "samuel.roze@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "description": "Helps applications send and receive messages to/from other applications or via message queues", "homepage": "https://symfony.com", "support": { "source": "https://github.com/symfony/messenger/tree/v7.0.8" }, "funding": [ { "url": "https://symfony.com/sponsor", "type": "custom" }, { "url": "https://github.com/fabpot", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], "time": "2024-05-31T14:55:39+00:00" }, { "name": "symfony/mime", "version": "v7.0.8", Loading Loading @@ -6351,7 +6437,8 @@ "platform": { "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*" "ext-iconv": "*", "ext-rdkafka": "*" }, "platform-dev": [], "plugin-api-version": "2.6.0" Loading Loading
.env.example +9 −0 Original line number Diff line number Diff line Loading @@ -16,3 +16,12 @@ USER_ID=1000 # IDE XDEBUG_IDE_KEY=myproject # Redis REDIS_PORT=6379 # Kafka/zookeeper ZOOKEEPER_CLIENT_PORT=2181 ZOOKEEPER_PORT=22181 KAFKA_BROKER_ID=1 KAFKA_PORT=29092 No newline at end of file
Makefile +33 −2 Original line number Diff line number Diff line Loading @@ -4,10 +4,15 @@ COMPOSE_PREFIX_CMD := DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 COMMAND ?= /bin/sh DC=docker-compose KAFKA_SERVERS=kafka:29092 KAFKA_CONTAINER=kafka EXEC_KAFKA=$(COMPOSE_PREFIX_CMD) $(DC) exec $(KAFKA_CONTAINER) # -------------------------- .PHONY: deploy up build-up build down start stop logs images ps command \ command-root shell-root shell restart rm help command-root shell-root shell shell-kafka create-kafka-topic restart rm help deploy: ## Start using Prod Image in Prod Mode ${COMPOSE_PREFIX_CMD} docker compose -f compose.prod.yaml up --build -d Loading Loading @@ -52,6 +57,12 @@ shell-root: ## Enter container shell as root shell: ## Enter container shell @${COMPOSE_PREFIX_CMD} docker compose exec app /bin/sh shell-kafka: ## Run bash shell in kafka container. @${COMPOSE_PREFIX_CMD} docker compose exec kafka /bin/sh create-kafka-topic: ## Create kafka topic $(MAKE) topic-create send_topic restart: ## Restart container @${COMPOSE_PREFIX_CMD} docker compose restart Loading @@ -65,3 +76,23 @@ help: ## Show this help. @echo "\n\nMake Application Docker Images and Containers using Docker-Compose files" @echo "Make sure you are using \033[0;32mDocker Version >= 20.1\033[0m & \033[0;32mDocker-Compose >= 1.27\033[0m " @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m ENV=<prod|dev> (default: dev)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) .PHONY: topics topic topic-create producer-create consumer-groups consumer-group topics: ## Display list of topics $(EXEC_KAFKA) kafka-topics --list --bootstrap-server $(KAFKA_SERVERS) topic: ## Describe existing topic $(EXEC_KAFKA) kafka-topics --describe --bootstrap-server $(KAFKA_SERVERS) --topic $(filter-out $@,$(MAKECMDGOALS)) topic-create: ## Create new topic $(EXEC_KAFKA) kafka-topics --create --bootstrap-server $(KAFKA_SERVERS) --topic $(filter-out $@,$(MAKECMDGOALS)) producer-create: ## Create a topic producer $(EXEC_KAFKA) kafka-console-producer --bootstrap-server $(KAFKA_SERVERS) --topic $(filter-out $@,$(MAKECMDGOALS)) consumer-groups: ## Display list of consumer group $(EXEC_KAFKA) kafka-consumer-groups --list --bootstrap-server $(KAFKA_SERVERS) consumer-group: ## Describe existing consumer group $(EXEC_KAFKA) kafka-consumer-groups --describe --bootstrap-server $(KAFKA_SERVERS) --group $(filter-out $@,$(MAKECMDGOALS)) No newline at end of file
app/.env.example +8 −0 Original line number Diff line number Diff line Loading @@ -13,3 +13,11 @@ JWT_PASSPHRASE= MAILER_ADDRESS= MAILER_DSN=smtp://user:pass@smtp.example.com:port ###< symfony/mailer ### CODE_TTL=300 CONFIRM_TYPE=EMAIL ###> symfony/messenger ### MESSENGER_TRANSPORT_DSN=kafka:// KAFKA_BROKERS=kafka:9092 ###< symfony/messenger ### No newline at end of file
app/composer.json +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", "ext-rdkafka": "*", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.12", "doctrine/doctrine-migrations-bundle": "^3.3", Loading @@ -19,6 +20,7 @@ "symfony/flex": "^2", "symfony/framework-bundle": "7.0.*", "symfony/mailer": "7.0.*", "symfony/messenger": "7.0.*", "symfony/mime": "7.0.*", "symfony/runtime": "7.0.*", "symfony/security-bundle": "7.0.*", Loading
app/composer.lock +89 −2 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], "content-hash": "9ef02607d8522e77f2ce17f078546adb", "content-hash": "b38b50076633f562508d6896c57850ce", "packages": [ { "name": "doctrine/cache", Loading Loading @@ -3381,6 +3381,92 @@ ], "time": "2024-05-31T14:55:39+00:00" }, { "name": "symfony/messenger", "version": "v7.0.8", "source": { "type": "git", "url": "https://github.com/symfony/messenger.git", "reference": "ed7bccfe31e7f0bdb5b101f48b6027622a7a48cb" }, "dist": { "type": "zip", "url": "https://api.github.com/repos/symfony/messenger/zipball/ed7bccfe31e7f0bdb5b101f48b6027622a7a48cb", "reference": "ed7bccfe31e7f0bdb5b101f48b6027622a7a48cb", "shasum": "" }, "require": { "php": ">=8.2", "psr/log": "^1|^2|^3", "symfony/clock": "^6.4|^7.0" }, "conflict": { "symfony/console": "<6.4", "symfony/event-dispatcher": "<6.4", "symfony/event-dispatcher-contracts": "<2.5", "symfony/framework-bundle": "<6.4", "symfony/http-kernel": "<6.4", "symfony/serializer": "<6.4" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "symfony/console": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/event-dispatcher": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", "symfony/process": "^6.4|^7.0", "symfony/property-access": "^6.4|^7.0", "symfony/rate-limiter": "^6.4|^7.0", "symfony/routing": "^6.4|^7.0", "symfony/serializer": "^6.4|^7.0", "symfony/service-contracts": "^2.5|^3", "symfony/stopwatch": "^6.4|^7.0", "symfony/validator": "^6.4|^7.0" }, "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Messenger\\": "" }, "exclude-from-classmap": [ "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Samuel Roze", "email": "samuel.roze@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], "description": "Helps applications send and receive messages to/from other applications or via message queues", "homepage": "https://symfony.com", "support": { "source": "https://github.com/symfony/messenger/tree/v7.0.8" }, "funding": [ { "url": "https://symfony.com/sponsor", "type": "custom" }, { "url": "https://github.com/fabpot", "type": "github" }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], "time": "2024-05-31T14:55:39+00:00" }, { "name": "symfony/mime", "version": "v7.0.8", Loading Loading @@ -6351,7 +6437,8 @@ "platform": { "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*" "ext-iconv": "*", "ext-rdkafka": "*" }, "platform-dev": [], "plugin-api-version": "2.6.0" Loading