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 .gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -2,3 +2,4 @@ /.vscode/ .env /app/public/uploads/ 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 README.md +15 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,21 @@ ## Инструкция ## Kafka <details> <summary>Инструкция</summary> 1. Создание топика 1. Запустить команду - `make create-kafka-topic` 2. Запуск воркера 1. Перейти в командную строку php - `make shell` 2. Запустить команду - `bin/console messenger:consume send_transport` 3. Остановка воркера 1. Перейти в командную строку php - `make shell` 2. Запустить команду - `bin/console messenger:stop-workers` </details> ## Настройка Xdebug (PHPStorm) <details> <summary>Инструкция</summary> Loading 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 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
.gitignore +1 −0 Original line number Diff line number Diff line Loading @@ -2,3 +2,4 @@ /.vscode/ .env /app/public/uploads/
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
README.md +15 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,21 @@ ## Инструкция ## Kafka <details> <summary>Инструкция</summary> 1. Создание топика 1. Запустить команду - `make create-kafka-topic` 2. Запуск воркера 1. Перейти в командную строку php - `make shell` 2. Запустить команду - `bin/console messenger:consume send_transport` 3. Остановка воркера 1. Перейти в командную строку php - `make shell` 2. Запустить команду - `bin/console messenger:stop-workers` </details> ## Настройка Xdebug (PHPStorm) <details> <summary>Инструкция</summary> Loading
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