From a3f3bc8d784a0bdff7c53004203ec92a32fe84d2 Mon Sep 17 00:00:00 2001 From: Hehe Tan <443016215@qq.com> Date: Fri, 14 Dec 2018 14:32:32 +0800 Subject: [PATCH] add faq document (#106) * add faq document --- README-zh.md | 1 + README.md | 1 + docs/usage/faq-zh.md | 69 +++++++++++++++++++++++++++++++++++++++++ docs/usage/faq.md | 73 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 docs/usage/faq-zh.md create mode 100644 docs/usage/faq.md diff --git a/README-zh.md b/README-zh.md index 8ba5abb8e..6493085e1 100644 --- a/README-zh.md +++ b/README-zh.md @@ -25,6 +25,7 @@ Fun 作为一个命令行工具,内置了多个子命令,比如 config、loc - [开发函数计算的正确姿势 —— 爬虫](https://yq.aliyun.com/articles/672624): 通过一个实战场景,介绍了如何利用 Fun 工具从头开始开发一个 Serverless 应用。 - [开发函数计算的正确姿势 —— 排查超时问题](https://yq.aliyun.com/articles/672627): 从一个 bug 开发,介绍了各种排查问题的技巧。 - [Fun 规范文档](https://github.com/aliyun/fun/blob/master/docs/specs/2018-04-03-zh-cn.md): 详细介绍了 Fun 规范文档的细节。 +- [常见问题与解答](https://github.com/aliyun/fun/blob/master/docs/usage/faq-zh.md): 使用 Fun 时的常见问题与解答。 - [更多示例](https://github.com/aliyun/fun/tree/master/examples) ## 反馈 diff --git a/README.md b/README.md index e366a2865..4286c354e 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ We have prepared a series of tutorials to help you use the Fun tool more easily: - [开发函数计算的正确姿势 —— 爬虫](https://yq.aliyun.com/articles/672624): How to use the Fun tool to develop a Serverless application from scratch. - [开发函数计算的正确姿势 —— 排查超时问题](https://yq.aliyun.com/articles/672627): Demonstrates how to solve a series of bugs and introduces the tricks of debug - [Specification](https://github.com/aliyun/fun/blob/master/docs/specs/2018-04-03.md): Introduces the syntax of the fun's template.yml file. +- [FAQ](https://github.com/aliyun/fun/blob/master/docs/usage/faq.md): Frequently asked questions and answers when using fun. - [More Examples](https://github.com/aliyun/fun/tree/master/examples) ## References diff --git a/docs/usage/faq-zh.md b/docs/usage/faq-zh.md new file mode 100644 index 000000000..dddab34c7 --- /dev/null +++ b/docs/usage/faq-zh.md @@ -0,0 +1,69 @@ + +# FAQ + +## Fun Deploy + +## FCINVALIDArgumentError: PUT /services/xxxxx failed with 400. requestId: xxxxx, message: VSwitch 'xxxxx' does not exist in VPC 'xxxxx'. The VSwith may not exist or the service role does not have 'vpc:DescribeVSwitchAttributes` permission. + +这个问题发生在使用 `fun deploy` 部署配置了 vpc 的函数: + +![](https://tan-blog.oss-cn-hangzhou.aliyuncs.com/img/20181214113413.png) + +如果已经确认错误提示中的 VSwitch 存在于 VPC 中,那么就可能是因为没有为服务角色添加 `AliyunECSNetworkInterfaceManagementAccess` 的权限。文档可以[参考](https://help.aliyun.com/knowledge_detail/72959.html)。 + +为服务角色添加权限的方法很简单,可以直接在 template.yml 中通过 [Policies](https://github.com/aliyun/fun/blob/master/docs/specs/2018-04-03-zh-cn.md#aliyunserverlessservice) 声明: + +``` +ROSTemplateFormatVersion: '2015-09-01' +Transform: 'Aliyun::Serverless-2018-04-03' +Resources: + localdemo: + Type: 'Aliyun::Serverless::Service' + Properties: + Description: 'local invoke demo' + Policies: + - AliyunECSNetworkInterfaceManagementAccess + VpcConfig: + VpcId: 'vpc-j6cfu2g6tslzekh8grfmk' + VSwitchIds: [ 'vsw-j6chkgsg9naj6gx49espd' ] + SecurityGroupId: 'sg-j6ceitqs6ljyssm1apom' +``` + +指定 `Policies` 时,Fun 会附加该权限到 Fun 创建的默认角色上。 + +也可以手动添加权限 `AliyunECSNetworkInterfaceManagementAccess` 到指定 role 上,然后将 [Role](https://github.com/aliyun/fun/blob/master/docs/specs/2018-04-03-zh-cn.md#aliyunserverlessservice) 属性配置到 template.yml 中: + +``` +ROSTemplateFormatVersion: '2015-09-01' +Transform: 'Aliyun::Serverless-2018-04-03' +Resources: + localdemo: + Type: 'Aliyun::Serverless::Service' + Properties: + Description: 'local invoke demo' + Role: 'acs:ram::1911504709953557:role/customrole' + VpcConfig: + VpcId: 'vpc-j6cfu2g6tslzekh8grfmk' + VSwitchIds: [ 'vsw-j6chkgsg9naj6gx49espd' ] + SecurityGroupId: 'sg-j6ceitqs6ljyssm1apom' +``` + +注意,`Role` 与 `Polices` 不能同时使用,如果配置了 `Role`,则 `Polices` 会被忽略。 + +## Fun Local + +### Error starting userland proxy: mkdir /port/tcp:0.0.0.0:80:tcp:172.17.0.2:5000: input/output error. + +这个问题发生在 windows 平台上的 `docker for windows`。错误信息如下: + +![](https://tan-blog.oss-cn-hangzhou.aliyuncs.com/img/20181214112210.png) + +已被确认为是一个 `docker for windows` 的 [bug](https://github.com/docker/for-win/issues/573)。 + +一个可行的解法是: + +禁用 `Experimental Features`,并重启 `docker`。 + +![](https://tan-blog.oss-cn-hangzhou.aliyuncs.com/img/20181214112400.png) + + diff --git a/docs/usage/faq.md b/docs/usage/faq.md new file mode 100644 index 000000000..1bd796b5e --- /dev/null +++ b/docs/usage/faq.md @@ -0,0 +1,73 @@ + +# FAQ + +## Fun Deploy + +### FCInvalidArgumentError: PUT /services/xxxxx failed with 400. requestId: xxxxx, message: VSwitch 'xxxxx' does not exist in VPC 'xxxxx'. The VSwith may not exist or the service role does not have 'vpc:DescribeVSwitchAttributes` permission. + +This problem occurs when deploying vpc with `fun deploy`: + +![](https://tan-blog.oss-cn-hangzhou.aliyuncs.com/img/20181214113413.png) + +If the VSwitch exists in the VPC as described in the error message, the reason for the problem is that the correct permission `AliyunECSNetworkInterfaceManagementAccess` are not added for the service role. [reference](https://www.alibabacloud.com/help/doc-detail/72959.htm). + + +The way to add permissions to a service role is simple. + +You can use [Policies](https://github.com/aliyun/fun/blob/master/docs/specs/2018-04-03.md#aliyunserverlessservice) directly in template.yml: + +``` +ROSTemplateFormatVersion: '2015-09-01' +Transform: 'Aliyun::Serverless-2018-04-03' +Resources: + localdemo: + Type: 'Aliyun::Serverless::Service' + Properties: + Description: 'local invoke demo' + Policies: + - AliyunECSNetworkInterfaceManagementAccess + VpcConfig: + VpcId: 'vpc-j6cfu2g6tslzekh8grfmk' + VSwitchIds: [ 'vsw-j6chkgsg9naj6gx49espd' ] + SecurityGroupId: 'sg-j6ceitqs6ljyssm1apom' +``` + +When `Policies` is specified, fun will append this permission to the default role created by Fun. + +You can also manually add `AliyunECSNetworkInterfaceManagementAccess` to the specified role and then configure the [Role](https://github.com/aliyun/fun/blob/master/docs/specs/2018-04-03.md#aliyunserverlessservice) property in template.yml: + +``` +ROSTemplateFormatVersion: '2015-09-01' +Transform: 'Aliyun::Serverless-2018-04-03' +Resources: + localdemo: + Type: 'Aliyun::Serverless::Service' + Properties: + Description: 'local invoke demo' + Role: 'acs:ram::1911504709953557:role/customrole' + VpcConfig: + VpcId: 'vpc-j6cfu2g6tslzekh8grfmk' + VSwitchIds: [ 'vsw-j6chkgsg9naj6gx49espd' ] + SecurityGroupId: 'sg-j6ceitqs6ljyssm1apom' +``` + +Note that `Role` and `Polices` cannot be used at the same time. If `Role` is configured, `Polices` will be ignored. + +## Fun Local + +### Error starting userland proxy: mkdir /port/tcp:0.0.0.0:80:tcp:172.17.0.2:5000: input/output error. + +This problem occurs with `docker for windows` on the Windows platform. The error message is as follows: + +![](https://tan-blog.oss-cn-hangzhou.aliyuncs.com/img/20181214112210.png) + +It has been confirmed as a [bug](https://github.com/docker/for-win/issues/573) with `docker for windows`. + +This can be as a workaround: + +Disabling "Experimental Features" in the Settings/Daemon menu, and then restarting docker. + +![](https://tan-blog.oss-cn-hangzhou.aliyuncs.com/img/20181214112400.png) + + +