Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to quickly build FaaS Services with SCA Command Line tools

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about how SCA command-line tools quickly build FaaS services. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

Serverless architecture (serverless architecture) is a new and revolutionary architecture model in the era of cloud computing. It means that developers do not need to care about the underlying server and other infrastructure, and the platform will automatically schedule the flexible scaling of resources according to the number of business requests, and all resources will be paid on demand, and no requests and resource occupancy will not be charged. The operational complexity is greatly reduced on the premise of reducing costs.

When the Serverless architecture entered the public eye in 2014, it was widely believed that Serverless could significantly reduce the cost of IT, reduce cloud fees by 10% and 90%, and improve the efficiency of service deployment. After years of precipitation, some companies have been practicing Serverless, and the results are obvious. FaaS (Functions as a Service) function as the core computing component of Serverless architecture, applications are decoupled into fine-grained functions by gluing together other products or services, and all logic can be completed in functions, which enables engineers to focus more on developing excellent new features and quickly building applications and services, rather than writing redundant code that has to be written.

What is SCA CLI?

SCA (Serverless Cloud Application,SCA) CLI is a command line tool for JD.com 's cloud serverless cloud application. Through SCA, users can quickly generate function function projects and develop independently based on the project template, which can easily complete the local debugging, packaging, deployment and other operations of the function, and greatly improve the development efficiency of developers.

What does SCA CLI do?

With the SCA command line tool, users can:

Quickly initialize the function service project

Develop and test function code locally

Package services and deploy them to the cloud

Call cloud functions to execute

Manage cloud functions and query cloud function logs

The following commands are supported:

SCA correct open posture

SCA CLI supports Linux and Mac operation. 
 at the same time, because SCA CLI is based on go development, so users only need to download the installation package to use.

Take the Linux environment as an example, follow us to quickly create a deployment test-function

Step 1 installation

Execute the following command to complete the download and installation in one step:

Curl-O https://raw.githubusercontent.com/jdcloud-serverless/sca/master/hack/install.sh & & chmod + 777install.sh & & sh install.sh & & source ~ / .bashrc

Verify:

Step 2 configure account information

After SCA is installed, use the config command to synchronize the JDCloud account information to SCA:

# sca config [>] JDCould accountid = xxxx (your acount id) [>] JDCould region = cn-north-1 [>] JDCould access-key = 0123abcd (your AK) [>] JDCould secret-key = abcd0123 (your SK)

Step 3 initialization project

By initializing the project, users can quickly create a project template, mainly including code file: index.py, configuration file: template.yaml, based on the template can be further independent configuration and development.

Initialize the function project in the current directory:

Project name (default): testproject

Function name (default): test-function

Runtime (default): python3.6

Initialize the test-function project as follows:

The function template configuration file template.yaml is a function resource description file. SCA deploys the local code and configuration to the cloud based on the configuration file.

Step 4 code development and upload

At this point, upload your developed code and dependent libraries to the CodeUri location. Here, we use the index.py function under the default test-function function directory.

Step 5 configuration function and Verification

After completing the configuration of the test-function function, you can verify the template.yaml template with the validate command:

Step 6 Local Test

(docker needs to be installed for local execution) Test the test-function function in the template.yaml file in the current directory by default. The event test event defaults to the key:value string:

Step 7 packaged deployment

Deploy the functions in the current directory template.yaml configuration to the cloud, and override the cloud rename function by default.

This is how the SCA command line tool shared by Xiaobian quickly builds FaaS services. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report