Code Monkey home page Code Monkey logo

fcli's Introduction

fcli

fcli 简介

fcli 是阿里云函数计算的命令行工具,可以便捷的管理函数计算中的资源。

$ fcli
fcli: function compute command line tools

Usage:
  fcli [flags]
  fcli [command]

Available Commands:
  alias           alias related operation
  config          Configure the fcli
  function        function related operation
  help            Help about any command
  service         service related operation
  shell           interactive shell
  sls             sls related operation
  trigger         trigger related operation
  version         fcli version information

Flags:
  -h, --help   help for fcli

Use "fcli [command] --help" for more information about a command.

详细的使用手册:函数计算工具 fcli 帮助文档

如何贡献代码

开发环境配置

1. 安装并配置 Golang 开发环境 根据 官方文档 安装并设置环境变量,主要是设置好 $GOPATH 环境变量。

2. Fork Repository

  • aliyun/fcli 项目中,点击 fork,将项目 fork 到个人仓库
  • 在本地 $GOPATH/src 目录下,创建 github.com/aliyun 目录
  • cd ${GOPATH}/src/github.com/aliyun
  • git clone https://github.com/个人账号/fcli.git

3. 安装 glide 包管理器

$ go get github.com/Masterminds/glide
$ go install github.com/Masterminds/glide

4. 安装依赖 在项目根目录下,执行 glide i -v 进行依赖安装

5. 构建 fcli 二进制

$ go get github.com/karalabe/xgo
$ make binary

提交 pull request

1. 将修改 push 到个人账号里的本地仓库

2. 发起 pull request 请求 在 pull request 请求的 comment 中,写明此次修改的内容,并添加此次修改的命令交互示例。

假设此次修改设置到 service list 子命令

  • fcli service
$ fcli service
service related operation

Usage:
  fcli service [flags]
  fcli service [command]

Aliases:
  service, s

Available Commands:
  create      create service
  delete      Delete service
  get         Get the information of service
  list        List services of the current account
  update      update service
  version     service version related operation

Flags:
      --help   Print Usage (default true)

Use "fcli service [command] --help" for more information about a command.
  • fcli service list --help
william:fcli zechen$ go run main.go service list --help
List services of the current account

Usage:
  fcli service list [option] [flags]

Aliases:
  list, l

Flags:
      --help                list functions
  -l, --limit int32         the max number of the returned services (default 100)
      --name-only           display service name only (default true)
  -t, --next-token string   continue listing the functions from the previous point
  -p, --prefix string       list the services whose names contain the specified prefix
  -k, --start-key string    start key is where you want to start listing from
  • fcli service list
$ fcli service list
{
  "Services": [
    "demo"
  ],
  "NextToken": null
}

我们鼓励将此次修改涉及的命令交互,展现的越详细越好。(还可以测试此次修改影响到的命令的各种参数)

版本号说明

fcli 在开源后使用 主版本号.次版本号.修订号 的版本格式

关于版本格式,可以参考 Semantic Versioning

Auto complete under shell

bash

run command as follows:

curl -s https://raw.githubusercontent.com/aliyun/fcli/master/misc/completion/fcli-completion.bash > /usr/local/etc/bash_completion.d/fcli-completion.bash

or checkout this repo and run command as follows:

source misc/completion/fcli-completion.bash

and then relogin

zsh

run command as follows:

curl -s https://raw.githubusercontent.com/aliyun/fcli/master/misc/completion/_fcli > /usr/local/share/zsh/site-functions/_fcli

and then relogin

fcli's People

Contributors

chandaoh avatar hryang avatar muxiangqiu avatar rocaltair avatar shuaichang avatar sluongng avatar tanhe123 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fcli's Issues

fcli工具更新函数环境变量

fcli function update --env-file  some.yml -s test-service -f fun1 命令更新函数配置,如果值包含特殊字符%@!等,配置不会生效。

测试:
使用fcli function update -s serviceName -f functionName --code-dir dir.zip --env key1=var1 --env key2=var2命令更新是可以成功。
但是使用fcli function update --env-file some.yml -s serviceName -f functionName 命令更新环境变量是不生效的,但是执行是没有报错的。

Suggest - npm package and serveless

Nowadays, most of serverless computing command line tool provides an easy install way using brew, npm, or docker. Ali function computing is far behind the developer experience in terms of ease of use.
Please consider creating one of them. Also, Ali function computing would be good to go under the Serverless framework(serverless.com) umbrella.

使用sbox出错: docker: invalid reference format.

>>>sbox -d applib -t python3.6

Entering the container. Your code is in the /code direcotry.
docker: invalid reference format.
See 'docker run --help'.
Error: exit status 125

fcli version: 1.0.3
Docker Engine: 19.03.8(Docker desktop community Macos)

Where is the source code?

Is this a open-source repo? Where is the source code?

Nothing on master branch, and no other branches. Oops

Missing trigger complete

~>fcli trigger help
trigger related operation

Usage:
  fcli trigger [flags]
  fcli trigger [command]

Aliases:
  trigger, t

Available Commands:
  create      create trigger
  delete      delete trigger
  get         get trigger
  list        list trigger
  update      update trigger

Flags:
  -f, --function-name string   function name
  -h, --help                   Print Usage (default true)
  -s, --service-name string    service name
  -t, --trigger-name string    trigger name

Use "fcli trigger [command] --help" for more information about a command.

this should be included

win10 sbox 出错 invalid mode

sbox -d ./ -t python3
Entering the container. Your code is in the /code direcotry.
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mode: /code.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.
Error: exit status 1

How to use pg_connect() ?

i want to ask about FC, and how to use pg_connect in FC, and how to install this library in FC ? thankyou

fcli complete 不生效

macOS + zsh 环境

使用 Homebrew brew tap vangie/formula 然后通过 brew install fcli 进行安装。

安装过程中注意到 autocomplete 也跟随安装了,可是在 fcli shell 自动补全就是不生效。

sbox运行的时候报错

sbox -d code -t nodejs6
Entering the container. Your code is in the /code direcotry.
d:\Program Files\Docker Toolbox\docker.exe: An error occurred trying to connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create: open //./pipe/docker_engine: The system cannot find the file specified..
See 'd:\Program Files\Docker Toolbox\docker.exe run --help'.
Error: exit status 1

widnows10环境中sbox命令出错

参考官方的快速入门应用示例2
执行到sbox的时候出错了

Welcome to the function compute world. Have fun!
>>> sbox -d code -t nodejs4.4
Entering the container. Your code is in the /code direcotry.
Error: exec: "sh": executable file not found in %PATH%
>>>

环境:windows 10 Pro, Docker 17.06.0-ce-win19, fcli-v0.6-win-386

设置好endpoint、id等之后,再打开直接闪退

以下为提示信息:

Last login: Sun Dec 2 15:18:20 on ttys001
guanleimingdeMacBook-Pro:~ apple$ /Users/apple/Downloads/fcli ; exit;
fcli: function compute command line tools

Usage:
fcli [flags]
fcli [command]

Available Commands:
alias alias related operation
config Configure the fcli
function function related operation
help Help about any command
service service related operation
service service version related operation
shell interactive shell
sls_project SLS project related operations
sls_store SLS store related operations
trigger trigger related operation
version fcli version information

Flags:
-h, --help help for fcli

Use "fcli [command] --help" for more information about a command.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[进程已完成]

SignatureNotMatch

Hi, I've checked and set all of the configs, but :
`>>> mks demo

Error: {
"HttpStatus": 403,
"RequestId": "...",
"ErrorCode": "SignatureNotMatch",
"ErrorMessage": "signature does not match"
}`

fcli无法在命令行中调用函数

在shell模式下,可以调用函数成功,在命令行模式下不行,

$fcli function invoke -s  service -f function-name --event-str '{......}'
panic: assignment to entry in nil map

goroutine 1 [running]:
aliyun/serverless/fcli/cmd.prepareInvokeFuncInput(0xc42013bbdf, 0xc4201605f9)
	/ext-go/1/src/aliyun/serverless/fcli/cmd/invoke_function.go:111 +0xb2
aliyun/serverless/fcli/cmd.invokeFuncRun(0xc42015e090, 0x0, 0x0)
	/ext-go/1/src/aliyun/serverless/fcli/cmd/invoke_function.go:78 +0x26
aliyun/serverless/fcli/cmd.glob..func13(0x485b960, 0xc420097500, 0x0, 0x6)
	/ext-go/1/src/aliyun/serverless/fcli/cmd/invoke_function.go:46 +0x37
aliyun/serverless/fcli/vendor/github.com/spf13/cobra.(*Command).execute(0x485b960, 0xc420097440, 0x6, 0x6, 0x485b960, 0xc420097440)
	/ext-go/1/src/aliyun/serverless/fcli/vendor/github.com/spf13/cobra/command.go:603 +0x234
aliyun/serverless/fcli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x485c400, 0x0, 0x485c400, 0xc42013bf50)
	/ext-go/1/src/aliyun/serverless/fcli/vendor/github.com/spf13/cobra/command.go:689 +0x339
aliyun/serverless/fcli/vendor/github.com/spf13/cobra.(*Command).Execute(0x485c400, 0xc42013bf68, 0x4492fcf)
	/ext-go/1/src/aliyun/serverless/fcli/vendor/github.com/spf13/cobra/command.go:648 +0x2b
aliyun/serverless/fcli/cmd.Execute()
	/ext-go/1/src/aliyun/serverless/fcli/cmd/root.go:36 +0x2d
main.main()
	/ext-go/1/src/aliyun/serverless/fcli/main.go:19 +0x20

fcli没有mkdir

开发指南:如果用户需要使用自定义的模块,则需要将它们与代码一起打包。用fcli mkdir目录
但是fcli没有mkdir命令

mkt http -t http broken?

Hi, developers.

I got an error below when I create a trigger from fcli:

>>> mkt --help
      --etag string              trigger etag for update
      --help
  -r, --invocation-role string   invocation role, timer type trigger optional
  -s, --source-arn string        event source arn, timer type trigger optional
  -c, --trigger-config string    trigger config file
  -t, --type string              trigger type, support oss, log, timer, http, cdn_events now (default "oss")

>>> mkt http -t http -c httpTrigger.yml
Error: unsupported trigger type, expect oss, log, timer, http, cdn_events, actual http

Isn't it implemented yet? Or did I do anything wrong?

upf 上传大文件时超时

报错
Error: Put https://1014022446568598.cn-beijing.fc.aliyuncs.com/2016-08-15/services/dongtu-function/functions/dongtu: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

建议可以添加参数自主控制超时时间。

没有fcli命令

  • mac环境
  • 配置环境成功
  • 没有fcli命令

难道还要配置系统环境变量?

grant 为函数计算服务授权报了一个错

我是用的ram子账号, 需要什么权限呐?
运行的结果如下
grant demo
Please input the role name:
myRole
Please input the policy name:
myPolicy
Permission grant scenarios:

  1. Allow FC write function logs to your log store.
  2. Allow FC copy code from your OSS location.
    Please input your choice [1-2]:
    1
    Please input the log project: m'y-log-project
    Please input the log store: my-log-store
    Error: failed to create role myRole due to:{
    "HttpStatus": 403,
    "RequestId": "75ED230B-E2EE-479D-AADD-BB84B906716F",
    "HostId": "ram.aliyuncs.com",
    "Code": "NoPermission",
    "Message": "You are not authorized to do this action. Resource: acs:ram:::role/* Action: ram:CreateRole"
    }

What is a good way to manage code via git using Aliyun FC?

Run time, for example python2.7, require you to install the library packages locally.

https://www.alibabacloud.com/help/doc-detail/56316.htm?spm=a2c63.p38356.b99.21.95bd2794YxOql2#using-modules

 ls -l /tmp/code
 drwxr-xr-x   9 rockuw  staff  306 Jul  5 16:48 PyMySQL-0.7.11.dist-info
 -rw-r--r--   1 rockuw  staff   74 Jul  5 16:02 main.py
 drwxr-xr-x  26 rockuw  staff  884 Jul  5 16:48 pymysql  

This creates a really messy git directory and hard to track via git.
What is the best practice of using function compute in this case?

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.