refactor: full-stack restructure with multi-tenancy, workspace management, and K8s diagnostics
- Add Workspace domain (entity, repository, service, handler, DTO) - Add multi-tenant K8s client with tenant binding and quota management - Add K8s diagnostics client (instance diagnostics) - Add authorization middleware (authz package) - Restructure frontend to feature-based architecture (features/) - Add User Management page in configuration - Add AccessDenied page and route guards - Refactor shared components (form inputs, layout, UI) - Update Tailwind config for new design system - Add comprehensive documentation (docs/, tasks/, plans) - Improve cluster service with better kubeconfig handling - Add tests for crypto, config, helm client, tenant binding
This commit is contained in:
88
Makefile
88
Makefile
@ -1,56 +1,68 @@
|
||||
# ============================================================
|
||||
# OCDP stack orchestration Makefile
|
||||
# run-2: 构建前端静态资源 + 启动 nginx(统一入口)和 backend 栈
|
||||
# clean-2: 清理 run-2 产生的容器 / 卷 / 网络
|
||||
# OCDP root orchestration Makefile
|
||||
# ============================================================
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
COMPOSE_BIN ?= docker compose
|
||||
|
||||
ROOT_COMPOSE := docker-compose.yml
|
||||
BACKEND_COMPOSE := backend/docker-compose.yml
|
||||
BACKEND_PROFILE := backend
|
||||
COMPOSE := $(COMPOSE_BIN) -f $(ROOT_COMPOSE)
|
||||
|
||||
COMPOSE_STACK := $(COMPOSE_BIN) -f $(ROOT_COMPOSE) -f $(BACKEND_COMPOSE) --profile $(BACKEND_PROFILE)
|
||||
COMPOSE_STACK_ALL := $(COMPOSE_BIN) -f $(ROOT_COMPOSE) -f $(BACKEND_COMPOSE)
|
||||
STACK_ENV := ADAPTER_MODE=production BACKEND_BUILD_CONTEXT=$(abspath backend) BACKEND_BUILD_DOCKERFILE=$(abspath backend/Dockerfile) BACKEND_MOCK_BUILD_DOCKERFILE=$(abspath backend/Dockerfile.mock) INIT_DB_SQL_PATH=$(abspath backend/scripts/init-db.sql)
|
||||
.PHONY: help install run-2 clean-2 docker-dev docker-prod docker-up docker-down docker-logs docker-ps test
|
||||
|
||||
STACK_SERVICES := postgres backend nginx
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
.PHONY: run-2 clean-2 build-backend
|
||||
help:
|
||||
@echo ""
|
||||
@echo "OCDP commands"
|
||||
@echo "────────────────────────────────────────"
|
||||
@echo " make install Install local Go / frontend dependencies"
|
||||
@echo " make run-2 Build and start full Docker Compose stack in background"
|
||||
@echo " make docker-dev Alias of run-2, kept for old docs / muscle memory"
|
||||
@echo " make docker-prod Alias of run-2"
|
||||
@echo " make docker-up Alias of run-2"
|
||||
@echo " make docker-down Stop containers, keep volumes"
|
||||
@echo " make clean-2 Stop containers and remove project volumes"
|
||||
@echo " make docker-logs Follow Compose logs"
|
||||
@echo " make docker-ps Show Compose service status"
|
||||
@echo " make test Run structured verification script"
|
||||
@echo ""
|
||||
@echo "Default local ports: web=18080, https=18443, backend=18081, postgres=15432"
|
||||
@echo "Override with WEB_HTTP_PORT / WEB_HTTPS_PORT / BACKEND_PORT / POSTGRES_PORT."
|
||||
@echo ""
|
||||
|
||||
install:
|
||||
@echo "→ Downloading backend modules"
|
||||
@cd backend && go mod download
|
||||
@echo "→ Installing frontend dependencies"
|
||||
@cd frontend && npm ci
|
||||
|
||||
run-2:
|
||||
@echo "═══════════════════════════════════════════════"
|
||||
@echo "🚀 run-2: rebuild static assets + start web gateway stack"
|
||||
@echo "═══════════════════════════════════════════════"
|
||||
@echo "→ Building and starting OCDP stack"
|
||||
@$(COMPOSE) up --build -d postgres backend nginx
|
||||
@echo ""
|
||||
@export COMPOSE_PROJECT_NAME=ocdp && \
|
||||
export ADAPTER_MODE=production && \
|
||||
export BACKEND_BUILD_CONTEXT=$(abspath backend) && \
|
||||
export BACKEND_BUILD_DOCKERFILE=$(abspath backend/Dockerfile) && \
|
||||
export BACKEND_MOCK_BUILD_DOCKERFILE=$(abspath backend/Dockerfile.mock) && \
|
||||
export INIT_DB_SQL_PATH=$(abspath backend/scripts/init-db.sql) && \
|
||||
echo "→ Rebuilding frontend static assets" && \
|
||||
$(COMPOSE_STACK) run --rm frontend-build && \
|
||||
echo "" && \
|
||||
echo "→ Rebuilding backend image" && \
|
||||
$(COMPOSE_STACK) build backend && \
|
||||
echo "" && \
|
||||
echo "→ Bringing up backend + nginx services" && \
|
||||
$(COMPOSE_STACK) up -d $(STACK_SERVICES)
|
||||
@$(COMPOSE) ps
|
||||
@echo ""
|
||||
@echo "✅ Services online:"
|
||||
@echo "═══════════════════════════════════════════════"
|
||||
@echo "Web: http://localhost:$${WEB_HTTP_PORT:-18080}"
|
||||
@echo "Backend: http://localhost:$${BACKEND_PORT:-18081}/health"
|
||||
|
||||
docker-dev: run-2
|
||||
|
||||
docker-prod: run-2
|
||||
|
||||
docker-up: run-2
|
||||
|
||||
docker-down:
|
||||
@$(COMPOSE) down --remove-orphans
|
||||
|
||||
clean-2:
|
||||
@echo "═══════════════════════════════════════════════"
|
||||
@echo "🧹 clean-2: tearing down run-2 stack"
|
||||
@echo "═══════════════════════════════════════════════"
|
||||
@$(COMPOSE_STACK_ALL) down --remove-orphans || true
|
||||
@$(COMPOSE_STACK_ALL) down -v --remove-orphans || true
|
||||
@$(COMPOSE_BIN) -f $(BACKEND_COMPOSE) down -v --remove-orphans || true
|
||||
@echo "✅ Environment cleaned"
|
||||
@echo "═══════════════════════════════════════════════"
|
||||
@$(COMPOSE) down -v --remove-orphans
|
||||
|
||||
docker-logs:
|
||||
@$(COMPOSE) logs -f
|
||||
|
||||
docker-ps:
|
||||
@$(COMPOSE) ps
|
||||
|
||||
test:
|
||||
@test/readme-deployment-refresh.sh
|
||||
|
||||
Reference in New Issue
Block a user