mirror of
https://github.com/veops/cmdb.git
synced 2025-09-07 13:57:01 +08:00
Compare commits
6 Commits
dependabot
...
dev_deploy
Author | SHA1 | Date | |
---|---|---|---|
|
7602d31978 | ||
|
2933bf1efa | ||
|
981f8b0145 | ||
|
213bda671c | ||
|
837aabfe77 | ||
|
cc599d414a |
26
README.md
26
README.md
@@ -73,20 +73,34 @@
|
||||
## 安装
|
||||
|
||||
### Docker 一键快速构建
|
||||
- 进入主目录(先安装 docker 环境, 注意要clone整个项目)
|
||||
|
||||
> 方法一
|
||||
- 第一步: 先安装 docker 环境, 以及docker-compose
|
||||
- 第二步: 拷贝项目
|
||||
```shell
|
||||
git clone https://github.com/veops/cmdb.git
|
||||
```
|
||||
- 第三步:进入主目录,执行:
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
- 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
- username: demo 或者 admin
|
||||
- password: 123456
|
||||
> 方法二, 该方法适用于linux系统
|
||||
- 第一步: 先安装 docker 环境, 以及docker-compose
|
||||
- 第二步: 直接使用项目根目录下的install.sh 文件进行 `安装`、`启动`、`暂停`、`查状态`、`删除`、`卸载`
|
||||
```shell
|
||||
curl -so install.sh https://raw.githubusercontent.com/veops/cmdb/master/install.sh
|
||||
sh install.sh install
|
||||
```
|
||||
|
||||
### [本地开发环境搭建](docs/local.md)
|
||||
|
||||
### [Makefile 安装](docs/makefile.md)
|
||||
|
||||
## 验证
|
||||
- 浏览器打开: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
- username: demo 或者 admin
|
||||
- password: 123456
|
||||
|
||||
|
||||
---
|
||||
|
||||
_**欢迎关注公众号(维易科技OneOps),关注后可加入微信群,进行产品和技术交流。**_
|
||||
|
@@ -38,7 +38,6 @@ def string_to_bytes(value):
|
||||
byte_string = value
|
||||
else:
|
||||
byte_string = value.encode("utf-8")
|
||||
|
||||
return byte_string
|
||||
|
||||
|
||||
@@ -314,7 +313,7 @@ class KeyManage:
|
||||
secrets_root_key = current_app.config.get("secrets_root_key")
|
||||
msg, ok = self.is_valid_root_key(secrets_root_key)
|
||||
if not ok:
|
||||
return {"message": msg, "status": "failed"}
|
||||
return true
|
||||
status = self.backend.get(backend_seal_key)
|
||||
return status == "block"
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
"@wangeditor/editor-for-vue": "^1.0.0",
|
||||
"ant-design-vue": "^1.6.5",
|
||||
"axios": "1.6.0",
|
||||
"axios": "0.18.0",
|
||||
"babel-eslint": "^8.2.2",
|
||||
"butterfly-dag": "^4.3.26",
|
||||
"codemirror": "^5.65.13",
|
||||
|
@@ -68,6 +68,7 @@
|
||||
ref="xTable"
|
||||
row-id="id"
|
||||
show-overflow
|
||||
resizable
|
||||
>
|
||||
<!-- 1 -->
|
||||
<vxe-table-column type="checkbox" fixed="left" :width="45"></vxe-table-column>
|
||||
|
@@ -24,6 +24,8 @@ services:
|
||||
cmdb-cache:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-cache:3.0
|
||||
container_name: cmdb-cache
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
networks:
|
||||
new:
|
||||
aliases:
|
||||
|
@@ -68,20 +68,35 @@
|
||||
|
||||
### One-Click Docker Quick Build
|
||||
|
||||
- Prepare: install docker and docker-compose
|
||||
- In directory cmdb
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
- View: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
- username: demo or admin
|
||||
- password: 123456
|
||||
> Method 1
|
||||
- step 1: **Prepare: install docker and docker-compose**
|
||||
- step 2: copy the repository
|
||||
```shell
|
||||
git clone https://github.com/veops/cmdb.git
|
||||
```
|
||||
- step 3: In directory cmdb:
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
> Method 2 Usefull for linux os.
|
||||
- step 1: **Prepare: install docker and docker-compose**
|
||||
- step 2: directly use the install.sh file in the project's root directory to `install`, `start`, `pause`, `status`, `delete`, and `uninstall` the application.
|
||||
```shell
|
||||
curl -so install.sh https://raw.githubusercontent.com/veops/cmdb/master/install.sh
|
||||
sh install.sh install
|
||||
```
|
||||
|
||||
|
||||
### [Local Setup](local_en.md)
|
||||
|
||||
### [Installation with Makefile](makefile_en.md)
|
||||
|
||||
## Validation
|
||||
|
||||
- View: [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
||||
- username: demo or admin
|
||||
- password: 123456
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork it
|
||||
|
@@ -22,7 +22,7 @@ cp cmdb-api/settings.example.py cmdb-api/settings.py
|
||||
- 后端: `cd cmdb-api && pipenv run pipenv install && cd ..`
|
||||
- 前端: `cd cmdb-ui && yarn install && cd ..`
|
||||
- 可以将 docs/cmdb.sql 导入到数据库里,登录用户和密码分别是:demo/123456
|
||||
- 创建数据库表: 进入**cmdb-api**目录执行 `pipenv run flask db-setup && pipenv run flask cmdb-init-cache`
|
||||
- 创建数据库表: 进入**cmdb-api**目录执行 `pipenv run flask db-setup && pipenv run flask common-check-new-columns && pipenv run flask cmdb-init-cache`
|
||||
- 启动服务
|
||||
|
||||
- 后端: 进入**cmdb-api**目录执行 `pipenv run flask run -h 0.0.0.0`
|
||||
|
@@ -17,7 +17,7 @@
|
||||
- frontend: `cd cmdb-ui && yarn install && cd ..`
|
||||
- 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`
|
||||
in **cmdb-api** directory: `pipenv run flask db-setup && pipenv run flask common-check-new-columns && pipenv run flask cmdb-init-cache`
|
||||
|
||||
` source docs/cmdb.sql`
|
||||
|
||||
|
@@ -46,10 +46,11 @@ read_rnd_buffer_size=512K
|
||||
skip-name-resolve
|
||||
max_connections=1000
|
||||
slow_query_log = ON
|
||||
slow_query_log_file = /var/log/mysql_slow.log
|
||||
slow_query_log_file = /tmp/mysql_slow.log
|
||||
long_query_time = 1
|
||||
sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
|
||||
#log-error = /var/log/mysql/error.log
|
||||
# By default we only accept connections from localhost
|
||||
#bind-address = 127.0.0.1
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
log_timestamps = SYSTEM
|
||||
|
157
install.sh
Normal file
157
install.sh
Normal file
@@ -0,0 +1,157 @@
|
||||
#!/bin/bash
|
||||
|
||||
current_path=$(pwd)
|
||||
cmdb_dir=$(cd ~ && pwd)/apps
|
||||
|
||||
check_docker() {
|
||||
docker info >/dev/null 2>&1
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "error: please install and start docker firstly"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_docker_compose() {
|
||||
docker-compose --version >/dev/null 2>&1
|
||||
if ! [ $? -eq 0 ]; then
|
||||
echo "error: please install docker-compose firstly"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
clone_repo() {
|
||||
local repo_url=$1
|
||||
git clone $repo_url || {
|
||||
echo "error: failed to clone $repo_url"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
change_directory() {
|
||||
local new_dir=$1
|
||||
if ! mkdir -p "$new_dir"; then
|
||||
echo "error: failed to create directory $new_dir"
|
||||
exit 1
|
||||
fi
|
||||
cd "$new_dir" || exit 1
|
||||
}
|
||||
|
||||
install_service() {
|
||||
echo ""
|
||||
echo "Installing the service $1..."
|
||||
change_directory "$cmdb_dir"
|
||||
|
||||
if [ -d "${cmdb_dir}/cmdb" ]; then
|
||||
echo "directory ${cmdb_dir}/cmdb already exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clone_repo "https://githubfast.com/veops/cmdb.git" || clone_repo "https://github.com/veops/cmdb.git"
|
||||
cd ${cmdb_dir}/cmdb || exit 1
|
||||
docker-compose pull
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "successfully install package in directory: ${cmdb_dir}/cmdb"
|
||||
fi
|
||||
cd $current_path || exit 1
|
||||
}
|
||||
|
||||
start_service() {
|
||||
echo "Starting the service $1..."
|
||||
cd ${cmdb_dir}/cmdb
|
||||
docker-compose up -d
|
||||
cd $current_path
|
||||
}
|
||||
|
||||
pause_service() {
|
||||
case $2 in
|
||||
"" | cmdb-api | cmdb-ui | cmdb-db | cmdb-cache)
|
||||
echo "Pausing the service ..."
|
||||
|
||||
cd ${cmdb_dir}/cmdb || exit 1
|
||||
docker-compose stop $2
|
||||
|
||||
cd $current_path || exit 1
|
||||
;;
|
||||
*)
|
||||
echo "Please input invalid service name: [cmdb-api|cmdb-ui|cmdb-db|cmdb-cache]"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
delete_service() {
|
||||
echo "Deleting the service ..."
|
||||
cd ${cmdb_dir}/cmdb || exit 1
|
||||
docker-compose down
|
||||
cd $current_path || exit 1
|
||||
}
|
||||
|
||||
status_service() {
|
||||
cd ${cmdb_dir}/cmdb || exit 1
|
||||
docker-compose ps
|
||||
cd $current_path || exit 1
|
||||
|
||||
}
|
||||
|
||||
uninstall_service() {
|
||||
if ! [ -d "${cmdb_dir}/cmdb" ]; then
|
||||
echo "directory ${cmdb_dir}/cmdb already not exist"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
read -p "Are you sure to uninstall the all the application and data? y/n:" input
|
||||
if [ $input = "y" ]; then
|
||||
echo "Uninstalling the service ..."
|
||||
|
||||
cd ${cmdb_dir}/cmdb || exit 1
|
||||
docker-compose down -v
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -fr ${cmdb_dir}/cmdb
|
||||
fi
|
||||
|
||||
cd $current_path || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Welcome to the CMDB service management script!"
|
||||
echo ""
|
||||
|
||||
check_depend() {
|
||||
check_docker
|
||||
check_docker_compose
|
||||
}
|
||||
|
||||
case $1 in
|
||||
install)
|
||||
check_depend
|
||||
install_service $2
|
||||
;;
|
||||
start)
|
||||
check_depend
|
||||
start_service $2
|
||||
;;
|
||||
status)
|
||||
check_depend
|
||||
status_service $2
|
||||
;;
|
||||
pause)
|
||||
check_depend
|
||||
pause_service $2
|
||||
;;
|
||||
delete)
|
||||
check_depend
|
||||
delete_service $2
|
||||
;;
|
||||
uninstall)
|
||||
check_depend
|
||||
uninstall_service $2
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [install|start|pause|uninstall]"
|
||||
echo "install Used to install the application"
|
||||
echo "start Used to start the application"
|
||||
echo "status Used to show status of the application"
|
||||
echo "pause Used to pause the application"
|
||||
echo "delete Used to delete the application"
|
||||
echo "uninstall Used to uninstall the application, include all data"
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user