Files
alibabacloudfn-template/README.md
2020-11-22 12:16:50 +08:00

74 lines
1.8 KiB
Markdown

# alibabacloudfn-template
Alibaba Cloud Function Template
Use this template you need to install:
* Rust - https://rustup.rs/
* Kickstart - https://crates.io/crates/kickstart
* Docker - https://github.com/docker/docker-ce
* Dockerbuild - https://crates.io/crates/dockerbuild
* Fun and Config Fun - https://github.com/alibaba/funcraft
* Just - https://crates.io/crates/just
Usage:
Create new project:
```shell
$ kickstart https://git.hatter.ink/templates/alibabacloudfn-template.git
```
Build:
```shell
$ just buildfn
```
构建后会生成 `code.zip` 文件
Deploy:
`aliyun.com` -> `控制台` -> `函数计算` -> `服务/函数` -> `新建函数`
填定表单:
![](https://playsecurity.org/getdoc/4033_25BD84287DA6F33F8498764CD2ACA299/aliyun_custom_fn.png)
Build and deploy:
```shell
$ just buildfndeploy
```
<br>
Sample output:
```shell
$ curl https://174******.cn-shanghai.fc.aliyuncs.com/2016-08-15/proxy/hatter_fc/test_rust_fn/
GET /2016-08-15/proxy/hatter_fc/test_rust_fn/ HTTP/1.1
host: 174******.cn-shanghai.fc.aliyuncs.com
user-agent: curl/7.64.1
accept: */*
x-fc-access-key-id:
x-fc-access-key-secret:
x-fc-account-id: 174******
x-fc-base-path: /2016-08-15/proxy/hatter_fc/test_rust_fn/
x-fc-control-path: /http-invoke
x-fc-function-handler: index.handler
x-fc-function-memory: 128
x-fc-function-name: test_rust_fn
x-fc-function-timeout: 30
x-fc-qualifier: LATEST
x-fc-region: cn-shanghai
x-fc-request-id: 0af673e9-030b-4b30-949c-60c96a3a326d
x-fc-retry-count: 0
x-fc-security-token:
x-fc-service-logproject:
x-fc-service-logstore:
x-fc-service-name: hatter_fc
x-fc-tracing-jaeger-endpoint:
x-fc-tracing-opentracing-span-baggages:
x-fc-tracing-opentracing-span-context:
x-fc-version-id:
x-forwarded-for: 125.118.80.*
x-forwarded-proto: https
accept-encoding: gzip
```