DC = docker compose -f /srv/sum/nohype/docker-compose.prod.yml WEB = $(DC) exec web MANAGE = $(WEB) python manage.py .DEFAULT_GOAL := help # ── Help ────────────────────────────────────────────────────────────────────── .PHONY: help help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-28s\033[0m %s\n", $$1, $$2}' \ | sort # ── Docker ──────────────────────────────────────────────────────────────────── .PHONY: build build: ## Build / rebuild images $(DC) build .PHONY: up up: ## Start services (detached) $(DC) up -d .PHONY: run run: ## Start services in foreground (with logs) $(DC) up .PHONY: down down: ## Stop and remove containers $(DC) down .PHONY: restart restart: ## Restart all services $(DC) restart .PHONY: logs logs: ## Tail logs for all services (Ctrl-C to stop) $(DC) logs -f .PHONY: logs-web logs-web: ## Tail web service logs $(DC) logs -f web .PHONY: ps ps: ## Show running containers $(DC) ps # ── Django ──────────────────────────────────────────────────────────────────── .PHONY: migrate migrate: ## Apply database migrations $(MANAGE) migrate --noinput .PHONY: makemigrations makemigrations: ## Create new migrations (pass app= to target an app) $(MANAGE) makemigrations $(app) .PHONY: showmigrations showmigrations: ## List all migrations and their status $(MANAGE) showmigrations .PHONY: createsuperuser createsuperuser: ## Create a Django superuser interactively $(MANAGE) createsuperuser .PHONY: collectstatic collectstatic: ## Collect static files $(MANAGE) collectstatic --noinput .PHONY: shell shell: ## Open a Django shell (inside the web container) $(MANAGE) shell .PHONY: dbshell dbshell: ## Open a Django database shell $(MANAGE) dbshell .PHONY: bash bash: ## Open a bash shell inside the web container $(WEB) bash .PHONY: psql psql: ## Open a psql shell in the db container $(DC) exec db psql -U nohype -d nohype # ── Tailwind ────────────────────────────────────────────────────────────────── .PHONY: tailwind-install tailwind-install: ## Install Tailwind npm dependencies $(MANAGE) tailwind install --no-input .PHONY: tailwind-build tailwind-build: ## Build Tailwind CSS $(MANAGE) tailwind build .PHONY: tailwind-watch tailwind-watch: ## Watch and rebuild Tailwind CSS on changes $(MANAGE) tailwind start # ── Testing ─────────────────────────────────────────────────────────────────── .PHONY: test test: ## Run unit/integration tests with pytest $(DC) exec web pytest $(args) .PHONY: test-e2e test-e2e: ## Run Playwright E2E tests $(DC) exec web pytest e2e/ $(args) # ── Custom management commands ──────────────────────────────────────────────── .PHONY: seed seed: ## Seed deterministic E2E content $(MANAGE) seed_e2e_content .PHONY: check-content check-content: ## Validate live content integrity $(MANAGE) check_content_integrity .PHONY: purge-comments purge-comments: ## Purge old comment personal data (pass months=N to override default 24) $(MANAGE) purge_old_comment_data $(if $(months),--months $(months),)