Coder Social home page Coder Social logo

alibaba / funcraft Goto Github PK

View Code? Open in Web Editor NEW
940.0 28.0 129.0 22.09 MB

(have) Fun with Serverless(API Gateway & Function Compute)

License: MIT License

JavaScript 55.85% Makefile 0.25% Shell 0.31% Java 0.40% PHP 0.05% Python 0.10% C# 0.05% TypeScript 3.47% Dockerfile 0.02% Go 0.02% F# 0.13% Dart 0.02% Lua 0.44% PowerShell 0.04% Ruby 0.07% Rust 0.01% CMake 0.11% C++ 38.65%
serverless function-compute aliyun alibabacloud

funcraft's Introduction

全新的Serverless应用全生命周期管理工具:Serverless Devs

感谢您长期对Funcraft的关注和支持,随着时间的发展,我们逐渐的发现Funcraft在很多端到端的能力上以及可拓展性上面是比较差的,很难满足日后Serverless架构的飞速发展步伐。所以我们大胆尝试,勇敢创建,推出了全新的Serverless开发者工具:Serverless Devs,通过Serverless Devs你可以非常方便的进行应用的开发、部署、调试。

  • 关于Serverless Devs下的FC组件支持的功能,可以参考命令文档
  • 关于Funcraft和Serverless Devs的对比,可以参考对比文档
  • 关于Funcraft如何快速迁移到Serverless,可以参考迁移方法

也感谢您对阿里云函数计算团队的关注,欢迎和我们一起快速开始Serverless Devs之旅


Funcraft

(have)Fun with Serverless

logo.jpg

English

Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API 网关、日志服务等资源。它通过一个资源配置文件(template.yml),协助您进行开发、构建、部署操作。

如果你想使用旧版本的语法,请参考.

开始使用

Fun 作为一个命令行工具,内置了多个子命令,比如 config、local、deploy 等。

其中,config 子命令可以用来配置 fun,local 子命令可以用来本地运行调试函数,deploy 子命令可以将资源发布到线上。

为了让您尽快上手,我们准备了一系列教程:

反馈

如您在使用中遇到问题,可以在这里反馈 https://github.com/aliyun/fun/issues

参考

开源许可

The MIT License

funcraft's People

Contributors

anycodes avatar arlenmbx avatar beary avatar chandaoh avatar cici503 avatar cnqfzhang avatar coco-super avatar dependabot[bot] avatar devdengchao avatar feil0n9wan9 avatar hainuo avatar hooklife avatar htynkn avatar jacksontian avatar muxiangqiu avatar rouralberto avatar rsonghuster avatar sherryt400 avatar squatstonight avatar tanhe123 avatar txd12 avatar vangie avatar wss-git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

funcraft's Issues

InactiveError问题

image
只是试一下hello world例子 API Gateway 设置却失败 到底是什么问题?

上传code的zip包的时候一直提示tomeout(10000)

RequestTimeoutError: PUT http://1634907079716801.cn-shanghai.fc.aliyuncs.com/2016-08-15/services/demo/functions/helloworld2 timeout(10000).
 PUT http://1634907079716801.cn-shanghai.fc.aliyuncs.com/2016-08-15/services/demo/functions/helloworld2 failed.
    at Timeout.setTimeout [as _onTimeout] (/Users/niko/workspace/prac-aliyun/func/node_modules/httpx/lib/index.js:110:17)
    at ontimeout (timers.js:469:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:264:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! func@1.0.0 deploy.test: `DEBUG=* fun deploy TEST`
npm ERR! Exit status 255
npm ERR! 
npm ERR! Failed at the func@1.0.0 deploy.test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

package.json

{
  "name": "func",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "deploy.test": "DEBUG=* fun deploy TEST"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@alicloud/fun": "^1.4.0"
  },
  "dependencies": {
    "tablestore": "^4.0.10"
  }
}

如果不上传zip,把dependencies去掉,是可以deploy成功的。

哪里出了问题?

支持定义多个table store的表格

如果像下面这样同时声明多个table,fun的语法检查会报错。

  my-table-store:
    Type: 'Aliyun::Serverless::TableStore'
    Properties:
      ClusterType: HYBRID
      Description: dingtalk events
    bpm_raw:
      Type: 'Aliyun::Serverless::TableStore::Table'
      Properties:
        PrimaryKeyList:
          - Name: processInstanceId
            Type: STRING
    approvals:
      Type: 'Aliyun::Serverless::TableStore::Table'
      Properties:
      PrimaryKeyList:
        - Name: createdTime
          Type: LONG
        - Name: userId
          Type: STRING
        - Name: processInstanceId
          Type: STRING

fun deploy失败率超高

最近运行fun deploy的时候经常在第一个函数打包的时候就停止退出,偶尔会成功。
不知道是怎么回事,请问哪里可以看到具体的log信息?

mymbp:capi sense$ fun deploy
Waiting for service capiFunctions to be deployed...
	Waiting for function refreshAccessToken to be deployed...
		Waiting for packaging function refreshAccessToken code...

faas.yml 目前还不支持添加日志服务权限吗?

https://github.com/aliyun/fun/blob/5b3f14a62273c7ce30b2dc6c56a02141b8a01f77/lib/commands/deploy.js#L98-L150

看了下代码,涉及到 ram 的就这一段,看起来像是只为 api gateway固定写的。

另外问一下,https://github.com/aliyun/serverless-aliyun-function-compute 这个是另外一个组在维护吗?这个也尝试过,和 fun 功能上有交集,但内容更丰富些,当然也有很多地方不完善的。。头疼

spec文档完善Api/tablestore详细配置说明

Api网关在spec文档过于简单,很多配置项没有列出,只能靠已有示例猜测。

另外function可以指定超时(比如10s),而gateway默认超时是3s,如果不能指定为比function超时配置更长的时间显然是不合理的。但是spec没有文档描述相关属性如何设置。

OTS表名定义需要支持_字符前缀

OTS原始API中支持表名_字符前缀,但是FUN的SAM配置文件中不支持,导致老项目迁移到FUN上部署失败。修改方法建议:node_modules/@alicloud/fun/lib/validate/schema/ots-resource.js文件中类似如下修改。
image

测试fun deploy但始终报错 TypeError: Data must be a string or a buffer

hi all,

在参照官方文档执行 fun deploy 时遇到以下错误

bogon:fun_test senseluo$ fun deploy
Function compute(cn-shanghai):
  service fc ok.
TypeError: Data must be a string or a buffer
    at Hash.update (crypto.js:99:16)
    at Object.md5 (/Users/senseluo/.nvm/versions/node/v8.10.0/lib/node_modules/@alicloud/fun/node_modules/kitx/lib/index.js:49:12)
    at buildDeps (/Users/senseluo/.nvm/versions/node/v8.10.0/lib/node_modules/@alicloud/fun/lib/deps.js:225:23)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

不知道是不是一个bug,我的代码在 https://github.com/senseluo/aliyun_fun_demo
(其中的faas中id/key/secret已替换成假的)

谢谢~

Event事件源是否支持指定Api gateway

spec文档中,事件源类型清单中并没有Api网关,也没有详细用法。

但在如下图的地方又说支持指定Api

default

是否Event支持指定Api网关?是的话,可否在事件源清单中补充上详细用法?

在实际使用中,我发现如果指定了Event是Http,即使定义了Api网关,网关转发请求的时候会报如下错误。

exception: http invoke FC error,requestId=9EE0020F-980D-4EB1-B5F4-2119CDC4CDE9,result={"ErrorCode":"InvalidArgument","ErrorMessage":"Function with http trigger(name: http-test) can only be invoked with http trigger URL"}java.lang.Exception

Can't deploy function

Trying to deploy function, but have error. What can be problem?

-> fun deploy
using region: ap-southeast-1
using accountId: *****
using accessKeyId: *****
using timeout: 15

Waiting for service video-transcoding-wrapper to be deployed...
FCAccessDeniedError: GET /services/video-transcoding-wrapper failed with 403. requestid: c39a5ca9-c896-ac44-fe6a-230ab01bfc87, message: The service or function doesn't belong to you..
at Client.request (/Users/*****/aliyun-nodejs/node_modules/@alicloud/fc2/lib/client.js:156:19)
at process._tickCallback (internal/process/next_tick.js:68:7)

请允许设置API 网关的 入参请求模式

我们没必要把所有的入参都配置好,这是项可选的工作,配置了能自动生成文档,没配置请至少 允许我们使用 入参透传模式,而不是入参映射,目前我没找到类似的设置。我起初纳闷为什么我的参数被吃了,折腾了一会才发现是入参映射造成的,而且每次 deploy 都会重置为 入参映射。

是否有办法设置为入参透传,哪怕是临时的解决方案也行,不想自己去读代码并修改它、

fun undeploy

This is more a feature request. It would be nice to have a command like fun undeploy that basically does the opposite of fun deploy. Is a feature like that in plan?

java8 local fun debug

use example got

FC Invoke Start RequestId: 3db83578-38ae-4eb1-9b70-17f3e30ba375
handle user request is example.App::handleRequest
cache is null!
2018-12-10 14:35:00.241 [ERROR] {
"errorMessage" : "Cannot find the class example.App in your zip file and please make sure it is in the right path 'example/App'",
"errorType" : "java.lang.ClassNotFoundException",
"errorCause" : "example.App",
"stackTrace" : [ "java.net.URLClassLoader.findClass(URLClassLoader.java:381)", "java.lang.ClassLoader.loadClass(ClassLoader.java:424)", "java.lang.ClassLoader.loadClass(ClassLoader.java:357)", "java.lang.Class.forName0(Native Method)", "java.lang.Class.forName(Class.java:348)" ]
}
{
"errorMessage" : "Cannot find the class example.App in your zip file and please make sure it is in the right path 'example/App'",
"errorType" : "java.lang.ClassNotFoundException",
"errorCause" : "example.App",
"stackTrace" : [ "java.net.URLClassLoader.findClass(URLClassLoader.java:381)", "java.lang.ClassLoader.loadClass(ClassLoader.java:424)", "java.lang.ClassLoader.loadClass(ClassLoader.java:ng.ClassLoader.loadClass(ClassLoader.java:357)", "java.lang.Class.forName0(Native Method)", "java.lang.Class.forName(Class.java:348)" ]
}FC Invoke End RequestId: 3db83578-38ae-4eb1-9b70-17f3e30ba375

RequestId: 3db83578-38ae-4eb1-9b70-17f3e30ba375 Billed Duration: 1849 ms Memory Size: 1980 MB Max Memory Used: 41 MB

PS D:\Aliyun\fun\examples\local> D:\Aliyun\fun-v2.7.0-win-x64.exe\fun local invoke -d 3000 java8
skip pulling image aliyunfc/runtime-java8:1.1.0...

FC Invoke Start RequestId: fc2dd22b-d035-4bc0-9fa3-c18e908a455e
handle user request is example.App::handleRequest
cache is null!
2018-12-10 14:42:22.219 [ERROR] {
"errorMessage" : "Cannot find the class example.App in your zip file and please make sure it is in the right path 'example/App'",
"errorType" : "java.lang.ClassNotFoundException",
"errorCause" : "example.App",
"stackTrace" : [ "java.net.URLClassLoader.findClass(URLClassLoader.java:381)", "java.lang.ClassLoader.loadClass(ClassLoader.java:424)", "java.lang.ClassLoader.loadClass(ClassLoader.java:357)", "java.lang.Class.forName0(Native Method)", "java.lang.Class.forName(Class.java:348)" ]
}
{
"errorMessage" : "Cannot find the class example.App in your zip file and please make sure it is in the right path 'example/App'",
"errorType" : "java.lang.ClassNotFoundException",
"errorCause" : "example.App",
"stackTrace" : [ "java.net.URLClassLoader.findClass(URLClassLoader.java:381)", "java.lang.ClassLoader.loadClass(ClassLoader.java:424)", "java.lang.ClassLoader.loadClass(ClassLoader.java:357)", "java.lang.Class.forName0(Native Method)", "java.lang.Class.forName(Class.java:348)" ]
}FC Invoke End RequestId: fc2dd22b-d035-4bc0-9fa3-c18e908a455e

Env: windows 64 fun 2.7

需要支持API网关的常量参数配置

fun工具需求在yml文件中支持API网关这个参数配置

image

具体修改方法参考:fun/lib/deploy/deploy-support.js文件 makeApi函数
image

需要在yml文件中支持x-aliyun-apigateway-constant-paramters参数配置。
API网关的接口文档不正确,截图的参数是看线上ajax请求查到的实际参数。

template.yml如何定义api开启https或WEBSOCKET?

类似

   DefinitionBody:
        '/': # request path
          get: # http method
            x-aliyun-apigateway-api-name: hello_get # api name
            x-aliyun-apigateway-fc:
              arn: acs:fc:::services/${capi.Arn}/functions/${helloworld.Arn}/
            x-aliyun-apigateway-visibility: PUBLIC

能给一个更多参数的示例吗?
谢谢~

关于java example的问题

在demoREADME中给的配置文件例子是fass.yml,而示例代码只有template.yml

这两种配置的关系是什么?工具fun推荐使用哪种配置?fass.yml推荐使用的话,哪里可以查看官方文档?

当 endpoint 设置成内网的时候,fun deploy 时报 api gateway 出错

> fun deploy
Waiting for service fc to be deployed...
	Waiting for function users to be deployed...
	function users deploy success
service fc deploy success

Waiting for api gateway HelloworldGroup to be deployed...
Error: getaddrinfo ENOTFOUND apigateway.cn-hangzhou-internal.aliyuncs.com apigateway.cn-hangzhou-internal.aliyuncs.com:80
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

fun help是提示命令吗?

请问如何做到上传到函数计算的同时自动安装打包依赖模块 我这里没有实现这个效果,如何将整个文件夹进行上传呢?

当依赖特别多的时候显示超时无法正常上传

RequestTimeoutError: PUT http://1925300965708640.cn-beijing.fc.aliyuncs.com/2016-08-15/services/fc/functions/helloworld timeout(60000).
PUT http://1925300965708640.cn-beijing.fc.aliyuncs.com/2016-08-15/services/fc/functions/helloworld failed.
at Timeout.setTimeout [as _onTimeout] (/usr/local/nodejs/node-v8.9.4-linux-x64/lib/node_modules/@alicloud/fun/node_modules/_httpx@2.1.2@httpx/lib/index.js:110:17)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)

Feature: 支持自动创建SLS project以及logstore

template.yml中定义的api gateway以及table store实例和table,fun可以自动创建。

而函数的logconfig中指定的SLS project和log store必须用户手动创建及授权。

希望fun可以自动根据配置创建SLS project和log store(如果没有的话)。当role是自动创建的时候,为其添加SLS读写权限。

运行脚本不能成功创建函数计算服务

当我是一个新用户时,运行脚本不能成功创建函数计算服务,显示“Account is inactive to this service”错误的信息。但是输入的账号ID、Access Key Id、Access Key Secret都是正确的。
image
脚本如下:
ROSTemplateFormatVersion: '2015-09-01' Transform: 'Aliyun::Serverless-2018-04-03' Resources: ygwww1-fc-local: Type: 'Aliyun::Serverless::Service' Properties: Description: 'youngget' LogConfig: Project: ygwww1-log Logstore: ygwww1-logstore-local ygwww1-fc-local: Type: 'Aliyun::Serverless::Function' Properties: Handler: index.handler Runtime: nodejs8 MemorySize: 128 CodeUri: './dist/target.zip' Timeout: 10

custom vars

Is there way to use custom vars like

custom:
  dataSetBucket: 'images-roaddamage' 
  listBucket: 'dataset-list'
  listKey: 'hk.json'
  resultBucket: 'hk-result'
  frontendBucket: 'hk-frontend'

?

FUN创建OTS表失败

image

对应的YAML文件示例为:
ROSTemplateFormatVersion: '2015-09-01'
Transform: 'Aliyun::Serverless-2018-04-03'
Resources:  
  xxxxxxx:
    Type: 'Aliyun::Serverless::TableStore'
    Properties:
      ClusterType: SSD
      Description: 'xxxxxx'
    __session__:
      Type: 'Aliyun::Serverless::TableStore::Table'
      Properties:
          PrimaryKeyList:
            - Name: id
              Type: STRING
    __user__:
      Type: 'Aliyun::Serverless::TableStore::Table'
      Properties:
          PrimaryKeyList:
            - Name: id
              Type: STRING
    __cache__:
      Type: 'Aliyun::Serverless::TableStore::Table'
      Properties:
          PrimaryKeyList:
            - Name: id
              Type: STRING

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.