veza/make/infra.mk
senke f9120c322b
Some checks failed
Backend API CI / test-unit (push) Failing after 0s
Backend API CI / test-integration (push) Failing after 0s
Frontend CI / test (push) Failing after 0s
Storybook Audit / Build & audit Storybook (push) Failing after 0s
Stream Server CI / test (push) Failing after 0s
release(v0.903): Vault - ORDER BY whitelist, rate limiter, VERSION sync, chat-server cleanup, Go 1.24
- ORDER BY dynamiques : whitelist explicite, fallback created_at DESC
- Login/register soumis au rate limiter global
- VERSION sync + check CI
- Nettoyage références veza-chat-server
- Go 1.24 partout (Dockerfile, workflows)
- TODO/FIXME/HACK convertis en issues ou résolus
2026-02-27 09:43:25 +01:00

47 lines
2.5 KiB
Makefile

# ==============================================================================
# INFRASTRUCTURE (Docker: Postgres, Redis, RabbitMQ)
# ==============================================================================
.PHONY: infra-up infra-down wait-for-infra wait-for-services db-shell redis-shell rabbitmq-shell db-migrate
infra-up: ## [MID] Start Docker Infra (with health checks)
@$(ECHO_CMD) "${BLUE}🐳 Starting Infrastructure...${NC}"
@docker compose -f $(COMPOSE_FILE) up -d
@$(MAKE) -s wait-for-infra
infra-down: ## [MID] Stop Docker Infra
@$(ECHO_CMD) "${BLUE}🛑 Stopping Infrastructure...${NC}"
@docker compose -f $(COMPOSE_FILE) down
wait-for-infra: ## [LOW] Wait for infrastructure to be ready (Postgres, Redis, RabbitMQ)
@printf "${BLUE}⏳ Waiting for services...${NC}"
@until docker compose -f $(COMPOSE_FILE) exec -T postgres pg_isready -U $(DB_USER) > /dev/null 2>&1; do printf "."; sleep 1; done
@until docker compose -f $(COMPOSE_FILE) exec -T redis redis-cli ping > /dev/null 2>&1; do printf "."; sleep 1; done
@until docker compose -f $(COMPOSE_FILE) exec -T rabbitmq rabbitmq-diagnostics -q ping > /dev/null 2>&1; do printf "."; sleep 1; done
@$(ECHO_CMD) " ${GREEN}OK${NC}"
wait-for-services: ## [LOW] Wait for all application services
@printf "${BLUE}⏳ Waiting for services...${NC}"
@for service in backend-api stream-server web; do \
until docker compose -f $(COMPOSE_PROD) exec -T $$service echo "ready" > /dev/null 2>&1; do \
printf "."; sleep 1; \
done; \
done
@$(ECHO_CMD) " ${GREEN}OK${NC}"
db-shell: ## [MID] Connect to Postgres shell
@docker compose -f $(COMPOSE_FILE) exec postgres psql -U $(DB_USER) -d $(DB_NAME)
redis-shell: ## [MID] Connect to Redis shell
@docker compose -f $(COMPOSE_FILE) exec redis redis-cli
rabbitmq-shell: ## [MID] Connect to RabbitMQ management (browser: http://$(APP_DOMAIN):$(PORT_RABBITMQ_MGMT))
@$(ECHO_CMD) "${BLUE}RabbitMQ Management: http://$(APP_DOMAIN):$(PORT_RABBITMQ_MGMT) (user: $(DB_USER), pass: $(DB_PASS))${NC}"
db-migrate: infra-up ## [MID] Run all database migrations
@$(ECHO_CMD) "${BLUE}🔄 Running Migrations...${NC}"
@$(ECHO_CMD) " -> [Go] Migrating..."
@(cd $(ROOT)/$(SERVICE_DIR_backend-api) && go run cmd/migrate_tool/main.go up || $(ECHO_CMD) "${YELLOW}Warning: Go migration failed${NC}")
@$(ECHO_CMD) " -> [Stream] Migrating..."
@(cd $(ROOT)/$(SERVICE_DIR_stream-server) && sqlx migrate run || $(ECHO_CMD) "${YELLOW}Warning: Stream migration failed${NC}")
@$(ECHO_CMD) "${GREEN}✅ Migrations done.${NC}"