Skip to content

Commit df2c5c3

Browse files
committed
🔧 数据库调试改为本地进行了。
1 parent 77870b1 commit df2c5c3

File tree

3 files changed

+34
-68
lines changed

3 files changed

+34
-68
lines changed

Makefile.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ exec docker build -t kongying-tavern-backend .
1010
'''
1111

1212
[tasks.dev]
13-
env_files = ["./.env"] # 密码需要自行创建 .env 文件,并写入 DB_PASSWORD 变量,仓库本身不保存也不能保存任何密码
13+
env_files = ["./.env"]
1414
watch = { no_git_ignore = true, ignore_pattern = "Cargo.lock", watch = [
1515
"./packages/",
1616
] }
@@ -22,8 +22,8 @@ exec cargo run
2222
'''
2323

2424
[tasks.dev.env]
25-
DB_HOST = "ddns.minemc.top"
26-
DB_PORT = "13432"
25+
DB_HOST = "127.0.0.1"
26+
DB_PORT = "5432"
2727
DB_USERNAME = "genshin_map"
2828
DB_DATABASE = "genshin_map"
2929

ReadMe.md

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,39 @@
1-
# 空荧酒馆·原神地图 Rust 后端
1+
# 空荧酒馆·原神地图 Rust 后端 / Genshin Map Cloud Rust Backend
22

3-
## 如何构建
3+
## 如何构建 / How to build
4+
5+
为了确保环境的一致性,本项目采用 Docker Compose 进行自动化部署。请确保机器上已安装 Docker 和 Cargo。
46

57
To ensure the environment is unified, this project has been deployed automatically using Docker Compose. Make sure Docker and Cargo are installed on the machine.
68

9+
在部署之前,您应该在项目文件夹中创建一个名为 `.env` 的文件,其中存储服务器将连接到的数据库的配置信息。示例内容如下:
10+
711
Before the formal deployment, you should create a file named `.env` in the project folder, which stores the configuration information of the database that the server will connect to. The example content is as follows:
812

913
```env
10-
MARIADB_ROOT_PASSWORD=root
11-
DB_PASSWORD=root
14+
DB_PASSWORD=<password>
1215
```
1316

17+
请确保以上的配置项已正确填写。
18+
1419
Please make sure that the configuration file has correctly filled in all the keys involved in the above example, and cannot be omitted.
1520

16-
Before starting, please make sure that `cargo-make` is installed:
21+
正式开始前,请确保已安装 `cargo-make` `docker`;如果需要本地调试,还需要安装 `docker-compose`
1722

18-
```bash
19-
cargo install --force cargo-make
20-
```
23+
Before starting, please make sure that `cargo-make` and `docker` are installed. If you need local debugging, you also need to install `docker-compose`.
24+
25+
之后,执行以下命令以构建集群:
2126

2227
Then execute the following command in the project directory to build the cluster:
2328

2429
```bash
2530
cargo make build
2631
```
2732

33+
如果您需要实时调试,可以通过以下方式启动集群:
34+
2835
If you need to debug in real time, start the cluster in this way:
2936

3037
```bash
3138
cargo make dev
3239
```
33-
34-
While deploying to the server, there are some differences in the way the cluster starts:
35-
36-
```bash
37-
cargo make -p production -e DB_USERNAME=<username> -e DB_PASSWORD=<password> up
38-
# Or use the .env file to keep the password on the server,
39-
# ensuring that the password itself does not appear in the terminal execution history
40-
cargo make -p production --env-file=<filepath> up
41-
```
42-
43-
## 逻辑分块
44-
45-
主要分为3大块:
46-
47-
1. 业务模块
48-
2. 权限模块
49-
3. 功能模块
50-
51-
### 业务模块
52-
53-
业务模块为服务于地图逻辑的模块
54-
55-
当前提供的地图逻辑实体有:
56-
57-
1. 地区
58-
2. 物品
59-
3. 点位
60-
4. 图标
61-
5. 路线
62-
63-
其中,对以下逻辑实体提供打点-审核机制:
64-
65-
1. 点位
66-
2. 路线(TODO)
67-
68-
对以下逻辑实体提供分类支持:
69-
70-
1. 物品
71-
2. 图标
72-
73-
以下的数据结构为树状结构:
74-
75-
1. 所有的分类
76-
2. 地区
77-
78-
### 权限模块
79-
80-
当前权限系统为单角色,共分为以下几个等级(权限由高到低)
81-
82-
1. 系统管理员——最高权限,管理权限模块
83-
2. 地图管理员——管理业务模块
84-
3. 审核员——拥有审核点位的权限
85-
4. 测试服打点员——拥有对测试服数据的访问权限,经管理员授权可以绕过审核机制
86-
5. 正式服打点员——拥有提交打点的权限
87-
6. 后台准用户——无权限
88-
7. 前台用户——匿名用户

dev.compose.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1-
# 请注意,该集群配置**不是**生产环境配置,只用于本地测试环境
1+
# Attention: This cluster configuration is **not** for production use!
2+
# 注意:该集群配置**不是**生产环境配置!
23

34
services:
5+
postgres:
6+
image: postgres:latest
7+
container_name: test-postgres
8+
ports:
9+
- "5432:5432"
10+
environment:
11+
POSTGRES_USER: genshin_map
12+
POSTGRES_PASSWORD: genshin_map
13+
POSTGRES_DB: genshin_map
14+
volumes:
15+
- postgres-data:/var/lib/postgresql/data
16+
restart: unless-stopped
17+
418
redis:
519
image: redis:latest
620
container_name: test-redis
@@ -36,6 +50,7 @@ services:
3650
# restart: unless-stopped
3751

3852
volumes:
53+
postgres-data:
3954
redis-data:
4055
minio-data:
4156
# alist-data:

0 commit comments

Comments
 (0)