Skip to main content

BizyAir FaaS automated deployment tool

Project description

安装

1. 安装(二选一)

# 公有仓库
pip install git+https://<TOKEN>@github.com/siliconflow/BizyDeploy.git
# 私有仓库
pip install git+ssh://git@github.com/siliconflow/BizyDeploy.git

使用

export SF_FAAS_TOKEN=xxxxx

场景1: 仅更新faas云函数部署

bizy-deploy \
  pipeline=cgr_uat \
  service.sf_faas_token="$SF_FAAS_TOKEN" \
  ++env.function_id=fnjfvlqpdt \
  ++env.deployment_id=fdqd9p8te5 \
  ++func_def.spec.comment="upgrade"

场景2: 仅更新镜像版本 (最常用)

下面镜像对应云函数地址: https://cloud.siliconflow.cn/sft-d1s6t1r3jrms73f3ltpg/dedicated/functions/fnjfvlqpdt?tab=definition

命令行中的 ++func_def.spec.data 对应控制台“函数定义”中的 YAML 结构

bizy-deploy \
  debug=false \
  pipeline=cgr_prod \
  service.sf_faas_token="$SF_FAAS_TOKEN" \
  ++env.function_id=fnjfvlqpdt \
  ++env.deployment_id=fdqd9p8te5 \
  ++func_def.spec.comment="update image to v20251222" \
  ++func_def.spec.data.cgrService.image="hub.6scloud.com/xxx/comfygridruntime:v20251222"

场景: 云函数模版相关操作

获取 {org_id}/{template_id} 对应云函数模版

bizy-deploy \
  pipeline=faas_api_op \
  debug=true \
  ++pipeline.0.action='get_template' \
  ++pipeline.0.params.org_id=d1s6t1r3jrms73f3ltpg \
  ++pipeline.0.params.template_id=bizydraft-backend \
  service.sf_faas_token="$SF_FAAS_TOKEN"

场景4: 从源云函数上获取配置,修改指定参数后上传到目标云函数,并部署等待就绪

bizy-deploy \
  pipeline=cgr_uat \
  ++pipeline.0.params.function_id=fna5m4t5ky \
  ++env.function_id=fn1tioyopg \
  ++env.deployment_id=fdg8skissk \
  ++func_def.spec.data.comfyagentService.nodeRegisterConfigUrl="https://storage.bizyair.cn/config/comfyagent_node_config_chenchaonan.json" \
  ++func_def.spec.data.comfyuiService.image="hub.6scloud.com/d1s6t1r3jrms73f3ltpg/comfyui-gpu-torch2dot5:v202512241113-feature-add-plugins-default-a8dc7ab" \
  service.sf_faas_token="$SF_FAAS_TOKEN"

场景5: 得到一个函数的最新定义,创建一个新的定义,修改部署的参数后部署并等待就绪

bizy-deploy \
  pipeline=faas_api_op \
  ++pipeline.0.action='get_latest_function_definition' \
  ++pipeline.0.params.function_id=fn1tioyopg \
  ++pipeline.0.save_result_as='latest_func_def' \
  ++pipeline.1.action='create_function_definition' \
  ++pipeline.1.params.function_id=fn1tioyopg \
  ++pipeline.1.params.merged_def='${pipe.ctx:latest_func_def}' \
  ++pipeline.1.save_result_as="new_version" \
  ++pipeline.2.action='deploy' \
  ++pipeline.2.params.version='${pipe.ctx:new_version}' \
  ++pipeline.2.params.overrides.spec.siliconServices.0.minReplicas=2 \
  ++pipeline.2.params.overrides.spec.siliconServices.0.maxReplicas=5 \
  ++pipeline.2.params.function_id=fn1tioyopg \
  ++pipeline.2.params.deployment_id="fdg8skissk" \
  ++pipeline.3.action='wait_ready' \
  ++pipeline.3.params.function_id=fn1tioyopg \
  ++pipeline.3.params.deployment_id=fdg8skissk \
  service.sf_faas_token="$SF_FAAS_TOKEN"

```python
python scripts/save_template.py -tpl d1s6t1r3jrms73f3ltpg/bizydraft-backend 
Output
✔ Template saved: d1s6t1r3jrms73f3ltpg/bizydraft-backend -> 
outputs/d1s6t1r3jrms73f3ltpg---bizydraft-backend.yaml

更新模版

bizy-deploy \
  pipeline=faas_api_op \
  ++pipeline.0.action='update_template' \
  ++pipeline.0.params.name=<template_id> \
  ++pipeline.0.params.data.files=<TemplateYamlPath> \
  service.sf_faas_token="<SF_FAAS_TOKEN>"

前端更新完成后清理缓存

# 通过环境变量设置使用
export BIZYAIR_TOKEN=sk-xxx     # 设置bizyair的token,必须
export SILICONFLOW_FASS_DEPLOY_DOMAIN=foo.bar:8192 # 设置内网域名,必须
export BIZYAIR_GROUP_ID=123 # 设置id( https://console.bizyair.cn/comfy-draft/exclusive-instances 的实例组id),必须
./scripts/ready_instance.sh


# 通过位置参数使用
./scripts/ready_instance.sh sk-xxx foo.bar:8192 123   # 带参使用脚本,传参顺序:token,内网域名,id

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bizy_deploy-0.2.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bizy_deploy-0.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file bizy_deploy-0.2.0.tar.gz.

File metadata

  • Download URL: bizy_deploy-0.2.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for bizy_deploy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 84df188e2f496f107d0abe58f7409af90632799316660edb91d495ceb863cc07
MD5 01a9793d98f96b3f45807f690ab4e733
BLAKE2b-256 51624dd9fbcb6536abe53d11f9dbb0ecfb969f66f43149e0082417b789a12b48

See more details on using hashes here.

File details

Details for the file bizy_deploy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bizy_deploy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for bizy_deploy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d12c9c83498923881578364e4ae88fbb701397ec4f5c82ab55bfa51c5d65447f
MD5 5fa9aadb0d72b71101197c6910688580
BLAKE2b-256 212db2054fb628e288c603fdc03013f45ce9296e299323cc44691deaa21a58ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page