Skip to content

Commit

Permalink
[#3603] feat-689: Add grpc support
Browse files Browse the repository at this point in the history
### What is the feature/fix?
convox/issues-private#689

This feature enabled grpc support for app service

### Add screenshot or video (optional)

https://user-images.githubusercontent.com/12232198/199936152-ca381e0a-fb7b-4c6e-88da-0de28e9eb26b.mp4

### Does it has a breaking change?

no

### How to use/test it?
Install rack of the branch version
Deploy a grpc service and check the connection
```
services:
  web:
    build: .
    port: grpc:50051
```

### Checklist
- [ ] New coverage tests
- [x] Unit tests passing
- [x] E2E tests passing
- [x] E2E downgrade/update test passing
- [x] Documentation updated
- [ ] No warnings or errors on Deepsource/Codecov
  • Loading branch information
nightfury1204 committed Nov 8, 2022
1 parent cd9f97b commit 65e4a25
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
6 changes: 6 additions & 0 deletions provider/aws/formation/app.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
"Default": "200-399,401",
"Description": "Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check. You can specify values between 200 and 499, and the default value is \"200-399,401\". You can specify multiple values (for example, \"200,202\") or a range of values (for example, \"200-299\")."
},
"LoadBalancerGrpcSuccessCodes": {
"Type": "String",
"Default": "12",
"Description": "Specifies the GRPC codes that healthy targets must use when responding to an GRPC health check. You can specify values between 200 and 499, and the default value is \"12\". You can specify multiple values (for example, \"12,13\") or a range of values (for example, \"10-99\")."
},
"LogBucket": {
"Type": "String",
"Default": ""
Expand Down Expand Up @@ -363,6 +368,7 @@
"Fargate": { "Fn::If": [ "Service{{ upper .Name }}Fargate", "Yes", { "Fn::If": [ "Service{{ upper .Name }}FargateSpot", "Spot", "No" ] } ] },
"LoadBalancerAlgorithm": { "Ref": "LoadBalancerAlgorithm" },
"LoadBalancerSuccessCodes": { "Ref": "LoadBalancerSuccessCodes" },
"LoadBalancerGrpcSuccessCodes": { "Ref": "LoadBalancerGrpcSuccessCodes" },
"LogDriver": { "Ref": "LogDriver" },
"LogGroup": { "Fn::If": [ "EnableCloudWatch", { "Ref": "LogGroup" }, { "Ref": "AWS::NoValue" } ] },
"InternalDomains": { "Ref": "InternalDomains" },
Expand Down
21 changes: 20 additions & 1 deletion provider/aws/formation/service.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
"Default": "200-399,401",
"Description": "Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check. You can specify values between 200 and 499, and the default value is \"200-399,401\". You can specify multiple values (for example, \"200,202\") or a range of values (for example, \"200-299\")."
},
"LoadBalancerGrpcSuccessCodes": {
"Type": "String",
"Default": "12",
"Description": "Specifies the GRPC codes that healthy targets must use when responding to an GRPC health check. You can specify values between 0 and 99, and the default value is \"12\". You can specify multiple values (for example, \"12,13\") or a range of values (for example, \"10-99\")."
},
"LogDriver": {
"Default": "CloudWatch",
"Description": "Log driver used by the rack and services to send logs. Default to CloudWatch. You must provide the SyslogDestination when setting as Syslog. It disable logs if blank.",
Expand Down Expand Up @@ -232,9 +237,23 @@
"HealthyThresholdCount": "2",
"UnhealthyThresholdCount": "2",
"HealthCheckPath": "{{.Health.Path}}",
"Matcher": { "HttpCode": { "Ref": "LoadBalancerSuccessCodes" } },
"Matcher": {
{{ if or (eq .Port.Scheme "grpc") (eq .Port.Scheme "secure-grpc") }}
"GrpcCode": { "Ref": "LoadBalancerGrpcSuccessCodes" }
{{ else }}
"HttpCode": { "Ref": "LoadBalancerSuccessCodes" }
{{ end }}
},
"Port": "{{.Port.Port}}",
{{ if eq .Port.Scheme "grpc" }}
"Protocol": "HTTP",
"ProtocolVersion": "GRPC",
{{ else if eq .Port.Scheme "secure-grpc" }}
"Protocol": "HTTPS",
"ProtocolVersion": "GRPC",
{{ else }}
"Protocol": "{{ upcase .Port.Scheme }}",
{{ end }}
"TargetGroupAttributes": [
{ "Key": "deregistration_delay.timeout_seconds", "Value": "{{.Drain}}" },
{ "Key": "load_balancing.algorithm.type", "Value": { "Ref": "LoadBalancerAlgorithm" } },
Expand Down

0 comments on commit 65e4a25

Please sign in to comment.