Initial Commit
This commit is contained in:
103
Makefile
103
Makefile
@@ -1,42 +1,54 @@
|
||||
.PHONY: help setup start dev stop clean test logs shell-backend shell-frontend migrate rebuild
|
||||
.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"
|
||||
@echo " make rebuild - Rebuild and restart containers (for code changes)"
|
||||
@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 tests in containers"
|
||||
@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..."
|
||||
@cp .env.example .env
|
||||
@echo "Please update .env with your Auth0 and API credentials"
|
||||
@echo "Building and starting all services..."
|
||||
@docker compose up -d --build
|
||||
@echo "✅ All services started!"
|
||||
@echo "Frontend: http://localhost:3000"
|
||||
@echo "Backend: http://localhost:3001"
|
||||
@echo "MinIO Console: http://localhost:9001"
|
||||
@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
|
||||
@echo "✅ Application running!"
|
||||
@echo "Frontend: http://localhost:3000"
|
||||
@echo "Backend: http://localhost:3001/health"
|
||||
@echo "View logs with: make logs"
|
||||
|
||||
# Alias for backward compatibility
|
||||
dev: start
|
||||
@docker compose up -d --build --remove-orphans
|
||||
@echo "Application running!"
|
||||
|
||||
stop:
|
||||
@docker compose down
|
||||
@@ -48,30 +60,55 @@ clean:
|
||||
|
||||
test:
|
||||
@echo "Running backend tests in container..."
|
||||
@docker compose exec backend npm test
|
||||
@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 backend
|
||||
@docker compose logs -f admin-backend
|
||||
|
||||
logs-frontend:
|
||||
@docker compose logs -f frontend
|
||||
@docker compose logs -f admin-frontend
|
||||
|
||||
shell-backend:
|
||||
@docker compose exec backend sh
|
||||
@docker compose exec admin-backend sh
|
||||
|
||||
shell-frontend:
|
||||
@docker compose exec frontend sh
|
||||
@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
|
||||
@echo "✅ Containers rebuilt and restarted!"
|
||||
@echo "Frontend: http://localhost:3000"
|
||||
@echo "Backend: http://localhost:3001/health"
|
||||
@docker compose up -d --build --remove-orphans
|
||||
@echo "Containers rebuilt and restarted!"
|
||||
|
||||
migrate:
|
||||
@echo "Running database migrations..."
|
||||
@docker compose exec backend npm run migrate:all
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user