chore: sync all local changes and new files
- Update next.config.ts - Add netlify.toml, Docker configs, e2e tests - Add env templates, docs (README, ROADMAP, TODO) - Add vitest/playwright test configs - Add component and lib tests - Add install script, portainer env template - Update .gitignore (tsbuildinfo, deno.lock, dev.db)
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
.PHONY: help install build up down restart logs health backup deploy clean \
|
||||
ummahid-logs wallet-logs ramz-logs mocknet-logs api-logs app-logs \
|
||||
db-shell db-backup db-restore redis-shell redis-flush \
|
||||
stats ps setup env-check test test-watch test-coverage
|
||||
|
||||
# Falah OS v1.3 — Docker Compose management
|
||||
# Usage: make help
|
||||
|
||||
help: ## Show available commands
|
||||
@echo "Falah OS v1.3"
|
||||
@echo ""
|
||||
@echo "Usage: make [command]"
|
||||
@echo ""
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Core lifecycle
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
install: ## Full install: generate secrets, write .env, start stack, health check
|
||||
@bash install.sh
|
||||
|
||||
setup: ## First-time setup: copy .env.example → .env (manual secret entry)
|
||||
@if [ -f .env ]; then echo ".env already exists, skipping."; else cp .env.example .env && echo "Created .env — fill in secrets before running 'make up'"; fi
|
||||
|
||||
env-check: ## Verify required env vars are set
|
||||
@missing=0; \
|
||||
for var in JWT_SECRET ENCRYPTION_KEY ADMIN_SECRET POSTGRES_PASSWORD REDIS_PASSWORD; do \
|
||||
if [ -z "$$(grep -E "^$$var=.+" .env 2>/dev/null | cut -d= -f2)" ]; then \
|
||||
echo "MISSING: $$var"; missing=1; \
|
||||
fi; \
|
||||
done; \
|
||||
[ $$missing -eq 0 ] && echo "All required env vars are set." || exit 1
|
||||
|
||||
test: ## Run all tests
|
||||
npm test
|
||||
|
||||
test-watch: ## Run tests in watch mode
|
||||
npm run test:watch
|
||||
|
||||
test-coverage: ## Run tests with coverage report
|
||||
npm run test:coverage
|
||||
|
||||
build: ## Build all service images
|
||||
docker compose build
|
||||
|
||||
up: env-check ## Start the full stack
|
||||
docker compose up -d
|
||||
@echo "Waiting for services..."
|
||||
@sleep 8
|
||||
@$(MAKE) health
|
||||
|
||||
down: ## Stop and remove containers (preserves volumes)
|
||||
docker compose down
|
||||
|
||||
restart: ## Restart all containers
|
||||
docker compose restart
|
||||
|
||||
logs: ## Tail logs from all services
|
||||
docker compose logs -f --tail=100
|
||||
|
||||
health: ## Run health checks against all services
|
||||
@./scripts/health-check.sh
|
||||
|
||||
ps: ## Show container status
|
||||
docker compose ps
|
||||
|
||||
stats: ## Live container resource usage
|
||||
docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}"
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Per-service logs
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
ummahid-logs: ## Tail Ummah ID logs
|
||||
docker compose logs -f ummahid
|
||||
|
||||
wallet-logs: ## Tail Wallet logs
|
||||
docker compose logs -f wallet
|
||||
|
||||
ramz-logs: ## Tail RAMZ logs
|
||||
docker compose logs -f ramz
|
||||
|
||||
mocknet-logs: ## Tail Mock-Net logs
|
||||
docker compose logs -f mocknet
|
||||
|
||||
falahd-logs: ## Tail falahd daemon logs
|
||||
docker compose logs -f falahd
|
||||
|
||||
api-logs: ## Tail API Gateway logs
|
||||
docker compose logs -f api-gateway
|
||||
|
||||
app-logs: ## Tail App logs
|
||||
docker compose logs -f app
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Database
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
db-shell: ## Open PostgreSQL shell
|
||||
docker compose exec postgres psql -U $${POSTGRES_USER:-postgres}
|
||||
|
||||
db-backup: ## Dump all databases to backups/
|
||||
@mkdir -p backups
|
||||
docker compose exec postgres pg_dumpall -U $${POSTGRES_USER:-postgres} \
|
||||
| gzip > backups/postgres_$$(date +%Y%m%d_%H%M%S).sql.gz
|
||||
@echo "Backup saved to backups/"
|
||||
|
||||
db-restore: ## Restore from backup: make db-restore FILE=backups/postgres_xxx.sql.gz
|
||||
@[ -n "$(FILE)" ] || (echo "Usage: make db-restore FILE=backups/postgres_xxx.sql.gz" && exit 1)
|
||||
gunzip -c $(FILE) | docker compose exec -T postgres psql -U $${POSTGRES_USER:-postgres}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Redis
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
redis-shell: ## Open Redis CLI
|
||||
docker compose exec redis redis-cli -a $${REDIS_PASSWORD}
|
||||
|
||||
redis-flush: ## Flush all Redis data (will prompt for confirmation)
|
||||
@echo "WARNING: this deletes all Redis data."
|
||||
@read -p "Type 'yes' to confirm: " c && [ "$$c" = "yes" ] || exit 1
|
||||
docker compose exec redis redis-cli -a $${REDIS_PASSWORD} FLUSHALL
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
clean: ## Remove containers AND volumes (destroys all data — prompts first)
|
||||
@echo "WARNING: this destroys all Falah OS containers and volumes."
|
||||
@read -p "Type 'yes' to confirm: " c && [ "$$c" = "yes" ] || exit 1
|
||||
docker compose down -v
|
||||
@echo "Done. Run 'make up' to start fresh."
|
||||
Reference in New Issue
Block a user