devsapp / fc Goto Github PK
View Code? Open in Web Editor NEW阿里云函数计算(FC)组件
License: MIT License
阿里云函数计算(FC)组件
License: MIT License
https://help.aliyun.com/document_detail/51907.html
比如有 cpu 和 内存 quota 限制, 线程和进程数目限制等
如果配置了Role等,不对其进行更多操作
通过类似 s local start -p port 的方式实现指定容器端口,便于本地调试
如果仅定义一个 customDomains 模块,我们是否可以直接部署呢?而不是不需要将 服务、函数、触发器都填上才可以部署
services:
fc-deploy-test:
component: devsapp/fc
props:
region: cn-shenzhen
customDomains:
- domainName: auto
protocol: HTTP
routeConfigs:
- path: /*
serviceName: unit-deploy-service
functionName: event-function
目前函数资源的基本操作,例如创建函数/服务、更新函数/服务、删除函数/服务等,没有相关说明。可以补充一下。
进入 examples/code-local 目录,执行 s build --use-docker
,然后先后执行 s deploy
以及 s deploy --use-remote
,会出现如下报错:
$ s deploy --use-remote
[2021-06-09T17:00:27.177] [INFO ] [S-CLI] - Start ...
[2021-06-09T17:00:33.134] [INFO ] [FC-DEPLOY] - Using region: cn-shanghai
[2021-06-09T17:00:33.134] [INFO ] [FC-DEPLOY] - Using access alias: default
[2021-06-09T17:00:33.135] [INFO ] [FC-DEPLOY] - Using accountId: ***********3743
[2021-06-09T17:00:33.135] [INFO ] [FC-DEPLOY] - Using accessKeyId: ***********PeUX
[2021-06-09T17:00:35.548] [INFO ] [FC-DEPLOY] - service: qianfeng-demo exists online.
[2021-06-09T17:00:37.786] [INFO ] [FC-DEPLOY] - function: node-demo exists online.
[2021-06-09T17:00:40.206] [INFO ] [FC-DEPLOY] - trigger: httpTrigger exists online.
[2021-06-09T17:00:40.211] [INFO ] [FC-DEPLOY] - Fc detects that you have run build command for function: node-demo, use build codeUri: /Users/zqf/Documents/git_proj/devsapp/component/fc-alibaba-component/examples/code-local/.s/build/artifacts/qianfeng-demo/node-demo instead of your codeUri: ./code
detail:
added:
LD_LIBRARY_PATH: >-
/code/.s/root/usr/local/lib:/code/.s/root/usr/lib:/code/.s/root/usr/lib/x86_64-linux-gnu:/code/.s/root/usr/lib64:/code/.s/root/lib:/code/.s/root/lib/x86_64-linux-gnu:/code/.s/root/python/lib/python2.7/site-packages:/code/.s/root/python/lib/python3.6/site-packages:/code:/code/lib:/usr/local/lib
PATH: >-
/code/.s/root/usr/local/bin:/code/.s/root/usr/local/sbin:/code/.s/root/usr/bin:/code/.s/root/usr/sbin:/code/.s/root/sbin:/code/.s/root/bin:/code:/code/node_modules/.bin:/code/.s/python/bin:/code/.s/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/sbin:/bin
NODE_PATH: /code/node_modules:/usr/local/lib/node_modules
PYTHONUSERBASE: /code/.s/python
deleted: {}
updated: {}
? Fc add/append some content to your origin environment variables for finding dependencies generate
d by build command. Are you sure to continue? no
[2021-06-09T17:00:45.027] [INFO ] [FC-SYNC] - sync code to /Users/zqf/.s/cache/fc-deploy/remote-code/1986114430573743_cn-shanghai_qianfeng-demo_node-demo
✔ download success
[2021-06-09T17:00:56.248] [ERROR] [S-CLI] - Project fc-deploy-test failed to execute:
📝 Message: EEXIST: file already exists, symlink '../crc-32/bin/crc32.njs' -> '/Users/zqf/.s/cache/fc-deploy/remote-code/1986114430573743_cn-shanghai_qianfeng-demo_node-demo/node_modules/.bin/crc32'
🧭 You can get help for this component by [s fc-deploy-test -h]
😈 If you have questions, please tell us: https://github.com/Serverless-Devs/Serverless-Devs/issues
发布别名/删除版本/删除别名时,若没有指定别名或者版本,需要组件去 get 线上已有的别名或者版本,供用户选择后再进行后续操作。这样用户就不需要去主动去查询有哪些已有的别名/版本。
假设是如下场景, 有一个函数, 有一个 oss 触发器, 触发规则前缀是/a, 后缀是空, s 工具创建端云联调辅助函数的时候, 辅助函数可能因为 oss 的触发规则, 导致不能在辅助函数上创建 oss 触发器, 这个时候应该如何处理?
辅助函数创建成功, 吞掉不能创建触发器的错误, 提示用户可以临时将 oss 触发器指向辅助函数?
场景:
如果之前配置了initializer,之后将 initializer 配置删除掉了,执行 s dpeloy;此时我们 deploy 返回值是没有 initializer 的配置的,但是此配置线上时存在,不符合定义的预期 用户也无感知,执行的时候报错
在想这块是否可以显示线上的配置,用户也可以通过返回信息看到线上的配置是否符合他的预期,哪怕之后出现了问题,也可以很快的定位到问题
[2021-07-14T16:54:33.092] [INFO ] [FC-PROXIED-INVOKE] - Detecting code changes and Restarting funtion container...
(node:89465) UnhandledPromiseRejectionWarning: Error: (HTTP code 409) unexpected - Conflict. The container name "/fc_local_1626252873092_xoj0gyz" is already in use by container "77e635d336aa30a2150cb77723ffb69b74eb62d63a80bca8656701bd71036c2a". You have to remove (or rename) that container to be able to reuse that name.
at /Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:315:17
at getCause (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:345:7)
at Modem.buildPayload (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:314:5)
at IncomingMessage.<anonymous> (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:286:14)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1224:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:89465) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:89465) UnhandledPromiseRejectionWarning: Error: (HTTP code 409) unexpected - Conflict. The container name "/fc_local_1626252873092_xoj0gyz" is already in use by container "77e635d336aa30a2150cb77723ffb69b74eb62d63a80bca8656701bd71036c2a". You have to remove (or rename) that container to be able to reuse that name.
at /Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:315:17
at getCause (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:345:7)
at Modem.buildPayload (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:314:5)
at IncomingMessage.<anonymous> (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:286:14)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1224:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:89465) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
(node:89465) UnhandledPromiseRejectionWarning: Error: (HTTP code 409) unexpected - Conflict. The container name "/fc_local_1626252873092_xoj0gyz" is already in use by container "77e635d336aa30a2150cb77723ffb69b74eb62d63a80bca8656701bd71036c2a". You have to remove (or rename) that container to be able to reuse that name.
at /Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:315:17
at getCause (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:345:7)
at Modem.buildPayload (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:314:5)
at IncomingMessage.<anonymous> (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:286:14)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1224:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:89465) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)
[2021-07-14T16:54:35.161] [INFO ] [FC-PROXIED-INVOKE] - Skip pulling image aliyunfc/runtime-java8:1.9.18...
[2021-07-14T16:54:35.161] [INFO ] [FC-PROXIED-INVOKE] - Reloading success, stopping old container...
[2021-07-14T16:54:35.670] [INFO ] [FC-PROXIED-INVOKE] - Stopping container: e0b6f4bd171dd3cd9ce65dea1b4028ba756fac0ead8c6871cb31f02a3dc3220f
[2021-07-14T16:54:39.431] [INFO ] [FC-PROXIED-INVOKE] - Stopping old container successfully
[2021-07-14T16:54:39.433] [INFO ] [FC-PROXIED-INVOKE] - Detecting code changes and Restarting funtion container...
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
[2021-07-14T16:54:45.911] [INFO ] [FC-PROXIED-INVOKE] - Stopping old container successfully
[2021-07-14T16:54:45.912] [INFO ] [FC-PROXIED-INVOKE] - Detecting code changes and Restarting funtion container...
(node:89465) UnhandledPromiseRejectionWarning: Error: (HTTP code 409) unexpected - Conflict. The container name "/fc_local_1626252873138_x0vwt4a" is already in use by container "0efd7adda9a87a5e02d566778d5d7cfb74abadc44258693e23bf6e18c03df059". You have to remove (or rename) that container to be able to reuse that name.
at /Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:315:17
at getCause (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:345:7)
at Modem.buildPayload (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:314:5)
at IncomingMessage.<anonymous> (/Users/songluo/.s/components/devsapp.cn/devsapp/[email protected]/node_modules/docker-modem/lib/modem.js:286:14)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1224:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:89465) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
在fc组件上支持版本发布和别名发布的能力
s proxied invoke 不支持异步调用的话, 端云联调就不能支持异步调用配置功能
为了提升用户的整体使用体验,我们会针对一些报错信息进行特殊处理。现在征集所有用户的使用时出现的报错信息,我们会有针对性的进行整理
YAML规范中,给了许多函数/服务相关的配置说明,但是没有提供YAML本身的规范,例如,Component是否必选,支持哪些component,怎么查看这些component,如何选择component,还需补充完整。
场景: 假设我开发一个 java 的函数, 设置了单实例多并发, 我想并发发请求,然后跟据日志做一些debug, 或者尝试复现某些问题
复现步骤:
common 'ls -al' 报错不符合预期
如果 nasdir 为根目录copy 文件异常
有的用户想在部署前有一步操作,只输出压缩后的代码包,判断该包是否符合预期,若符合预期再进行上传。
所以是否需要增加一个指令,例如 pack 指令,只打包代码包,然后透出给用户,然用户自行判断是否执行后面的 deploy 操作。
在执行s sync的时候,需要把密钥信息也添加上。这个要看用户指定的密钥信息是什么,对应的填写到Yaml中
现在s remove的行为有些鸡肋,这里需要增加一种模式可能会更好,就是:
s remove service -f
可以强行删掉service下所有的东西
针对权限问题,专项处理Issue
目前每次需要根据 session 名字创建一个新的 role, 也就是要求 s 配置的 access 差不多需要 ramfull 的权限, 这个对于权限要求过大, 对于子账号,体验端云联调, 只需要增加如下 access 即可
{
"Statement": [
{
"Effect": "Allow",
"Action": "tns:*",
"Resource": "*"
}
],
"Version": "1"
}
需要的体验大致如下:
梳理一下参数的支持,支持更多的参数。
主要是和API对齐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.