update local.md

This commit is contained in:
pycook 2023-07-17 13:32:34 +08:00
parent 154f84d64e
commit 61b5144362
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,7 @@
## 本地搭建: 环境和依赖 ## 本地搭建: 环境和依赖
- 存储: mysql, redis - 存储: mysql, redis
- python 版本: >=python3.8 - python 版本: >=python3.7
## Install ## Install
@ -21,13 +21,15 @@ cp cmdb-api/settings.example.py cmdb-api/settings.py
- 安装库 - 安装库
- 后端: `cd cmdb-api && pipenv run pipenv install && cd ..` - 后端: `cd cmdb-api && pipenv run pipenv install && cd ..`
- 前端: `cd cmdb-ui && yarn install && cd ..` - 前端: `cd cmdb-ui && yarn install && cd ..`
- 创建数据库表: 进入**cmdb-api**目录执行 `pipenv run flask db-setup && pipenv run flask init-cache`
- 可以将 docs/cmdb.sql 导入到数据库里,登录用户和密码分别是:demo/123456 - 可以将 docs/cmdb.sql 导入到数据库里,登录用户和密码分别是:demo/123456
- 创建数据库表: 进入**cmdb-api**目录执行 `pipenv run flask db-setup && pipenv run flask cmdb-init-cache`
- 启动服务 - 启动服务
- 后端: 进入**cmdb-api**目录执行 `pipenv run flask run -h 0.0.0.0` - 后端: 进入**cmdb-api**目录执行 `pipenv run flask run -h 0.0.0.0`
- 前端: 进入**cmdb-ui**目录执行`yarn run serve` - 前端: 进入**cmdb-ui**目录执行`yarn run serve`
- worker: 进入**cmdb-api**目录执行 `pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1` - worker:
- 进入**cmdb-api**目录执行 `pipenv run celery worker -A celery_worker.celery -E -Q one_cmdb_async --concurrency=1 -D`
- 进入**cmdb-api**目录执行 `pipenv run celery worker -A celery_worker.celery -E -Q acl_async --concurrency=1 -D`
- 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000) - 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
- 如果是非本机访问, 要修改**cmdb-ui/.env**里**VUE_APP_API_BASE_URL**里的 IP 地址为后端服务的 ip 地址 - 如果是非本机访问, 要修改**cmdb-ui/.env**里**VUE_APP_API_BASE_URL**里的 IP 地址为后端服务的 ip 地址

View File

@ -15,9 +15,9 @@
- Install library - Install library
- backend: `cd cmdb-api && pipenv run pipenv install && cd ..` - backend: `cd cmdb-api && pipenv run pipenv install && cd ..`
- frontend: `cd cmdb-ui && yarn install && cd ..` - frontend: `cd cmdb-ui && yarn install && cd ..`
- Create tables of cmdb database:
in **cmdb-api** directory: `pipenv run flask db-setup && pipenv run flask init-cache`
- Suggest step: (default: user:demo,password:123456) - Suggest step: (default: user:demo,password:123456)
- Create tables of cmdb database:
in **cmdb-api** directory: `pipenv run flask db-setup && pipenv run flask cmdb-init-cache`
` source docs/cmdb.sql` ` source docs/cmdb.sql`
@ -25,7 +25,9 @@
- backend: in **cmdb-api** directory: `pipenv run flask run -h 0.0.0.0` - backend: in **cmdb-api** directory: `pipenv run flask run -h 0.0.0.0`
- frontend: in **cmdb-ui** directory: `yarn run serve` - frontend: in **cmdb-ui** directory: `yarn run serve`
- worker: in **cmdb-api** directory: `pipenv run celery worker -A celery_worker.celery -E -Q cmdb_async --concurrency=1` - worker:
- in **cmdb-api** directory: `pipenv run celery worker -A celery_worker.celery -E -Q one_cmdb_async --concurrency=1 -D`
- in **cmdb-api** directory: `pipenv run celery worker -A celery_worker.celery -E -Q acl_async --concurrency=1 -D`
- homepage: [http://127.0.0.1:8000](http://127.0.0.1:8000) - homepage: [http://127.0.0.1:8000](http://127.0.0.1:8000)
- if not run localhost: please change ip address(**VUE_APP_API_BASE_URL**) in config file **cmdb-ui/.env** into your backend ip address - if not run localhost: please change ip address(**VUE_APP_API_BASE_URL**) in config file **cmdb-ui/.env** into your backend ip address