If you use Funcraft to manage resources, we recommend that you migrate the resources to Serverless Devs for management. This topic describes how to migrate Function Compute-related resources from Funcraft to different components of Serverless Devs.

Serverless Devs has more advantages than Funcraft.
  • Scalability: Serverless Devs can be integrated with more services and features with ease.
  • Comprehensive features: Serverless Devs allows you to query logs and metrics, and synchronize resources. For more information, see Manage resources in YAML mode and Manage resources in command mode.
  • Multiple modes: Serverless Devs allows you to manage resources in YAML mode by using the s.yml file and command mode.

Migration methods

Parameters:
  • --source: the path of the function managed by using Funcraft.
  • --target: the name of the YAML file in which the function to be migrated is defined.
  • --force: specifies to forcibly overwrite the file if the specified file name already exists.
  • --region string: the ID of the region where the resource is deployed.

Migrate resources from Funcraft to the FC component of Serverless Devs

You can use one of the following methods to migrate resources:
  • Run the conversion command (recommended)
    In the directory of the function managed by using Funcraft, run the following command to convert the YAML file of Funcraft into a YAML file that can be identified by Serverless Devs:
    s cli fc-transform fun2fc --target s.yaml
    Command output:
    √ File decompression completed
    [2021-07-29T11:11:52.317] [INFO ] [FC-TRANSFORM] - Using funcraft yaml: C:\Users\ty\Desktop\ddd\jy\test\template.yml
    [2021-07-29T11:11:52.390] [INFO ] [FC-TRANSFORM] - Reminder serverless devs yaml path: C:\Users\ty\Desktop\ddd\jy\test\s.yaml
    
    Tips for next step
    
    ======================
    * Invoke Event Function: s local invoke -t s.yaml
    * Invoke Http Function: s local start -t s.yaml
    * Deploy Resources: s deploy -t s.yaml
    
    End of method: fun2fc
  • Create an s.yaml file
    In the directory of the function managed by using Funcraft, create an s.yaml file and copy the following code to the file:
    edition: 1.0.0  # The version of the semantic versioning specification with which the YAML syntax complies. 
    name: funApp  # The name of the project. 
    access: default  # The alias of the key. 
    
    services:
      fun-test: # The name of the service. 
        component: fun  # The name of the component. 
        props: # The properties of the component. 
          region: cn-hangzhou
          config: s

    For more information about the fields in the s.yaml file, see YAML syntax.

  • Synchronize resources

    If your resources are deployed to Function Compute, you can run the commands for managing resources to synchronize resources. This way, you can use Serverless Devs to manage projects. For more information about how to synchronize and manage resources, see User guide.

Migrate resources from Funcraft to the ROS component of Serverless Devs

  • Run the conversion command (recommended)
    In the directory of the function managed by using Funcraft, run the following command to convert the YAML file of Funcraft into a YAML file that can be identified by Serverless Devs:
    s cli fc-transform fun2ros --target s.yaml
    Command output:
    [2021-08-06T11:39:38.905] [INFO ] [FC-TRANSFORM] - Using funcraft yaml: C:\Users\ju\Desktop\test\3\template.yml
    [2021-08-06T11:39:38.981] [INFO ] [FC-TRANSFORM] - Reminder serverless devs yaml path: C:\Users\ju\Desktop\test\3\s.yaml
    
    Tips for next step
    
    ======================
    * Deploy Resources: s deploy -t s.yaml
    
    End of method: fun2ros
  • Create an s.yaml file
    In the directory of the function managed by using Funcraft, create an s.yaml file and copy the following code to the file:
    edition: 1.0.0  # The version of the semantic versioning specification with which the YAML syntax complies. 
    name: rosApp  # The name of the project. 
    access: default  # The alias of the key. 
    
    services:
      ros-test: # The name of the service. 
        component: ros  # The name of the component. 
        props: # The properties of the component. 
          region: cn-hangzhou
            name: test
            template: ./temp.json
            policy:
              url: url
              body: body
    Parameters in the services field:
    • region: the region where the resource is deployed.
    • name: the name of the Resource Orchestration Service (ROS) resource.
    • template: the on-premises path of the template file.
    • policy: the configuration of the policy. This parameter contains the following parameters:
      • url: the URL of the file that contains the stack policy. The URL must point to a policy that is located in an HTTP or HTTPS web server or an Object Storage Service (OSS) bucket. The file that contains the policy cannot exceed 16,384 bytes in size. If you use an OSS bucket and do not specify the region where the bucket resides, the default region is the same as the value of the region parameter.
      • body: the body of the stack policy. The body cannot exceed 524,288 bytes in size.