115 lines
4.4 KiB
Makefile
115 lines
4.4 KiB
Makefile
.PHONY: help setup start stop clean test test-frontend logs shell-backend shell-frontend migrate rebuild etl-load-manual etl-validate-json etl-shell
|
|
|
|
help:
|
|
@echo "MotoVaultPro - Production-Ready Modified Feature Capsule Architecture"
|
|
@echo "Commands:"
|
|
@echo " make setup - Initial project setup"
|
|
@echo " make start - Start all services (production mode)"
|
|
@echo " make rebuild - Rebuild and restart containers (production)"
|
|
@echo " make stop - Stop all services"
|
|
@echo " make clean - Clean all data and volumes"
|
|
@echo " make test - Run backend + frontend tests"
|
|
@echo " make test-frontend - Run frontend tests in container"
|
|
@echo " make logs - View logs from all services"
|
|
@echo " make logs-backend - View backend logs only"
|
|
@echo " make logs-frontend - View frontend logs only"
|
|
@echo " make shell-backend - Open shell in backend container"
|
|
@echo " make shell-frontend- Open shell in frontend container"
|
|
@echo " make migrate - Run database migrations"
|
|
@echo ""
|
|
@echo "Vehicle ETL Commands:"
|
|
@echo " make etl-load-manual - Load vehicle data from JSON files (append mode)"
|
|
@echo " make etl-load-clear - Load vehicle data from JSON files (clear mode)"
|
|
@echo " make etl-validate-json - Validate JSON files without loading"
|
|
@echo " make etl-shell - Open shell in ETL container"
|
|
|
|
setup:
|
|
@echo "Setting up MotoVaultPro development environment..."
|
|
@echo "1. Checking if .env file exists..."
|
|
@if [ ! -f .env ]; then \
|
|
echo "ERROR: .env file not found. Please create .env file with required environment variables."; \
|
|
echo "See .env.example for reference."; \
|
|
exit 1; \
|
|
fi
|
|
@echo "2. Building and starting all containers..."
|
|
@docker compose up -d --build --remove-orphans
|
|
@echo "3. Running database migrations..."
|
|
@sleep 10 # Wait for databases to be ready
|
|
@docker compose exec admin-backend node dist/_system/migrations/run-all.js
|
|
@echo ""
|
|
@echo "✅ Setup complete!"
|
|
@echo "Access application at: https://admin.motovaultpro.com"
|
|
@echo "Access platform landing at: https://motovaultpro.com"
|
|
@echo "Backend API health: http://localhost:3001/health"
|
|
@echo ""
|
|
@echo "Remember to add to /etc/hosts:"
|
|
@echo "127.0.0.1 motovaultpro.com admin.motovaultpro.com"
|
|
|
|
start:
|
|
@echo "Starting application services..."
|
|
@docker compose up -d --build --remove-orphans
|
|
@echo "Application running!"
|
|
|
|
stop:
|
|
@docker compose down
|
|
|
|
clean:
|
|
@echo "Cleaning up all containers, volumes, and images..."
|
|
@docker compose down -v --rmi all
|
|
@docker system prune -f
|
|
|
|
test:
|
|
@echo "Running backend tests in container..."
|
|
@docker compose exec admin-backend npm test
|
|
@echo "\nRunning frontend tests in container..."
|
|
@docker run --rm -v $(PWD)/frontend:/app -w /app node:20-alpine sh -lc 'npm install && npm test'
|
|
|
|
test-frontend:
|
|
@echo "Running frontend tests in container..."
|
|
@docker run --rm -v $(PWD)/frontend:/app -w /app node:20-alpine sh -lc 'npm install && npm test'
|
|
|
|
logs:
|
|
@docker compose logs -f
|
|
|
|
logs-backend:
|
|
@docker compose logs -f admin-backend
|
|
|
|
logs-frontend:
|
|
@docker compose logs -f admin-frontend
|
|
|
|
shell-backend:
|
|
@docker compose exec admin-backend sh
|
|
|
|
shell-frontend:
|
|
@docker compose exec admin-frontend sh
|
|
|
|
migrate:
|
|
@echo "Running application database migrations..."
|
|
@docker compose exec admin-backend node dist/_system/migrations/run-all.js
|
|
@echo "Migrations completed."
|
|
|
|
rebuild:
|
|
@echo "Rebuilding containers with latest code changes..."
|
|
@docker compose up -d --build --remove-orphans
|
|
@echo "Containers rebuilt and restarted!"
|
|
|
|
# Vehicle ETL Commands
|
|
etl-load-manual:
|
|
@echo "Loading vehicle data from JSON files (append mode)..."
|
|
@docker compose --profile manual run --rm mvp-platform-vehicles-etl-manual python -m etl load-manual --sources-dir etl/sources/makes --mode append --verbose
|
|
@echo "Manual JSON loading completed!"
|
|
|
|
etl-load-clear:
|
|
@echo "Loading vehicle data from JSON files (clear mode - WARNING: destructive)..."
|
|
@docker compose --profile manual run --rm mvp-platform-vehicles-etl-manual python -m etl load-manual --sources-dir etl/sources/makes --mode clear --verbose
|
|
@echo "Manual JSON loading completed!"
|
|
|
|
etl-validate-json:
|
|
@echo "Validating JSON vehicle data files..."
|
|
@docker compose --profile manual run --rm mvp-platform-vehicles-etl-manual python -m etl validate-json --sources-dir etl/sources/makes --verbose
|
|
@echo "JSON validation completed!"
|
|
|
|
etl-shell:
|
|
@echo "Opening shell in ETL container..."
|
|
@docker compose --profile manual run --rm mvp-platform-vehicles-etl-manual sh
|