前端项目结构

This commit is contained in:
2025-12-02 15:55:30 +08:00
parent 2a9e624ba9
commit 28787e5b29
18 changed files with 2545 additions and 2167 deletions

116
Makefile Normal file
View File

@@ -0,0 +1,116 @@
# Urban Lifeline 开发环境快捷命令
.PHONY: help up down logs restart clean build ps
# 默认目标
.DEFAULT_GOAL := help
# 帮助信息
help:
@echo "========================================="
@echo " 泰豪电源 Urban Lifeline 开发环境"
@echo "========================================="
@echo ""
@echo "可用命令:"
@echo " make up - 启动所有服务"
@echo " make down - 停止所有服务"
@echo " make restart - 重启所有服务"
@echo " make logs - 查看所有服务日志"
@echo " make ps - 查看服务状态"
@echo " make build - 重新构建镜像"
@echo " make clean - 清理所有数据(慎用)"
@echo ""
@echo "单独服务操作:"
@echo " make logs-portal - 查看主应用日志"
@echo " make logs-gateway - 查看网关日志"
@echo " make restart-portal - 重启主应用"
@echo " make shell-portal - 进入主应用容器"
@echo ""
# 启动所有服务
up:
@echo "启动开发环境..."
docker-compose -f docker-compose.dev.yml up -d
@echo "服务启动中,请稍候..."
@sleep 5
@echo ""
@echo "访问地址:"
@echo " 主应用: http://localhost"
@echo " 招投标: http://localhost/bidding"
@echo " 智能客服: http://localhost/customer-service"
@echo " Gateway: http://localhost/api"
@echo " Nacos: http://localhost/nacos"
@echo ""
# 停止所有服务
down:
@echo "停止所有服务..."
docker-compose -f docker-compose.dev.yml down
# 查看日志
logs:
docker-compose -f docker-compose.dev.yml logs -f
# 重启所有服务
restart:
@echo "重启所有服务..."
docker-compose -f docker-compose.dev.yml restart
# 查看服务状态
ps:
docker-compose -f docker-compose.dev.yml ps
# 重新构建镜像
build:
@echo "重新构建所有镜像..."
docker-compose -f docker-compose.dev.yml build --no-cache
# 清理所有数据(危险操作)
clean:
@echo "警告:此操作将删除所有容器、数据卷和镜像!"
@read -p "确认继续吗?(y/N): " confirm && [ "$$confirm" = "y" ] || exit 1
docker-compose -f docker-compose.dev.yml down -v
docker system prune -af
# ==================== 单独服务操作 ====================
# Portal 日志
logs-portal:
docker-compose -f docker-compose.dev.yml logs -f portal
# Gateway 日志
logs-gateway:
docker-compose -f docker-compose.dev.yml logs -f gateway
# Nginx 日志
logs-nginx:
docker-compose -f docker-compose.dev.yml logs -f nginx
# 共享包日志
logs-shared:
docker-compose -f docker-compose.dev.yml logs -f shared
# 重启 Portal
restart-portal:
docker-compose -f docker-compose.dev.yml restart portal
# 重启 Gateway
restart-gateway:
docker-compose -f docker-compose.dev.yml restart gateway
# 进入 Portal 容器
shell-portal:
docker-compose -f docker-compose.dev.yml exec portal sh
# 进入 Gateway 容器
shell-gateway:
docker-compose -f docker-compose.dev.yml exec gateway sh
# 进入数据库
db:
docker-compose -f docker-compose.dev.yml exec postgres psql -U postgres -d urban_lifeline
# 初始化数据库
db-init:
@echo "初始化数据库..."
docker-compose -f docker-compose.dev.yml exec postgres psql -U postgres -d urban_lifeline -f /docker-entrypoint-initdb.d/initAll.sql