本文介绍如何通过fun deploy命令或ROS方式将应用部署到云上。
注意 本文介绍的内容后期将不再维护。如果您的函数计算资源是使用Funcraft管理的,建议您将资源迁移至Serverless Devs管理。
关于如何将函数计算的相关资源从Funcraft迁移到Serverless Devs进行管理的详细操作,请参见从Funcraft迁移到Serverless Devs。
关于Serverless Devs的详细信息,请参见什么是Serverless Devs。
关于如何使用Serverless Devs部署资源,请参见使用s deploy的相关命令部署资源。
由此带来的不便,敬请谅解!
背景信息
Funcraft引入了一种全新的部署方式即ROS部署,使用ROS的部署方式使部署具备更完善的资源状态管理机制、回滚机制等优点。
优势 | 描述 |
---|---|
具备更完善的资源状态管理机制 | 通过ROS部署应用时,使Funcraft能够准确地感知资源的新增、更新、删除以及不变,通过感知这些资源的状态变化,Funcraft可以做出正确的决策,达到预期的行为。 |
具备回滚机制 | 在部署应用的过程中,任何资源的操作失败,都会导致整个资源栈的回滚。通过ROS部署应用,当部署失败时可以回滚到上一个正确的状态,解决部署过程中服务不可用的问题。 |
灵活定义模型 | 通常一个template.yml用来描述一个完整的应用,您看到的template.yml内容,就是您部署到线上应用的最终形态,通过ROS部署可以更加灵活地部署应用。 |
明确部署差异 | 通过ROS部署应用,您可以了解到当前的模板文件是否与线上的文件同步,因此可以快速决策是否直接将本地模板部署到云上。 |
支持更多的云资源 | ROS纳入了更多的云资源的管理,覆盖了使用者的全部使用场景。 |
支持快速创建多套开发环境 | 当需要创建多套开发环境时,无需手动修改资源的唯一名称等标识。 |
功能介绍
执行以下命令获取
fun deploy
的帮助信息。fun deploy -h
预期输出:
Usage: fun deploy [options] [resource]
Deploy a serverless application.
use 'fun deploy' to deploy all resources
use 'fun deploy serviceName' to deploy all functions under a service
use 'fun deploy functionName' to deploy only a function resource
with '--only-config' parameter, will only update resource config without updating the function code
use '--parameter-override', A parameter structures that specify input parameters for your stack template.
If you're updating a stack and you don't specify a parameter, the command uses the stack's existing value.
For new stacks, you must specify parameters that don't have a default value. Syntax: parameterkey=parametervalue.
Options:
-t, --template [template] The path of fun template file.
-c, --only-config Update only configuration flags
-p, --parameter-override <parameter> A parameter structures that specify input parameters for your stack template.
-y, --assume-yes Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively.
--use-ros Deploy resources using ROS
--use-nas Automatically upload local resources to NAS.
--stack-name <stackName> The name of the ROS stack
--push-registry <pushRegistry> Modify the image upload path
-h, --help display help for command
fun deploy命令部署
ROS方式部署