Skip to content

Commit b3c5a79

Browse files
authored
Merge pull request #27 from devsapp/new_docs
New docs
2 parents cad710e + cdee0d0 commit b3c5a79

File tree

19 files changed

+483
-170
lines changed

19 files changed

+483
-170
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# 快速体验 Custom Container C++ Event 函数案例
2+
3+
欢迎您使用Serverless Devs开发者工具进行项目开发,本实验是基于Serverless Devs部署 Custom Container C++ Event 案例到阿里云函数计算。
4+
5+
整个实验过程包括:
6+
- [下载工具](#下载工具)
7+
- [配置密钥](#配置密钥)
8+
- [初始化项目](#初始化项目)
9+
- [部署项目](#部署项目)
10+
- [更多信息](#更多信息)
11+
12+
> - [:octocat: 源代码](https://github.com/devsapp/start-fc/tree/master/custom-function/cpp/fc-custom-cpp-event/src)
13+
14+
## 下载工具
15+
16+
> 由于本系统已经默认集成了Serverless Devs,所以该步骤在本次试验中可以跳过
17+
18+
通过`npm`安装Serverless Devs开发者工具:
19+
20+
```
21+
npm install -g @serverless-devs/s
22+
```
23+
24+
除了上述的安装方法之外,您还可以参考[Serverless Devs Cli 安装文档](https://www.serverless-devs.com/serverless-devs/install) 查看更多安装方法。
25+
26+
## 配置密钥
27+
28+
> 由于本系统已经配置了密钥信息,所以该步骤在本次试验中可以跳过
29+
30+
配置阿里云账号的 AccessKeyID, AccessKeySecret 以及密钥别名。
31+
32+
配置方法可以通过`s config add`指令,选择`Alibaba Cloud`并根据提示进行配置。
33+
34+
除了上述的配置方法之外,您还可以参考[Serverless Devs 配置阿里云密钥信息](https://www.serverless-devs.com/fc/config) 查看更多密钥配置方法。
35+
36+
## 初始化项目
37+
38+
进行项目初始化:
39+
40+
```
41+
s init start-fc-custom-container-event-cpp -d start-cc-event-cpp
42+
```
43+
44+
在初始化的过程中,可能涉及到部分服务的开通、参数的获取以及参数的定义,请根据命令行的提醒进行具体的操作。
45+
46+
## 部署项目
47+
48+
- 进入项目:`cd start-cc-event-cpp`
49+
- 进行项目的部署:`s deploy`
50+
51+
稍等片刻,即可完成项目的部署。
52+
53+
## 更多信息
54+
55+
- 组件仓库地址:https://github.com/devsapp/fc
56+
- 组件帮助文档:https://www.serverless-devs.com/fc/readme
57+
- Yaml参考文档:https://www.serverless-devs.com/fc/yaml/readme
58+
- 关于:
59+
- Serverless Devs和FC组件的关系、如何声明/部署多个函数、超过50M的代码包如何部署
60+
- 关于.fcignore使用方法、工具中.s目录是做什么、函数进行build操作之后如何处理build的产物
61+
等问题,可以参考文档:https://www.serverless-devs.com/fc/tips
62+
- 关于如何做CICD等问题,可以参考:https://www.serverless-devs.com/serverless-devs/cicd
63+
- 关于如何进行环境划分等问题,可以参考:https://www.serverless-devs.com/serverless-devs/extend
64+
65+
更多函数计算案例,可参考:https://github.com/devsapp/awesome/
66+
67+
> 有问题快来钉钉群问一下吧:33947367

custom-container-function/fc-custom-container-event-cpp/hook/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ async function preInit(inputObj) {
77
}
88

99
async function postInit(inputObj) {
10-
console.log(`\n Welcome to the Aliyun FC start application
11-
This application requires to open these services:
10+
console.log(`\nThis application requires to open these services:
1211
FC : https://fc.console.aliyun.com/
1312
ACR: https://cr.console.aliyun.com/
1413
15-
* 额外说明:s.yaml中声明了actions:
16-
部署前执行:s build --use-docker --dockerfile ./code/Dockerfile
17-
如果不需要每次都构建项目,或者部署前不需要构建,或者已经手动构建了,可以注释掉这部分内容
18-
> PS:部署的时候还需要修改s.yaml中image字段为自己的acr配置的地址
19-
* 项目初始化完成,您可以直接进入项目目录下,并使用 s deploy 进行项目部署
14+
* Additional note:
15+
1. [actions] are declared in s.yaml, execute before deployment: [s build --use-docker --dockerfile ./code/Dockerfile]
16+
If you don't need to build the project every time, or you don't need to build before deployment, or you have built it manually, you can comment out this part
17+
> PS: When deploying, you also need to modify the image field in s.yaml to configure the address for your own acr
18+
2. The Serverless Devs version required by the current project is at least v2.0.103. You can view the current version through [s -v] and upgrade the version through [npm install -g @serverless-devs/s].
19+
* After the project is initialized, you can directly enter the project directory and use s deploy to deploy the project
2020
\n`)
2121
}
2222

custom-container-function/fc-custom-container-event-cpp/publish.yaml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Type: Application
22
Name: start-fc-custom-container-event-cpp
33
Provider:
44
- 阿里云
5-
Version: 1.1.11
6-
Description: 快速部署一个基于custom container runtime 的C++ Event 类型的 Hello World 到阿里云函数计算
5+
Version: 1.2.0
6+
Description: 快速部署一个基于 Custom Container Runtime 的 C++ Event 类型的 Hello World 到阿里云函数计算
77
HomePage: https://github.com/devsapp/start-fc
88
Tags:
99
- 函数计算
@@ -13,8 +13,55 @@ Category: 新手入门
1313
Service:
1414
函数计算:
1515
Authorities:
16-
- 创建函数
17-
- 删除函数
18-
- 创建服务
19-
- 删除服务
16+
- AliyunFCFullAccess
17+
- AliyunContainerRegistryFullAccess
2018
Runtime: custom container
19+
Parameters:
20+
type: object
21+
additionalProperties: false # 不允许增加其他属性
22+
required: # 必填项
23+
- region
24+
- serviceName
25+
- functionName
26+
- acrRegistry
27+
properties:
28+
region:
29+
title: 地域
30+
type: string
31+
default: cn-hangzhou
32+
description: 创建应用所在的地区
33+
enum:
34+
- cn-beijing
35+
- cn-hangzhou
36+
- cn-shanghai
37+
- cn-qingdao
38+
- cn-zhangjiakou
39+
- cn-huhehaote
40+
- cn-shenzhen
41+
- cn-chengdu
42+
- cn-hongkong
43+
- ap-southeast-1
44+
- ap-southeast-2
45+
- ap-southeast-3
46+
- ap-southeast-5
47+
- ap-northeast-1
48+
- eu-central-1
49+
- eu-west-1
50+
- us-west-1
51+
- us-east-1
52+
- ap-south-1
53+
serviceName:
54+
title: 服务名
55+
type: string
56+
default: hello-world-service
57+
description: 服务名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间
58+
functionName:
59+
title: 函数名
60+
type: string
61+
default: custom-cpp-event-function
62+
description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-64 之间
63+
acrRegistry:
64+
title: 镜像仓库
65+
type: string
66+
examples: ['registry.cn-hangzhou.aliyuncs.com/fc-demo/fc-cpp-event:v0.1']
67+
description: 镜像仓库地址,需要在 https://cr.console.aliyun.com/ 中开通服务、创建仓库以及设置访问凭证

custom-container-function/fc-custom-container-event-cpp/readme-zh.md

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
# Alibaba Cloud Function Computing Custom Container C++ Event function
1+
# 阿里云函数计算 Custom Container C++ Event 函数案例
22

3-
You can quickly experience one-click deployment of a C++ application on Alibaba Cloud Function Computing Service in just a few steps:
3+
<toc>
44

5-
- Initialize the project: `s init start-fc-custom-container-event-cpp -d start-cc-event-cpp`
6-
- Enter the project: `cd start-cc-event-cpp`
7-
- Modify Image in s.yaml to be your own ACR mirror address
8-
- Deployment project: `s deploy -y`
9-
- Invoke function: `s invoke -e "{\"key\":\"val\"}"`
5+
<p align="center"> 中文 | <a href="./readme_en.md">英文 </a> </p>
106

11-
# Secondary development
7+
- [快速开始](#快速开始)
8+
- [通过应用中心部署](#通过应用中心部署)
9+
- [通过命令行工具部署](#通过命令行工具部署)
10+
- [通过阿里云CloudShell部署](#通过阿里云CloudShell部署)
11+
- [应用详情](#应用详情)
12+
- [关于我们](#关于我们)
1213

13-
Modify the two function logic in code/sample/src/handlers/echo_handler.cpp:
14+
</toc>
1415

15-
-EchoHandler::OnInvoke
16-
-EchoHandler::OnInitialize
16+
# 快速开始
1717

18-
> This application warehouse address: https://github.com/devsapp/start-fc
18+
- [:octocat: 源代码](https://github.com/devsapp/start-fc/tree/master/custom-function/cpp/fc-custom-cpp-event/src)
1919

20-
------------------------------------
21-
> # More
22-
> Welcome to use Alibaba Cloud Function Compute FC component for project development
23-
>
24-
> Component warehouse address/help document: https://github.com/devsapp/fc
25-
>
26-
> Yaml reference documentation: https://github.com/devsapp/fc/blob/main/docs/zh/yaml.md
27-
>
28-
> Quick start:
29-
> - Quickly create an application: https://github.com/devsapp/fc/blob/main/docs/zh/quick_start_application.md
30-
> - Quick use of commands: https://github.com/devsapp/fc/blob/main/docs/zh/quick_start_function.md
31-
------------------------------------
20+
## 通过应用中心部署
21+
22+
<appcenter>
23+
24+
您可以在阿里云 [:earth_asia: Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=start-fc-custom-container-event-cpp),快速体验该应用。
25+
26+
</appcenter>
27+
28+
## 通过命令行工具部署
29+
30+
> 在开始之前,需要先安装 Serverless Devs 开发者工具:`npm install @serverless-devs/s -g`,更多安装方法,可以参考[Serverless Devs 安装文档](https://www.serverless-devs.com/serverless-devs/install) ,针对阿里云还需要配置密钥信息,配置密钥信息的方法可以参考[阿里云密钥配置文档](https://www.serverless-devs.com/fc/config)
31+
32+
- 初始化项目:`s init start-fc-custom-container-event-cpp -d start-cc-event-cpp`
33+
> 涉及到确定密钥的选择、服务名称的确定、函数名称的确定以及容器镜像的确定
34+
- 进入项目:`cd start-cc-event-cpp`
35+
- 部署项目:`s deploy -y`
36+
- 调用函数:`s invoke -e "{\"key\":\"val\"}"`
37+
38+
## 通过阿里云CloudShell部署
39+
40+
如果您不想在应用中心中快速体验,也不想下载命令行工具体验,您也可以在[ :rocket: 阿里云 CloudShell](https://api.aliyun.com/new#/tutorial?action=git_open&git_repo=https://github.com/devsapp/start-fc.git&tutorial=custom-container-function/fc-custom-container-event-cpp/cloudshell.md) 中快速体验。
41+
42+
# 应用详情
43+
44+
该应用是阿里云函数计算 Custom Container C++ Event 函数案例,如果想要基于该应用进行完善,可以修改`code/sample/src/handlers/echo_handler.cpp`中的两个函数逻辑即可:
45+
46+
- EchoHandler::OnInvoke
47+
- EchoHandler::OnInitialize
48+
49+
# 关于我们
50+
51+
- Serverless Devs 工具:
52+
- 仓库:[https://www.github.com/serverless-devs/serverless-devs](https://www.github.com/serverless-devs/serverless-devs)
53+
> 欢迎帮我们增加一个 :star2:
54+
- 官网:[https://www.serverless-devs.com/](https://www.serverless-devs.com/)
55+
- 阿里云函数计算组件:
56+
- 仓库:[https://github.com/devsapp/fc](https://github.com/devsapp/fc)
57+
- 帮助文档:[https://www.serverless-devs.com/fc/readme](https://www.serverless-devs.com/fc/readme)
58+
- 钉钉交流群:33947367
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Alibaba Cloud Function Compute Custom Container C++ Event function case
2+
3+
<toc>
4+
5+
<p align="center"> <a href="./readme.md"> 中文 </a> | 英文 </p>
6+
7+
- [Quick start](#Quick-start)
8+
- [Deploy via command line tool](#Deploy-via-command-line-tools)
9+
- [Application details](#Application-details)
10+
- [About Us](#About-Us)
11+
12+
</toc>
13+
14+
# Quick start
15+
16+
- [:octocat: source](https://github.com/devsapp/start-fc/tree/master/custom-function/cpp/fc-custom-cpp-event/src)
17+
18+
## Deploy via command line tools
19+
20+
> Before starting, you need to install the Serverless Devs developer tools: `npm install @serverless-devs/s -g`, for more installation methods, please refer to [Serverless Devs Installation Documentation](https://www.serverless-devs.com/serverless-devs/install) , you also need to configure key information for Alibaba Cloud. For the method of configuring key information, please refer to [Alibaba Cloud Key Configuration Document](https://www.serverless-devs.com/fc/config)
21+
22+
- Initialize the project: `s init start-fc-custom-container-event-cpp -d start-cc-event-cpp`
23+
> It involves determining the selection of the key, the determination of the service name, the determination of the function name, and the determination of the container image
24+
- Enter the project: `cd start-cc-event-cpp`
25+
- Deploy the project: `s deploy -y`
26+
- Invoke function: `s invoke -e "{\"key\":\"val\"}"`
27+
28+
# Application details
29+
30+
This application is a case of Alibaba Cloud Function Computing Custom Container C++ Event function. If you want to improve based on this application, you can modify the two function logics in `code/sample/src/handlers/echo_handler.cpp`:
31+
32+
- EchoHandler::OnInvoke
33+
- EchoHandler::OnInitialize
34+
35+
# About Us
36+
37+
- Serverless Devs Tools:
38+
- Repository: [https://www.github.com/serverless-devs/serverless-devs](https://www.github.com/serverless-devs/serverless-devs)
39+
> Welcome to add a :star2:
40+
- Official website: [https://www.serverless-devs.com/](https://www.serverless-devs.com/)
41+
- Alibaba Cloud Function Compute components:
42+
- Repository: [https://github.com/devsapp/fc](https://github.com/devsapp/fc)
43+
- Help document: [https://www.serverless-devs.com/fc/readme](https://www.serverless-devs.com/fc/readme)
44+
- Dingding communication group: 33947367

custom-container-function/fc-custom-container-event-cpp/src/README.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)