{code}
Tips Distributed Architecture
Meet the Team
COO
George
CEO
Elaine
Advisor
Susan
With built-in \( \LaTeX \) typesetting, you can include math formulas like this:
f(x) = \int_{-\infty}^\infty
\hat f(\xi)\,e^{2 \pi i \xi x}
\,d\xi
Get in touch
Our client team is ready to hear about your project. We're available by email or phone 24/7
+1 555 0194
Customiser Bash
### .bashrc
PROMPT_COMMAND=prompter
function prompter() {
export PS1="\[\e[32m\]$MICRO_SERVICE_NAME\[\e[m\] 🔥 \u$(_env)>"
}
function _env() {
ENV=$( ([[ -f /home/adminweb/bo/current/microservices/.env.local ]] && cat /home/adminweb/bo/current/microservices/.env.local || cat /home/adminweb/bo/current/microservices/.env) | grep "APP_ENV" | cut -f 2 -d"=" )
echo "(\[\e[33m\]$ENV\[\e[m\])"
}
alias l="ls -la"
### Dockerfile
COPY .bashrc /var/www/.bashrc
Makefile documented
.DEFAULT_GOAL := help
ifndef CI_JOB_ID
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
TARGET_MAX_CHAR_NUM=30
endif
help:
@echo "${GREEN}BO Meyclub${RESET} https://bo.meyclub.docker"
@echo "Micro Service: ${GREEN}$(MICRO_SERVICE_NAME)${RESET}"
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
isTopic = match(lastLine, /^###/); \
if (isTopic) { printf "\n%s\n", $$1; } \
} { lastLine = $$0 }' $(MAKEFILE_LIST)
#################################
RabbitMQ:
## Create RabbitMQ exchanges and queues and setup the bindings
rabbitmq: wait-rabbitmq
@$(SYMFONY) rabbitmq:setup-fabric
@$(RABBITMQ) sh -c 'rabbitmqctl add_vhost bpm'
@$(SYMFONY) messenger:setup-transports
## Delete all the queues
rabbitmq-reset: wait-rabbitmq
$(DOCKER_EXEC) rabbitmq rabbitmqctl stop_app
$(DOCKER_EXEC) rabbitmq rabbitmqctl reset
$(DOCKER_EXEC) rabbitmq rabbitmqctl start_app
## Run RabbitMQ consumer to sync_legacy_db
rabbitmq-consumer: rabbitmq
$(SYMFONY) rabbitmq:consumer sync_legacy_db
Logs
API_CONTAINERS = "gift-voucher-api" "mobile-api" "client-api" \
"common-api" "product-api" "supplier-api" "payment-method-api" \
"stock-api" "user-api" "search-api" "delivery-api" "invoice-api" \
"ticketing-api"
## View output from micro service containers
logs-ms:
$(DOCKER_COMPOSE) logs -f --tail 0 $(API_CONTAINERS)
Tester l'API GATEWAY
define api_command
@ for ms in $(API_CONTAINERS); \
do \
echo "MicroService: ${GREEN}$$ms${RESET}"; \
$(DOCKER_EXEC) --user www-data $$ms $1 || exit 1; \
done
endef
phpunit-api-gateway:
$(call api_command, ./bin/phpunit --group api-gateway --testsuite $$ms)
Optimiser le profiler
## Open the Symfony web profiler for Api.
profile:
@$(eval PROFILE_LINK = "https://bo.meyclub.docker/_profiler/latest")
@x-www-browser $(PROFILE_LINK) | google-chrome $(PROFILE_LINK) | open -a "Google Chrome" $(PROFILE_LINK)
Distributed Profiling
framework:
profiler:
only_exceptions: false
dsn: 'file:%kernel.project_dir%/var/profiler'
Merci !
Tout ça en 20mn
Code
By skigun
Code
- 341