Skip to content

Commit 6cf09a2

Browse files
author
heimanba
committed
feat: update layer-fc plugins
1 parent 86d4b64 commit 6cf09a2

File tree

24 files changed

+1635
-1
lines changed

24 files changed

+1635
-1
lines changed

layer-fc-custom-runtime/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.s
2+
node_modules

layer-fc-custom-runtime/hook/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
async function preInit(inputObj) {
2+
console.log(`
3+
Serverless Devs Plugin Case
4+
5+
Cloud services required:
6+
- FC : https://fc.console.aliyun.com/
7+
8+
Tips:
9+
- FC Component: https://www.serverless-devs.com/fc/readme`)
10+
}
11+
12+
async function postInit(inputObj) {
13+
console.log(`
14+
* Before using, please check whether the actions command in Yaml file is available
15+
* Carefully reading the notes in s.yaml is helpful for the use of the tool
16+
* If need help in the use process, please apply to join the Dingtalk Group: 33947367
17+
`)
18+
}
19+
20+
module.exports = {
21+
postInit,
22+
preInit
23+
}

layer-fc-custom-runtime/publish.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Type: Application
2+
Name: layer-fc-custom-runtime
3+
Version: 0.0.1
4+
Provider:
5+
- 阿里云
6+
Description: 快速部署一个 layer-fc 自定义runtime插件
7+
HomePage: https://github.com/devsapp/start-plugin
8+
Tags:
9+
- 函数计算
10+
- 你好世界
11+
- 新手入门
12+
Category: 新手入门
13+
Service:
14+
函数计算:
15+
Authorities:
16+
- AliyunFCFullAccess
17+
Runtime: Node.js14
18+
Parameters:
19+
type: object
20+
additionalProperties: false # 不允许增加其他属性
21+
required: # 必填项
22+
- region
23+
- serviceName
24+
- functionName
25+
properties:
26+
region:
27+
title: 地域
28+
type: string
29+
default: cn-hangzhou
30+
description: 创建应用所在的地区
31+
enum:
32+
- cn-beijing
33+
- cn-hangzhou
34+
- cn-shanghai
35+
- cn-qingdao
36+
- cn-zhangjiakou
37+
- cn-huhehaote
38+
- cn-shenzhen
39+
- cn-chengdu
40+
- cn-hongkong
41+
- ap-southeast-1
42+
- ap-southeast-2
43+
- ap-southeast-3
44+
- ap-southeast-5
45+
- ap-northeast-1
46+
- eu-central-1
47+
- eu-west-1
48+
- us-west-1
49+
- us-east-1
50+
- ap-south-1
51+
serviceName:
52+
title: 服务名
53+
type: string
54+
default: hello-world-service
55+
description: 服务名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-128 之间
56+
functionName:
57+
title: 函数名
58+
type: string
59+
default: layer-fc-custom-runtime
60+
description: 函数名称,只能包含字母、数字、下划线和中划线。不能以数字、中划线开头。长度在 1-64 之间

layer-fc-custom-runtime/readme.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# keep-warm-fc 插件案例
2+
3+
<toc>
4+
5+
- [快速开始](#快速开始)
6+
- [通过应用中心部署](#通过应用中心部署)
7+
- [通过命令行工具部署](#通过命令行工具部署)
8+
- [应用详情](#应用详情)
9+
- [关于我们](#关于我们)
10+
11+
</toc>
12+
13+
# 快速开始
14+
15+
- [:octocat: 源代码](https://github.com/devsapp/start-plugin/layer-fc-public-module/src)
16+
17+
## 通过应用中心部署
18+
19+
<appcenter>
20+
21+
您可以在阿里云 [:earth_asia: Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=layer-fc-public-module) ,快速体验该应用:
22+
23+
[![Deploy with Severless Devs](https://img.alicdn.com/imgextra/i1/O1CN01w5RFbX1v45s8TIXPz_!!6000000006118-55-tps-95-28.svg)](https://fcnext.console.aliyun.com/applications/create?template=layer-fc-public-module)
24+
25+
</appcenter>
26+
27+
## 通过命令行工具部署
28+
29+
> 在开始之前,需要先安装 Serverless Devs 开发者工具:`npm install @serverless-devs/s -g`,更多安装方法,可以参考[Serverless Devs 安装文档](https://www.serverless-devs.com/serverless-devs/install) ,针对阿里云还需要配置密钥信息,配置密钥信息的方法可以参考[阿里云密钥配置文档](https://www.serverless-devs.com/fc/config)
30+
31+
- 初始化项目:`s init start-keep-warm-fc -d start-keep-warm-fc`
32+
> 涉及到确定密钥的选择、服务名称的确定、函数名称的确定以及容器镜像的确定
33+
- 进入项目:`cd start-keep-warm-fc`
34+
- 部署项目:`s deploy -y`
35+
- 调用函数:直接使用 POST 或者 GET 方法 curl 部署项目时候生成自定义域名
36+
37+
38+
# 应用详情
39+
40+
本应用仅作为学习和参考使用,您可以基于本项目进行二次开发和完善,实现自己的业务逻辑
41+
42+
# 关于我们
43+
44+
- Serverless Devs 工具:
45+
- 仓库:[https://www.github.com/serverless-devs/serverless-devs](https://www.github.com/serverless-devs/serverless-devs)
46+
> 欢迎帮我们增加一个 :star2:
47+
- 官网:[https://www.serverless-devs.com/](https://www.serverless-devs.com/)
48+
- 阿里云函数计算组件:
49+
- 仓库:[https://github.com/devsapp/fc](https://github.com/devsapp/fc)
50+
- 帮助文档:[https://www.serverless-devs.com/fc/readme](https://www.serverless-devs.com/fc/readme)
51+
- 钉钉交流群:33947367
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.s
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
node index.js
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM node:12-slim
2+
3+
WORKDIR /home/code
4+
COPY . .
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var express = require('express');
2+
3+
var app = express();
4+
5+
app.get('*', (req, res) => {
6+
res.header('Content-Type', 'text/html;charset=utf-8')
7+
console.log('test');
8+
9+
res.send(`node Version: ${process.version}`)
10+
})
11+
12+
app.listen(9000, () => {
13+
console.log('start success.');
14+
}).on('error', (e) => {
15+
console.error(e.code, e.message)
16+
});

0 commit comments

Comments
 (0)