A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: more robust Makefile
dextmorgn154cc74e8047
diff --git a/Makefile b/Makefileindex f99f966e..3b4d2723 100644--- a/Makefile+++ b/Makefile@@ -1,12 +1,15 @@# =====================# Global configuration# =====================+PROJECT_ROOT := $(shell pwd)-# Disable BuildKit for local stabilityexport DOCKER_BUILDKIT=0export COMPOSE_PARALLEL_LIMIT=1+COMPOSE_DEV := docker compose -f docker-compose.dev.yml+COMPOSE_PROD := docker compose -f docker-compose.prod.yml+.PHONY: \dev prod \build-dev build-prod \@@ -20,13 +23,6 @@ ENV_DIRS := . flowsint-api flowsint-core flowsint-app# Helpers# =====================-open-browser:- @echo "Waiting for frontend..."- @bash -c 'until curl -s http://localhost:5173 > /dev/null 2>&1; do sleep 1; done'- @open http://localhost:5173 2>/dev/null || \- xdg-open http://localhost:5173 2>/dev/null || \- echo "Frontend ready at http://localhost:5173"-check-env:@echo "Checking .env files..."@for dir in $(ENV_DIRS); do \@@ -38,32 +34,48 @@ check-env:fi; \done+open-browser:+ @echo "Waiting for frontend..."+ @bash -c 'until curl -s http://localhost:5173 > /dev/null 2>&1; do sleep 1; done'+ @open http://localhost:5173 2>/dev/null || \+ xdg-open http://localhost:5173 2>/dev/null || \+ echo "Frontend ready at http://localhost:5173"+# =====================-# Build targets+# Build# =====================build-dev:@echo "Building DEV images..."- docker compose -f docker-compose.dev.yml build+ $(COMPOSE_DEV) buildbuild-prod:@echo "Building PROD images..."- docker compose -f docker-compose.prod.yml build+ $(COMPOSE_PROD) build# =====================-# Up / Down+# Infra# =====================-up-dev:- docker compose -f docker-compose.dev.yml up -d --no-build+infra:+ @echo "Starting infra (postgres / redis / neo4j)..."+ $(COMPOSE_DEV) up -d postgres redis neo4j-up-prod:- docker compose -f docker-compose.prod.yml up -d --no-build+infra-stop:+ @echo "Stopping infra..."+ $(COMPOSE_DEV) stop postgres redis neo4j-down:- -docker compose -f docker-compose.dev.yml down- -docker compose -f docker-compose.prod.yml down- -docker compose down+# =====================+# Migrations+# =====================++migrate:+ @echo "Running migrations..."+ @if ! $(COMPOSE_DEV) ps -q neo4j | grep -q .; then \+ echo "Neo4j not running → starting infra"; \+ $(COMPOSE_DEV) up -d --wait neo4j; \+ fi+ yarn migrate# =====================# Main workflows@@ -72,19 +84,32 @@ down:dev:@echo "Starting DEV environment..."$(MAKE) check-env+ $(MAKE) infra$(MAKE) migrate$(MAKE) build-dev$(MAKE) up-dev$(MAKE) open-browser- docker compose -f docker-compose.dev.yml logs -f+ $(COMPOSE_DEV) logs -fprod:@echo "Starting PROD environment..."$(MAKE) check-env- $(MAKE) migrate$(MAKE) build-prod$(MAKE) up-prod- $(MAKE) open-browser++# =====================+# Up / Down+# =====================++up-dev:+ $(COMPOSE_DEV) up -d --no-build++up-prod:+ $(COMPOSE_PROD) up -d --no-build++down:+ -$(COMPOSE_DEV) down+ -$(COMPOSE_PROD) down# =====================# Local commands@@ -95,7 +120,7 @@ api:poetry run uvicorn app.main:app --host 0.0.0.0 --port 5001 --reloadfrontend:- docker compose up -d flowsint-app+ $(COMPOSE_DEV) up -d flowsint-app$(MAKE) open-browsercelery:@@ -103,31 +128,18 @@ celery:poetry run celery -A flowsint_core.core.celery \worker --loglevel=info --pool=threads --concurrency=10-# =====================-# Infra / DB-# =====================--infra:- docker compose up -d postgres redis neo4j--migrate:- @echo "Running migrations..."- docker compose up -d --wait neo4j- yarn migrate- docker compose stop neo4j-# =====================# Tests / Install# =====================test:- cd $(PROJECT_ROOT)/flowsint-types && poetry run pytest- cd $(PROJECT_ROOT)/flowsint-core && poetry run pytest- cd $(PROJECT_ROOT)/flowsint-enrichers && poetry run pytest+ cd flowsint-types && poetry run pytest+ cd flowsint-core && poetry run pytest+ cd flowsint-enrichers && poetry run pytestinstall:poetry config virtualenvs.in-project true --local- docker compose up -d postgres redis neo4j+ $(MAKE) infrapoetry installcd flowsint-core && poetry installcd flowsint-enrichers && poetry install@@ -141,8 +153,8 @@ clean:@echo "This will remove ALL Docker data. Continue? [y/N]"@read confirm; \if [ "$$confirm" != "y" ]; then exit 1; fi- -docker compose -f docker-compose.dev.yml down -v --rmi all --remove-orphans- -docker compose -f docker-compose.prod.yml down -v --rmi all --remove-orphans+ -$(COMPOSE_DEV) down -v --rmi all --remove-orphans+ -$(COMPOSE_PROD) down -v --rmi all --remove-orphansrm -rf flowsint-app/node_modulesrm -rf flowsint-core/.venvrm -rf flowsint-enrichers/.venv