Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
cuiyuzhe 82c5b1fde6 | 10 months ago | |
---|---|---|
app | 11 months ago | |
.gitignore | 2 years ago | |
Dockerfile | 11 months ago | |
LICENSE | 2 years ago | |
README.md | 1 year ago | |
application.yml | 10 months ago | |
build-docker.sh | 2 years ago | |
build_docker.py | 1 year ago | |
pip-install-reqs.sh | 1 year ago | |
requirements.txt | 1 year ago | |
start.py | 2 years ago |
CubePy微服务框架 使用一个特殊微服务——gateway——来充当API网关,用于为后端微服务提供统一的访问入口和HTTP路由转发功能。
在CubePy微服务框架中,前端程序不能直接向后端微服务发起HTTP服务请求,而是将所有服务请求统一发送至API网关,再由API网关根据请求地址中的服务名自动将这些服务请求转发至后端相应的微服务中去。
除了HTTP路由功能外,gateway还在用户身份认证时充当Oauth2协议的client身份。
gateway使用Consul来进行微服务注册和发现。在gateway启动时,它首先尝试与Consul建立连接并在Consul上注册自己。如果Consul未就绪,gateway将启动失败。
作为一个微服务,gateway在启动时会尝试从 uaa 获取用于微服务访问控制的公钥和JWT。如果uaa未就绪,gateway将启动失败。
监听端口
服务注册与发现:
统一数据配置中心: configserver
用户认证授权: uaa
数据库: 无
开发环境中运行本微服务之前,需要先拉起项目依赖的后台docker。
$ cd ~/cubenet/cubepy/dev
$ docker-compose up
参见 CubePy微服务框架 之README文档。
使用PyCharm打开本project所在目录。
建议在PyCharm中专门为本project新建一个专用Python虚拟环境,Python版本选择3.5以上。
在PyCharm的terminal窗口中执行如下命令安装依赖包:
$ sh pip-install-reqs.sh
在PyCharm窗口中右键单击“start.py”文件,选择“run 'start'”或者“debug 'start'”来运行或调试程序。
开发完成后,可在terminal窗口中执行如下命令来生成微服务docker镜像:
$ sh build-docker.sh
CubePy微服务框架——API网关
Python Shell Dockerfile Text
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》