Skip to content

Commit 042b4ed

Browse files
authored
Merge pull request #73 from littlerainxy/yusha-grpc-demo
fix golang websocket and grpc yaml
2 parents 12665dc + 00e1ec5 commit 042b4ed

File tree

16 files changed

+41
-65
lines changed

16 files changed

+41
-65
lines changed

custom-function/golang/fc-custom-golang-grpc/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Type: Application
22
Name: fc-custom-golang-grpc
33
Provider:
44
- 阿里云
5-
Version: 0.2.0
5+
Version: 0.4.1
66
Description: 快速部署一个基于custom runtime 的 Golang grpc 类型的 Hello World 到阿里云函数计算
77
HomePage: https://github.com/devsapp/start-fc
88
Tags:

custom-function/golang/fc-custom-golang-grpc/src/Makefile

Lines changed: 0 additions & 9 deletions
This file was deleted.

custom-function/golang/fc-custom-golang-grpc/src/build-image/Dockerfile

Lines changed: 0 additions & 9 deletions
This file was deleted.

custom-function/golang/fc-custom-golang-grpc/src/certificate

Lines changed: 0 additions & 11 deletions
This file was deleted.
-11.3 MB
Binary file not shown.

custom-function/golang/fc-custom-golang-grpc/src/code/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import (
3434

3535
"github.com/golang/protobuf/proto"
3636

37+
pb "fc-custom-golang-grpc/proto"
3738
"google.golang.org/grpc"
38-
pb "tmp/proto"
3939
)
4040

4141
var (

custom-function/golang/fc-custom-golang-grpc/src/privatekey

Lines changed: 0 additions & 5 deletions
This file was deleted.

custom-function/golang/fc-custom-golang-grpc/src/s.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ services:
3636
component: fc
3737
actions: # 自定义执行逻辑,关于actions 的使用,可以参考:https://www.serverless-devs.com/serverless-devs/yaml#行为描述
3838
pre-deploy: # 在deploy之前运行
39-
- run: make build
40-
path: ./
39+
- run: go mod tidy
40+
path: ./code
41+
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
42+
path: ./code
4143
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # 要运行的组件,格式为【component: 组件名 命令 参数】(可以通过s cli registry search --type Component 获取组件列表)
4244
# - run: docker build xxx # 要执行的系统命令,类似于一种钩子的形式
4345
# path: ./src # 执行系统命令/钩子的路径
@@ -55,9 +57,12 @@ services:
5557
timeout: 30
5658
memorySize: 512
5759
runtime: custom
58-
codeUri: ./code
60+
codeUri: ./code/target
5961
instanceConcurrency: 3
6062
caPort: 8089
63+
customRuntimeConfig:
64+
command:
65+
- '/code/main'
6166
triggers:
6267
- name: http2Trigger
6368
type: http

custom-function/golang/fc-custom-golang-grpc/src/s_en.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ services:
3838
component: fc # The name of the component. The Serverless Devs tool itself is similar to a game console and does not have specific business capabilities. The component is similar to a game card. Users can achieve different functions by inserting different game cards into the game console, that is, by using Different components implement different specific business capabilities
3939
actions: # Customize execution logic. For the use of actions, please refer to: https://www.serverless-devs.com/serverless-devs/yaml#Behavior description
4040
pre-deploy: # run before deploy
41-
- run: make build
42-
path: ./
41+
- run: go mod tidy
42+
path: ./code
43+
- run: GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o target/main main.go
44+
path: ./code
4345
# - component: fc build --use-docker --dockerfile ./code/Dockerfile # The component to run, the format is [component: component name command parameter] (you can get the component list through s cli registry search --type Component)
4446
# - run: docker build xxx # System command to execute, similar to a hook
4547
# path: ./src # The path to execute system commands/hooks
@@ -60,9 +62,12 @@ services:
6062
timeout: 30
6163
memorySize: 512
6264
runtime: custom
63-
codeUri: ./code
65+
codeUri: ./code/target
6466
instanceConcurrency: 3
6567
caPort: 8089
68+
customRuntimeConfig:
69+
command:
70+
- '/code/main'
6671
triggers:
6772
- name: http2Trigger
6873
type: http

custom-function/golang/fc-custom-golang-websocket/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Type: Application
22
Name: fc-custom-golang-websocket
33
Provider:
44
- 阿里云
5-
Version: 0.0.19
5+
Version: 0.0.20
66
Description: 快速部署一个基于custom runtime 的 Golang WebSocket 类型的 Echo 函数到阿里云函数计算
77
HomePage: https://github.com/devsapp/start-fc
88
Tags:

0 commit comments

Comments
 (0)