Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update apiserver/README.md #1487

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions apiserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,24 @@ apiserver 项目的管理端(Admin42)使用 Nodejs 进行开发, 如需开
本项目的所有单元测试均基于 pytest, 请务必保证单元测试通过后再提交代码。

```shell
❯ make test
# 假设你当前在 apiserver 项目的根目录下
❯ cd paasng
❯ export DJANGO_SETTINGS_MODULE=paasng.settings
❯ pytest --reuse-db -s --maxfail=5 ./tests/
```

- `--reuse-db` 表示在每次启动测试时尝试复用测试数据库
- `-s` 表示打印标准输出

## 数据库迁移

```shell
# 假设你当前在 apiserver 项目的根目录下
❯ cd paasng
❯ python manage.py migrate --no-input
❯ python manage.py migrate --no-input --database workloads
```

## 启动服务

- 启动 web 服务
Expand Down Expand Up @@ -155,6 +167,27 @@ Template 页面开发模式与常规的 Django 项目无异, 但是使用了 [Vu
4. 监听 `DOMContentLoaded` 事件完成 Vue 对象的初始化

## FAQ

### docker compose 安装 bundle 依赖问题
如果在安装 docker 时, 安装了 docker-compose-plugin,
需要修改'blueking-paas/apiserver/dev_utils/bundle/start.sh' 中的 docker-compose 改为 docker compose

如果在安装 docker 时, 安装了 docker-compose-plugin, 需要修改'blueking-paas/apiserver/dev_utils/bundle/start.sh' 中的 docker-compose 改为 docker compose

### poetry install 时 hash 值对不上问题

先执行

```shell
poetry config experimental.new-installer false
```

再重新执行 poetry install 即可

### admin42 页面 403 问题

需要进入数据库执行以下命令

```sql
UPDATE `bk_paas_ng`.`accounts_userprofile` SET `role` = 4 WHERE `id` = 1;
```

该命令修改指定 id 的用户为超级用户