start project
This commit is contained in:
@@ -14,7 +14,11 @@ help: ## Show this help
|
||||
# --- Lifecycle ---------------------------------------------------------------
|
||||
.PHONY: env
|
||||
env: ## Create .env from the template (never overwrites an existing one)
|
||||
@test -f .env || (cp .env.example .env && echo "Created .env - review the secrets before deploying.")
|
||||
@test -f .env || (cp .env.example .env && echo "Created .env" && ./scripts/generate_secrets.sh)
|
||||
|
||||
.PHONY: secrets
|
||||
secrets: ## Replace any remaining change-me placeholders in .env with real secrets
|
||||
@./scripts/generate_secrets.sh
|
||||
|
||||
.PHONY: up
|
||||
up: env ## Build and start the whole stack
|
||||
@@ -27,16 +31,32 @@ up: env ## Build and start the whole stack
|
||||
dev: env ## Start the stack with hot reload (Vite on :5173, runserver on :8000)
|
||||
$(COMPOSE_DEV) up --build
|
||||
|
||||
.PHONY: prod-volumes
|
||||
prod-volumes: ## Create the external data volumes the production overlay expects
|
||||
@for v in postgres elasticsearch logstash; do \
|
||||
name="$${DATA_VOLUME_PREFIX:-linkedin-search}-$${v}-data"; \
|
||||
docker volume inspect "$$name" >/dev/null 2>&1 \
|
||||
&& echo " exists $$name" \
|
||||
|| (docker volume create "$$name" >/dev/null && echo " created $$name"); \
|
||||
done
|
||||
|
||||
.PHONY: prod-migrate
|
||||
prod-migrate: ## Apply database migrations once, before rolling out a new image
|
||||
$(COMPOSE_PROD) run --rm backend-migrate
|
||||
|
||||
.PHONY: prod
|
||||
prod: env ## Start with the production overlay
|
||||
prod: env prod-volumes ## Start with the production overlay
|
||||
$(COMPOSE_PROD) up --build -d
|
||||
@echo "Run 'make prod-migrate' to apply schema changes - production containers do not migrate on boot."
|
||||
|
||||
.PHONY: down
|
||||
down: ## Stop the stack (keeps volumes)
|
||||
$(COMPOSE) down
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Stop the stack and delete all volumes
|
||||
clean: ## Stop the stack and delete all volumes (DESTRUCTIVE - dev stack only)
|
||||
@echo "This deletes the database, the search index and the log queue of the *default* stack."
|
||||
@printf 'Type "yes" to continue: ' && read ans && [ "$$ans" = "yes" ]
|
||||
$(COMPOSE) down -v --remove-orphans
|
||||
|
||||
.PHONY: logs
|
||||
@@ -79,7 +99,7 @@ kibana-setup: ## Register the app-logs data view in Kibana
|
||||
# --- Quality -----------------------------------------------------------------
|
||||
.PHONY: test
|
||||
test: ## Run the backend test suite inside the stack
|
||||
$(COMPOSE) exec -e DJANGO_SETTINGS_MODULE=config.settings.test backend pytest
|
||||
$(COMPOSE) run --rm backend-test
|
||||
|
||||
.PHONY: test-local
|
||||
test-local: ## Run the backend test suite against a local PostgreSQL
|
||||
|
||||
Reference in New Issue
Block a user