Files
gofly-platform-services/QUICK_START.md
T
lishilin 74d99e6b60 refactor: 抽离企业级微服务脚手架
- 删除业务特定模块(device-center, order-center, coupon-center, msg-center)
- 保留核心通用模块(user-center, file-center, search-center, code-generator)
- 创建 demo-center 示例模块
- 清理业务特定文档和前端项目
- 创建数据库初始化脚本
- 更新 README 和快速开始文档
- 保留所有 zlt-commons 公共组件库
2026-03-07 18:41:49 +08:00

169 lines
3.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 快速开始指南
本指南将帮助你快速搭建和运行 Central Platform 微服务脚手架。
## 前置准备
### 1. 安装必要软件
- **JDK 17**: [下载地址](https://www.oracle.com/java/technologies/downloads/)
- **Maven 3.6+**: [下载地址](https://maven.apache.org/download.cgi)
- **MySQL 8.0+**: [下载地址](https://dev.mysql.com/downloads/mysql/)
- **Redis 7.0+**: [下载地址](https://redis.io/download)
- **Nacos 2.0+**: [下载地址](https://github.com/alibaba/nacos/releases)
### 2. 验证安装
```bash
java -version # 应显示 Java 17
mvn -version # 应显示 Maven 3.6+
mysql --version # 应显示 MySQL 8.0+
redis-server --version # 应显示 Redis 7.0+
```
## 第一步:数据库初始化
### 1. 创建数据库
```bash
mysql -u root -p
```
### 2. 执行初始化脚本
```bash
mysql -u root -p < zlt-doc/database/init.sql
```
脚本会自动创建:
- 数据库 `central_platform`
- 核心表(用户、角色、菜单等)
- 默认管理员账号(admin/admin123)
## 第二步:启动 Nacos
### 1. 下载并解压 Nacos
```bash
wget https://github.com/alibaba/nacos/releases/download/2.2.0/nacos-server-2.2.0.tar.gz
tar -xvf nacos-server-2.2.0.tar.gz
cd nacos
```
### 2. 单机模式启动
```bash
# Linux/Mac
sh bin/startup.sh -m standalone
# Windows
cmd bin/startup.cmd -m standalone
```
### 3. 访问控制台
- 地址: http://localhost:8848/nacos
- 账号: nacos
- 密码: nacos
## 第三步:启动 Redis
```bash
# Linux/Mac
redis-server
# Windows
redis-server.exe
```
## 第四步:编译项目
```bash
cd central-platform
mvn clean install -DskipTests
```
## 第五步:启动服务
### 方式一:IDE 启动(推荐开发环境)
按以下顺序启动:
1. **网关服务** - `zlt-gateway/sc-gateway/src/main/java/com/central/gateway/GatewayApp.java`
2. **认证中心** - `zlt-uaa/src/main/java/com/central/oauth/UaaServerApplication.java`
3. **用户中心** - `zlt-business/user-center/src/main/java/com/central/user/UserCenterApplication.java`
4. **文件中心** - `zlt-business/file-center/src/main/java/com/central/file/FileCenterApplication.java`
### 方式二:命令行启动
```bash
# 启动网关
cd zlt-gateway/sc-gateway
mvn spring-boot:run
# 启动认证中心
cd zlt-uaa
mvn spring-boot:run
# 启动用户中心
cd zlt-business/user-center
mvn spring-boot:run
# 启动文件中心
cd zlt-business/file-center
mvn spring-boot:run
```
## 第六步:验证服务
### 1. 检查 Nacos 服务注册
访问 http://localhost:8848/nacos,在"服务管理 > 服务列表"中应该看到:
- sc-gateway
- uaa-server
- user-center
- file-center
### 2. 访问 API 文档
http://localhost:9900/doc.html
### 3. 测试登录接口
```bash
curl -X POST "http://localhost:9900/api-uaa/oauth/token" \
-H "Authorization: Basic d2ViQXBwOndlYkFwcA==" \
-d "username=admin&password=admin123&grant_type=password"
```
## 常见问题
### 1. 端口被占用
修改各服务的 `application.yml` 中的 `server.port` 配置。
### 2. Nacos 连接失败
检查 `bootstrap.yml` 中的 Nacos 地址配置:
```yaml
spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
```
### 3. 数据库连接失败
检查 Nacos 配置中心的数据库配置。
## 下一步
- 查看 [开发指南](./DEVELOPMENT.md)
- 了解 [架构设计](./ARCHITECTURE.md)
- 参考 [API 文档](http://localhost:9900/doc.html)
## 获取帮助
- GitHub Issues: https://github.com/zlt2000/microservices-platform/issues