Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
huolongshe aabe78d8a6 | 2 years ago | |
---|---|---|
dev | 2 years ago | |
k8s | 2 years ago | |
minikube | 2 years ago | |
prod | 2 years ago | |
.gitignore | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
build-dockers.sh | 2 years ago |
CubeAI智立方是集AI模型自动化服务封装、发布、共享、部署和能力开放等功能于一体的开源AI算能服务平台,其核心作用在于打通AI模型开发至实际生产应用之间的壁垒,加速AI创新和应用进程,促进AI应用从设计、开发直到部署、运营整个生命周期的自动化快速迭代和演进。
CubeAI平台基于自主研发的CUBE-Net微服务框架进行开发,支持在主流容器化云原生平台上部署运行。
CUBE-Net微服务框架是一套基于ServiceBoot微服务引擎开发的云原生微服务应用基础开发平台和代码脚手架工具,目前提供如下微服务控制基础组件:
服务注册与发现中心——Consul
在CUBE-Net微服务框架中使用第三方组件Consul来充当服务注册/发现中心,同时还兼做统一数据配置中心。
内容服务器——Nexus
在CUBE-Net微服务框架中使用第三方组件Nexus来充当内容服务器,为整个微服务应用系统提供统一的文件存储、制品仓库等服务功能。
API网关——gateway
CUBE-Net微服务框架使用基于ServiceBoot开发的特殊微服务——gateway——来充当API网关,用于为后端微服务提供统一的访问入口和HTTP路由转发功能。
用户认证授权中心——uaa
CUBE-Net微服务框架使用基于ServiceBoot开发的特殊微服务——uaa——来充当用户认证授权中心,用于提供基于OAuth2协议和JWT(Json Web Token)的用户认证和授权服务,以及基于JWT和角色的微服务访问控制等功能。此外,CUBE-Net微服务框架中的uaa还提供了用户管理、角色管理、消息管理、应用管理、文档管理等服务功能。
前端主门户——portal
CUBE-Net微服务框架使用基于ServiceBoot开发的前端微服务——portal——来为整个微服务应用系统提供统一的前端主门户入口界面。portal前端界面基于Angular框架,使用TypeScript和HTML等语言开发。
除了CUBE-Net微服务框架提供的基础组件外,CubeAI平台软件主要包括以下几个微服务:
个人中心前端微服务,链接于主portal之后。ppersonal前端基于Angular框架,使用TypeScript/HTML等语言开发。
AI模型共享平台前端微服务,链接于主portal之后。pmodelhub前端基于Angular框架,使用TypeScript/HTML等语言开发。
AI能力开放平台前端微服务,链接于主portal之后。Popen前端基于Angular框架,使用TypeScript/HTML等语言开发。
AI模型管理后端微服务。下挂一个MySql数据库,统一管理CubeAI应用中所有需要持久化的数据模型。使用Python语言开发。
AI模型导入后端微服务。负责将建模阶段打包好的AI模型导入CubeAI平台,并生成docker形式的微服务镜像。使用Python语言开发。
AI模型部署后端微服务。将CubeAI平台中已发布模型部署至Kubernetes云原生平台,以docker容器的方式运行,以RESTful API的形式向用户提供AI能力开放接口。使用Python语言开发。
AI能力开放网关后端微服务。对Kubernetes平台中docker容器提供的AI能力API接口进行二次封装,增强API访问的安全性。使用Python语言开发。
CubeAI平台的核心技术之一是AI模型服务化引擎——iBoot。
为了使用CubeAI平台,AI模型开发者需要先使用iBoot对AI模型推理算法进行简单的封装,使之成为可在互联网上运行的web服务,然后再将其发布至CubeAI平台。在模型发布的过程中,CubeAI会自动将模型进行容器化封装。容器化的AI模型经部署之后,将使用内嵌的iBoot引擎对外提供web服务(通过RESTful API接口或web图形界面)。
CubeAI模型样例是使用AI模型服务化引擎——iBoot——开发的AI模型推理程序样例集,可作为编写CubeAI模型推理程序的模板来使用。
参见CUBE-Net微服务框架相关文档(https://git.openi.org.cn/OpenI/cubenet)完成开发环境初始配置。
开启本机docker服务的2375端口(minikube集群环境部署CubeAI情况下,模型打包时需要访问集群外部的docker服务):
在 /etc/systemd/system/docker.service.d/override.conf文件(如果没有则创建)中添加如下几行内容:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
可使用以下命令完成:
# cat > /etc/systemd/system/docker.service.d/override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
EOF
为本机docker服务增加非安全镜像仓库配置(便于从本机及Minikube集群内部向在本地部署的非安全镜像仓库推送docker镜像):
在 /etc/docker/daemon.json(如果没有则创建)中添加如下内容(注意替换本机实际IP地址):
{"insecure-registries":["<本机网卡IP地址>:8001", "192.168.0.0/16"]}
可使用以下命令完成(注意替换本机实际IP地址):
# echo '{"insecure-registries": ["<本机网卡IP地址>:8001", "192.168.0.0/16"]}' > /etc/docker/daemon.json
上述命令执行完毕后,重启docker服务:
# systemctl daemon-reload
# systemctl restart docker
CubeAI智立方中的AI能力开放平台需要部署在Kubernetes集群,此外还可以将CubeAI智立方平台本身的所有微服务部署在Kubernetes集群中运行,因此建议使用minikube来搭建单节点Kubernetes集群,供本地开发环境使用。Minikube官方文档参见:https://minikube.sigs.k8s.io/docs/ 。
最新版minikube v1.22.0集群搭建步骤如下:
不能在root帐号下使用minikube。如果当前登录帐号为root,应该先创建一个普通帐号(例如:minikube)并登录:
# useradd -d /home/minikube -m minikube
# echo 'minikube ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# su minikube
$ cd
$ sudo usermod -aG docker $USER
$ newgrp docker
如果之前安装过kubectl,备份其配置文件:
$ cp ~/.kube/config ~/.kube/config_backup
安装minikube:
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube
拉取minikube依赖的镜像:
$ docker pull registry.aliyuncs.com/google_containers/coredns:1.8.0
$ docker tag registry.aliyuncs.com/google_containers/coredns:1.8.0 registry.aliyuncs.com/google_containers/coredns/coredns:v1.8.0
$ docker tag registry.aliyuncs.com/google_containers/coredns:1.8.0 registry.aliyuncs.com/google_containers/coredns:v1.8.0
$ docker pull registry.aliyuncs.com/google_containers/storage-provisioner:v5
$ docker tag registry.aliyuncs.com/google_containers/storage-provisioner:v5 registry.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner:v5
启动minikube:
$ minikube start --driver=docker --image-mirror-country=cn --image-repository=registry.aliyuncs.com/google_containers --insecure-registry "192.168.0.0/16" --cpus=12 --memory=32g
命令中的--cpus和--memory参数规定了minikube集群cpu和内存的最大限额,请根据实际的资源情况修改。
命令运行预计会提示错误,错误信息是:[ERROR ImagePull]: failed to pull image registry.aliyuncs.com/google_containers/coredns:v1.8.0......,需要执行下列命令加载缺失的镜像:
$ minikube image load registry.aliyuncs.com/google_containers/coredns:v1.8.0
$ minikube image load registry.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner:v5
加载完毕后,重新执行启动命令:
$ minikube start --driver=docker --image-mirror-country=cn --image-repository=registry.aliyuncs.com/google_containers --insecure-registry "192.168.0.0/16" --cpus=12 --memory=32g
等待显示:Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default,集群启动完毕。
AI能力开放平台需要远程连接此集群,必须配置远程连接权限:
$ minikube kubectl -- -nkube-system create sa remote-admin
$ minikube kubectl -- create clusterrolebinding remote-admin --clusterrole=cluster-admin --serviceaccount=kube-system:remote-admin
修改统一配置中心配置参数:
kubernetes:api:token配置项的值,请填入此命令的运行结果:
$ minikube kubectl -- -nkube-system get $(minikube kubectl -- get secret -nkube-system -oname|grep remote-admin-token) -ojsonpath={.data.token}|base64 -d
kubernetes:api:url配置项的值,请填入此命令的运行结果:
$ echo 'https://'$(minikube kubectl -- get ep kubernetes --no-headers|awk '{print $2}')
kubernetes:ability:internalIP配置项的值,请填入此命令的运行结果:
$ minikube kubectl -- get ep kubernetes --no-headers|awk '{print $2}'|cut -f1 -d':'
启动dashboard图形界面:
$ minikube dashboard
命令运行预计会卡顿在Verifying proxy health ...,需要另开终端,执行下列命令更改镜像配置:
$ minikube kubectl -- -nkubernetes-dashboard set image deploy kubernetes-dashboard kubernetes-dashboard=registry.aliyuncs.com/google_containers/dashboard:v2.1.0
$ minikube kubectl -- -nkubernetes-dashboard set image deploy dashboard-metrics-scraper dashboard-metrics-scraper=registry.aliyuncs.com/google_containers/metrics-scraper:v1.0.4
等待显示Opening http://127.0.0.1:3xxxx/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...,命令会自动调用浏览器打开dashboard。
如果未自动打开浏览器,请将上述URL复制到浏览器打开。
停止minkube:
# minikube stop
删除minkube集群:
# minikube delete --all
在当前用户主目录下新建cubenet子目录:
# cd
# mkdir cubent
将CUBE-Net微服务框架所有基础组件源代码及CubeAI平台所有应用微服务源代码下载至当前用户主目录的cubenet子目录之下:
# cd ~/cubenet
# git clone https://git.openi.org.cn/OpenI/cubenet.git
# git clone https://git.openi.org.cn/OpenI/cubenet_uaa.git
# git clone https://git.openi.org.cn/OpenI/cubenet_gateway.git
# git clone https://git.openi.org.cn/OpenI/cubenet_portal.git
# git clone https://git.openi.org.cn/OpenI/cubeai.git
# git clone https://git.openi.org.cn/OpenI/cubeai_ppersonal.git
# git clone https://git.openi.org.cn/OpenI/cubeai_pmodelhub.git
# git clone https://git.openi.org.cn/OpenI/cubeai_popen.git
# git clone https://git.openi.org.cn/OpenI/cubeai_umm.git
# git clone https://git.openi.org.cn/OpenI/cubeai_umu.git
# git clone https://git.openi.org.cn/OpenI/cubeai_umd.git
# git clone https://git.openi.org.cn/OpenI/cubeai_ability.git
修改统一配置中心配置参数
第一次从git仓库下载cubeai项目代码后,需要分别修改其子目录下dev/central-server-config/application.yml、prod/central-server-config/application.yml、minikube/cubeai-configmap.yml和k8s/cubeai-configmap.yml几个文件内容,将相关配置项改为与自己系统中的配置相一致。
修改kubernetes相关的配置项,请参照本文档“开发环境准备”章节下的“K8S测试集群”小节。
拉起所有依赖dockers:
打开一个terminal窗口,运行:
# cd ~/cubenet/cubeai/dev
# docker-compose up
等待nexus服务启动完成后,执行Nexus配置脚本:
sh nexus_configure_dev.sh
运行基础组件微服务
在集成开发环境(例如Pycharm)中分别打开并运行uaa、gateway和portal三个基础组件微服务工程,参见各工程目录下的README文件。
运行CubeAI应用微服务
在集成开发环境(例如Pycharm)中分别打开并运行各CubeAI应用微服务工程:umm, umu, umd, ability, ppersonal, pmodelhub, popen,参见各工程目录下的README文件。
修改应用名称
以admin帐号登录,或者具有ROLE_ADMIN角色的其他用户帐号登录。
进入“系统管理|应用管理”页面,创建一个新应用:
创建用于CubeAI平台操作的新用户和角色
添加用于访问CubeAI各子平台的应用链接
进入“系统管理|应用管理”页面,创建若干新应用:
---
- 应用名称: AI模型共享
- URL: /pmodelhub/#/
- 主题1: 平台导航
- 主题2: homepage
- 所需角色:
---
- 应用名称: AI能力开放
- URL: /popen/#/
- 主题1: 平台导航
- 主题2: homepage
- 所需角色:
---
- 应用名称: AI应用示范
- URL: /popen/#/demo
- 主题1: 平台导航
- 主题2: homepage
- 所需角色:
---
- 应用名称: 个人中心
- URL: /ppersonal/#/
- 主题1: 平台导航
- 主题2: homepage
- 所需角色: ROLE_USER
---
- 应用名称: 系统管理
- URL: /admin
- 主题1: 平台导航
- 主题2: homepage
- 所需角色: ROLE_ADMIN
添加模型打包指南文档
进入“系统管理|文稿管理”页面,新建文稿:
---
- 标题: 模型打包指南
- 主题1: model-packaging
- 正文: 模型打包指南文档
刷新页面,试用CubeAI平台各功能。
CubeAI智立方平台既可以使用docker-compose在单机上部署,也可以在基于k8s/istio的云原生环境中进行部署。
docker-compose部署
参见~/cubenet/cubeai/prod目录下README文件。
minikube部署
参见~/cubenet/cubeai/minikube目录下README文件。
k8s部署
参见~/cubenet/cubeai/k8s目录下README文件。
CubeAI智立方是中国联通研究院自主研发的集AI模型自动化服务封装、发布、共享、部署和能力开放等功能于一体的开源AI算能服务平台,其核心作用在于打通AI模型开发至实际生产应用之间的壁垒,加速AI创新和应用进程,促进AI应用从设计、开发直到部署、运营整个生命周期的自动化快速迭代和演进。
Shell
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》