- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
181 lines
5.5 KiB
Makefile
181 lines
5.5 KiB
Makefile
# ----------------------------------
|
|
# Projekt: michaelschiemer.de
|
|
# Docker & Ansible Makefile
|
|
# ----------------------------------
|
|
|
|
PROJECT_NAME = michaelschiemer
|
|
ENV ?= dev
|
|
|
|
# Standart Docker Compose Befehle
|
|
|
|
up: ## Startet alle Docker-Container
|
|
docker compose up -d
|
|
|
|
down: ## Stoppt alle Container
|
|
docker compose down
|
|
|
|
build:
|
|
docker compose build
|
|
|
|
restart: ## Neustart aller Container
|
|
./bin/restart
|
|
|
|
logs: ## Zeigt Logs aus Docker
|
|
docker compose logs -f
|
|
|
|
ps: ## Docker PS
|
|
docker compose ps
|
|
|
|
reload: ## Dump Autoload & Restart PHP
|
|
docker-compose exec php composer dump-autoload -o
|
|
docker-compose restart php
|
|
|
|
flush-redis: ## Clear Redis cache (FLUSHALL)
|
|
docker exec redis redis-cli FLUSHALL
|
|
|
|
|
|
# Wähle dev- oder prod-PHP-Konfig je nach ENV
|
|
phpinfo:
|
|
@echo "Aktive PHP-Konfiguration: php.$(ENV).ini"
|
|
|
|
# Ansible Deployment
|
|
|
|
setup: ## Führt Ansible Setup aus
|
|
./bin/setup
|
|
|
|
deploy: ## Führt Ansible Deploy aus
|
|
./bin/deploy
|
|
|
|
test: ## Führt alle Tests aus
|
|
docker exec php ./vendor/bin/pest
|
|
|
|
test-coverage: ## Führt Tests mit Coverage-Report aus
|
|
docker exec php ./vendor/bin/pest --coverage
|
|
|
|
test-coverage-html: ## Generiert HTML Coverage-Report
|
|
docker exec php ./vendor/bin/pest --coverage-html coverage-html
|
|
@echo "📊 Coverage-Report verfügbar unter: coverage-html/index.html"
|
|
|
|
test-unit: ## Führt nur Unit-Tests aus
|
|
docker exec php ./vendor/bin/pest tests/Unit/
|
|
|
|
test-framework: ## Führt nur Framework-Tests aus
|
|
docker exec php ./vendor/bin/pest tests/Framework/
|
|
|
|
test-domain: ## Führt nur Domain-Tests aus
|
|
docker exec php ./vendor/bin/pest tests/Domain/
|
|
|
|
test-watch: ## Führt Tests im Watch-Modus aus
|
|
docker exec php ./vendor/bin/pest --watch
|
|
|
|
test-parallel: ## Führt Tests parallel aus
|
|
docker exec php ./vendor/bin/pest --parallel
|
|
|
|
test-profile: ## Profiling der langsamsten Tests
|
|
docker exec php ./vendor/bin/pest --profile
|
|
|
|
test-filter: ## Führt spezifische Tests aus (Usage: make test-filter FILTER="EventDispatcher")
|
|
docker exec php ./vendor/bin/pest --filter="$(FILTER)"
|
|
|
|
# Cleanup temporärer/metadaten-Dateien
|
|
clean: ## Entfernt temporäre Dateien
|
|
find . -type f -name "*Zone.Identifier" -delete
|
|
find . -type f -name "*.retry" -delete
|
|
|
|
clean-coverage: ## Entfernt Coverage-Reports
|
|
rm -rf coverage-html/ coverage-xml/ coverage.txt
|
|
@echo "🧹 Coverage-Reports entfernt"
|
|
|
|
|
|
static: ## Generate Static Files
|
|
./bin/generate-static.php
|
|
|
|
# Projektstatus
|
|
status: ## Zeigt Container-Status
|
|
@echo "Aktuelles Projekt: $(PROJECT_NAME)"
|
|
@echo "Umgebung: $(ENV)"
|
|
|
|
doctor: ## Prüft ob Komponenten installiert sind
|
|
@echo "🔍 Prüfe Voraussetzungen..."
|
|
@which docker > /dev/null || echo "❌ Docker fehlt"
|
|
@which ansible-playbook > /dev/null || echo "❌ Ansible fehlt"
|
|
@test -f .env || echo "⚠️ .env-Datei fehlt"
|
|
|
|
# Helfer: Automatische Zielübersicht
|
|
help: ## Zeigt diese Hilfe an
|
|
@echo ""
|
|
@echo "🛠 Verfügbare Make-Befehle:"
|
|
@grep -E '^[a-zA-Z_-]+:.*?## ' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
|
|
@echo ""
|
|
|
|
|
|
console: ## Run console commands (Usage: make console ARGS="command arguments")
|
|
docker exec -it php php console.php $(ARGS)
|
|
|
|
|
|
|
|
composer: ## Use Composer
|
|
docker compose exec php composer $(ARGS)
|
|
|
|
fix-perms: ## Fix permissions
|
|
sudo chown -R $(USER):$(USER) .
|
|
|
|
cs:
|
|
@$(MAKE) composer ARGS="cs"
|
|
|
|
cs-fix-file: ## Fix code style for a specific file
|
|
docker compose exec -e PHP_CS_FIXER_IGNORE_ENV=1 php ./vendor/bin/php-cs-fixer fix $(subst \,/,$(FILE))
|
|
|
|
cs-fix: ## Fix code style for all PHP files
|
|
docker compose exec -e PHP_CS_FIXER_IGNORE_ENV=1 php ./vendor/bin/php-cs-fixer fix
|
|
|
|
phpstan: ## Run PHPStan static analysis
|
|
@$(MAKE) composer ARGS="phpstan"
|
|
|
|
phpstan-baseline: ## Generate PHPStan baseline
|
|
@$(MAKE) composer ARGS="phpstan-baseline"
|
|
|
|
setup-ssh: ## SSH-Schlüssel korrekt einrichten
|
|
mkdir -p ~/.ssh
|
|
cp /mnt/c/Users/Mike/.ssh/test.michaelschiemer.de ~/.ssh/staging
|
|
chmod 600 ~/.ssh/staging
|
|
@echo "SSH-Schlüssel für Staging korrekt eingerichtet"
|
|
|
|
fix-ssh-perms: ## Korrigiert SSH-Schlüsselberechtigungen (veraltet)
|
|
chmod 600 /mnt/c/Users/Mike/.ssh/test.michaelschiemer.de
|
|
@echo "SSH-Schlüsselberechtigungen korrigiert"
|
|
|
|
health:
|
|
ansible-playbook ansible/check.yml
|
|
|
|
|
|
# Ansible Konfiguration
|
|
ANSIBLE_INVENTORY=ansible/inventory/hosts.ini
|
|
PLAYBOOK_DIR=ansible/playbooks/deploy
|
|
TAGS=
|
|
|
|
.PHONY: dev staging production setup-server check
|
|
|
|
# Deployment-Ziele
|
|
dev: ## Lokales Deployment (Development)
|
|
ansible-playbook -i $(ANSIBLE_INVENTORY) $(PLAYBOOK_DIR)/dev.yml --ask-become-pass $(if $(TAGS),--tags="$(TAGS)",)
|
|
|
|
staging: ## Staging-Deployment
|
|
ansible-playbook -i $(ANSIBLE_INVENTORY) $(PLAYBOOK_DIR)/staging.yml $(if $(TAGS),--tags="$(TAGS)",)
|
|
|
|
production: ## Produktions-Deployment
|
|
ansible-playbook -i $(ANSIBLE_INVENTORY) $(PLAYBOOK_DIR)/production.yml $(if $(TAGS),--tags="$(TAGS)",)
|
|
|
|
setup-server: ## Server-Grundkonfiguration
|
|
ansible-playbook -i $(ANSIBLE_INVENTORY) ansible/setup.yml $(if $(LIMIT),--limit="$(LIMIT)",) $(if $(TAGS),--tags="$(TAGS)",)
|
|
|
|
check: ## Serververbindung prüfen
|
|
ansible -i $(ANSIBLE_INVENTORY) all -m ping $(if $(LIMIT),--limit="$(LIMIT)",)
|
|
|
|
|
|
# Beispielaufrufe:
|
|
# make staging TAGS="deploy,check"
|
|
# make setup-server LIMIT="staging" TAGS="docker"
|
|
|
|
.PHONY: up down build restart logs ps phpinfo deploy setup clean clean-coverage status fix-ssh-perms setup-ssh test test-coverage test-coverage-html test-unit test-framework test-domain test-watch test-parallel test-profile test-filter
|