The Makefile targets (migrate, ingest, shell) hardcoded api-dev, which fails when running in production mode. Now auto-detects whichever API container is active (dev or prod) via docker compose ps.
61 lines
1.4 KiB
Makefile
61 lines
1.4 KiB
Makefile
.PHONY: dev prod build logs down clean restart migrate ingest shell status
|
|
|
|
.DEFAULT_GOAL := dev
|
|
|
|
# Auto-detect which API container is running (dev or prod)
|
|
API_SVC := $(shell docker compose ps --format '{{.Service}}' 2>/dev/null | grep -m1 'api-' || echo 'api-prod')
|
|
|
|
# Development mode with hot reload
|
|
dev:
|
|
@echo "Starting pg_orrery Search in development mode..."
|
|
docker compose --profile dev up -d --build
|
|
@sleep 3
|
|
docker compose logs -f
|
|
|
|
# Production mode
|
|
prod:
|
|
@echo "Starting pg_orrery Search in production mode..."
|
|
docker compose --profile prod up -d --build
|
|
@sleep 3
|
|
docker compose logs -f
|
|
|
|
# Build without starting
|
|
build:
|
|
docker compose build
|
|
|
|
# View logs
|
|
logs:
|
|
docker compose logs -f
|
|
|
|
# Stop containers
|
|
down:
|
|
docker compose down
|
|
|
|
# Clean up containers, images, volumes
|
|
clean:
|
|
docker compose down -v --rmi local
|
|
|
|
# Restart
|
|
restart: down dev
|
|
|
|
# Run database migrations
|
|
migrate:
|
|
docker compose exec $(API_SVC) alembic upgrade head
|
|
|
|
# Run content ingestion
|
|
ingest:
|
|
docker compose exec $(API_SVC) python -m orrery_search.ingest
|
|
|
|
# Shell into running API container
|
|
shell:
|
|
docker compose exec $(API_SVC) bash
|
|
|
|
# Check vectorizer status
|
|
status:
|
|
docker compose exec db psql -U orrery -d orrery_search -c "SELECT * FROM ai.vectorizer_status;"
|
|
|
|
# Test search
|
|
test-search:
|
|
@echo "Testing search API..."
|
|
curl -s "https://$$(grep DOMAIN .env | cut -d= -f2)/api/search?q=satellite+tracking" | python3 -m json.tool
|