Introduction to the experience
This scenario describes how to use the function computing service to build a Django Blog Blog . Use Serverless Devs Command line tools can integrate many frameworks 、 application 、 The case is deployed to the function computing platform with one click .
This experiment One time is provided 2 Hours of ECS
This scenario mainly involves the following cloud products and services ：
1、 Function calculation （FunctionCompute）
Function computing is an event driven fully managed computing service . Use functions to calculate , You don't need to purchase and manage infrastructure like servers , Just write and upload the code . Function calculation is ready for you to calculate resources , Run tasks flexibly and reliably , And provide log query 、 Performance monitoring, alarm and other functions . Function calculations help you avoid managing servers （Serverless）, Just focusing on function code can quickly build applications . Function computation can scale elastically , You just have to pay by usage .
Function calculation Serverless Compared with self built service, service has the following advantages ：
Easy to get started , Focus on business logic development only , Greatly improve the efficiency of engineering development .
There are too many learning and configuration costs for self built programs , For example, for different scenarios ,ESS Various parameter configurations are needed , It is troublesome to maintain and upgrade the system environment .
No operation and maintenance , Support function execution level granularity monitoring and alarm .
Millisecond elastic expansion , Ensure high flexibility .
2、 Container image service ACR
Container mirroring service is container mirroring oriented 、Helm Chart Etc OCI Standard cloud native product security hosting and efficient distribution platform .ACR Support global synchronous acceleration 、 On a large scale / Big image distribution speeds up 、 Multi code source construction acceleration and other whole chain ways to improve efficiency , And container services ACK Seamless integration , Help enterprises reduce delivery complexity , Create a one-stop solution for cloud native applications .
3、 File store NAS
File store NAS Is a large-scale shared access , Elastic expansion of high-performance cloud native distributed file system . Support intelligent hot and cold data layering , Effectively reduce data storage costs . It is widely used in enterprise application data sharing 、 Containers 、AI machine learning 、Web Services and content management 、 Application development and testing 、 Media and entertainment workflow 、 Database backup and so on .
4、Serverless Devs Developer tools
Serverless Devs It is a component and plug-in Serverless Developer Platform , Developers can pluggably use different tools in the platform Serverless Services and frameworks for , Participate in the development of components and plug-ins at the same time . Whether it's industrial grade Serverless service , Or all kinds of open source Serverless frame ,Serverless Devs Can be friendly and supportive . Developers don't have to deal with every model on the market Serverless Tools for research and learning , Just pass Serverless Devs, It can be simple 、 Quickly “ Get started ” Main stream Serverless Services and frameworks .
1. Open function computing service
Before you use a function to calculate , You need to open the function calculation service .
The alicloud sub account provided in this scenario has no function computing service operation permissions , So please use your alicloud account to operate . You don't have to worry about the deduction , Because the function computing service has a certain amount of free , See billing method .
Log in to the alicloud console with your own alicloud account , Then enter the function calculation details page .
Click free to subscribe .
3. Check the function to calculate the service agreement , Click open now .
After successful opening , You will receive the following prompt .
2. install Serverless Devs Command line tools
install Node.js Environmental Science .
Execute the following command , download Node.js Installation package .
Execute the following command , Unzip the installation package and rename .
tar -xvf node-v12.4.0-linux-x64.tar.xz && mv node-v12.4.0-linux-x64/ /usr/local/node
Execute the following command , Configure environment variables .
echo "export PATH=$PATH:/usr/local/node/bin" >> /etc/profile source /etc/profile
Execute the following command , install Serverless-Devs Tools .
npm install @serverless-devs/s -g
The results are as follows , Indicates installation is complete .
If the installation process is slow , You can use Taobao npm Source , The installation command is npm --registry=https://registry.npm.taobao.org install @serverless-devs/s -g.
Execute the following command , Check the version and check that it is installed correctly .
The results are as follows , You can see Serverless-Devs Version of the tool .
3. Configure alicloud account information
This scenario provides free ECS The server , However, the function calculation service used is opened under your account , The following configuration information also needs to configure your account UID、AccessKry ID and AccessKey Secret Information .
Execute the following command , Configure account information .
s config add
Then fill in the following information according to the prompts .
Cloud manufacturers ： choice Alibaba Cloud（alibaba）.
AccountID： Please view your alicloud primary account on the account security settings page ID.
AccessKeyID and AccessKeySecret： Please check your account number on the security information management page AccessKey ID and AccessKey Secret.
· If you are using the main account of alicloud , Please in the security prompt pop-up box on the security information management page , Click continue AccessKey.
· If you are using alicloud RAM Sub user , You need to make sure that your child users have function calculation management rights AliyunFCFullAccess, See for RAM User authorization .
As shown in the figure below , You can go to the user AccessKey Area to view your AccessKey ID and AccessKey Secret. If your account has not been used AccessKey, Please click create... In the upper right corner AccessKey.
After successful configuration , You will receive Configuration successful A reminder of , As shown in the figure below .
4. build Django Blog Blog project
1、 Execute the following command , Initialize a... In the current path Django Blog project .
s init devsapp/django-blog
1) Enter the project file name django-blog Press enter .
2) Select the default credentials and press enter .
The results are as follows .
2、 take Typecho The project is deployed to the function computing service .
1) Execute the following command , Enter the project directory .
2) Execute the following command , Deployment project .
The results are as follows .
3、 Open the virtual desktop browser , Visit the test domain name , View deployed Django Blog The blog system .
Next, you can add some themes and plug-ins to enrich your blog system .