微服务脚手架生成器和工具包
Youtiao的Python项目详细描述
Youtiao是一个微服务脚手架生成项目,提供 一套相关的工具。
- Prerequisites
- Installation
- Usage
- Project Init
- Docker image build
- gRPC protobuf file compile
- Rancher deployment (CI/CD)
- About “Youtiao”
- Support the project
先决条件
youtiao要求python版本>;=3.6.0。如果你没有合适的 python版本安装在您的计算机上,我们建议您使用 pyenv准备一个。
安装
来自PYPI:
pip install -U Youtiao
源代码:
git clone git@github.com:Hujun/youtiao.git && cd Youtiao && python setup.py install
用法
在python环境中成功安装youtiao后,键入 youtiao或youtiao —help在控制台中,您将看到以下内容 输出:
Usage: youtiao [OPTIONS] COMMAND [ARGS]... Micro Service Toolkit Options: --help Show this message and exit. Commands: build_image Build docker image init Generate Python service boilerplate protoc Shortcut of grpc_tools.protoc to compile... rancher_deploy Deploy using rancher (v1.6) API (v2.0 beta)
如果键入:
youtiao [command] --help
项目初始化
通过命令创建新项目:
youtiao init --language=python [directory]
将启动服务名称和服务模式对话框 确认。如果一切顺利,项目框架将 生成。该命令不会在给定目录下生成任何文件 路径(如果进程中止或引发任何异常)。
现在提供的语言和服务模板:
Programming Language | Servcie Template |
---|---|
Python | HTTP |
Python | gRPC |
Docker映像构建
Usage: youtiao build_image [OPTIONS] Build docker image Options: --project-name TEXT project name [required] --commit-ref-name TEXT name of git branch or tag [required] --commit-sha TEXT git commit hash [required] --workdir DIRECTORY [required] --registry-url TEXT Docker registry URL --help Show this message and exit.
这个命令只是docker引擎http api的一个包装 docker python包。在某些CI/CD场景中,当 Docker本机shell命令不可用。
GRPC protobuf文件编译
Usage: youtiao protoc [OPTIONS] Shortcut of grpc_tools.protoc to compile .proto file. Options: --proto-path PATH path of protobuf file [required] --out DIRECTORY output files location --help Show this message and exit.
GRPCIO工具的包装。
牧场主部署(CI/CD)
Usage: youtiao rancher_deploy [OPTIONS] Deploy using rancher (v1.6) API (v2.0 beta) Options: --rancher-url TEXT rancher server API endpoint URL [required] --rancher-key TEXT rancher account or environment API access key [required] --rancher-secret TEXT rancher account or environment API secret corresponding to the access key [required] --rancher-env TEXT used to specify environemnt if account key is provided --stack TEXT stack name defined in rancher [required] --service TEXT service name defined in rancher [required] --batch-size INTEGER number of containers to upgrade at once --batch-interval INTEGER interval (in second) between upgrade batches --sidekicks / --no-sidekicks upgrade sidekicks services at the same time --start-before-stopping / --no-start-before-stopping start new containers before stopping the old ones --help Show this message and exit.
您可以在您的 blog。
关于“youtiao”
“Youtiao”是一个长 金棕色油炸面团条,在中国食用(由多种 在其他东亚和东南亚菜系中。 按惯例,鱼苗是用盐腌制的,这样它们就可以出生了。 纵向一分为二。油条通常在早餐时作为 搭配米粥、豆浆或普通牛奶 苏格。
youtiao
支持项目
如果您发现项目有帮助,请捐赠eth:
0x7744F44ecB64ce24b09e1F924DD48a4Ada32A835