This topic describes how to run the fun deploy command or use Resource Orchestration Service (ROS) to deploy an application to the cloud.
Prerequisites
- Create buckets.
- Optional:Create a stack.
Background information
Funcraft allows you to use ROS to deploy applications. The deployment by using ROS
provides benefits such as a complete management mechanism for resource status and
a rollback mechanism.
Benefit | Description |
---|---|
Complete management mechanism for resource status | When you use ROS to deploy applications, Funcraft can detect new, updated, deleted, and fixed resources to deploy applications as scheduled. |
Rollback mechanism | When you deploy an application, a failure to manage resources causes the entire stack to be rolled back. If an application fails to be deployed when you use ROS to deploy the application, the application can roll back to the previous available state to ensure service availability. |
Flexible definition of models | Generally, the template.yml file is used to describe a complete application. The application is deployed as described in the template.yml file. ROS allows you to deploy applications more flexibly. |
Clear deployment differences | When you use ROS to deploy applications, you can know whether the current template file is synchronized with the online file. This way, you can efficiently determine whether to directly deploy the on-premises template to the cloud. |
Support for more cloud resources | ROS allows you to manage more cloud resources, which covers all usage scenarios. |
Support for efficiently creating multiple development environments | If you need to create multiple development environments, you do not need to modify the unique values of resource identifiers. |
ROS allows you to describe more resources in template files. You can declare Funcraft
resources as well as ROS-supported resources in template files of Funcraft. For more information,
see Resource type index. For example, you can use the following code to declare an Object Storage Service
(OSS) bucket:
Bucket:
Type: 'ALIYUN::OSS::Bucket'
Properties:
BucketName: 'oss-unzip-demo-bucket' // Replace oss-unzip-demo-bucket with your bucket name.
Obtain the help information of the fun deploy command
Run the following command to obtain the help information of the
fun deploy
command: fun deploy -h
Expected output:
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
Run the fun deploy command to deploy an application
Use ROS to deploy an application