Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add connect-node-fastify server #477

Merged
merged 39 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8e595bb
Node server
smaye81 Jun 15, 2023
5f66d3b
Merge main
smaye81 Jun 16, 2023
a54d5d9
Add node server
smaye81 Jun 16, 2023
12eb957
Connect Node
smaye81 Jun 19, 2023
4d23d05
Node
smaye81 Jun 19, 2023
e4d9b2b
Node server
smaye81 Jun 19, 2023
a02609b
Node server
smaye81 Jun 19, 2023
c505143
Crosstests
smaye81 Jun 20, 2023
b86f596
Merge branch 'main' into sayers/connect-node-server
smaye81 Jun 20, 2023
354e3df
Regen
smaye81 Jun 20, 2023
a40d872
Regen
smaye81 Jun 20, 2023
0a19025
Regen
smaye81 Jun 20, 2023
48f596d
Additional tests
smaye81 Jun 21, 2023
8d13148
Docker
smaye81 Jun 21, 2023
693d92a
Tests
smaye81 Jun 22, 2023
e4a2a52
Dist
smaye81 Jun 22, 2023
28af554
Clients
smaye81 Jun 22, 2023
896b17c
Promise spec
smaye81 Jun 22, 2023
0681f42
tsconfig
smaye81 Jun 22, 2023
809f61b
Karma
smaye81 Jun 22, 2023
1530288
Protos
smaye81 Jun 22, 2023
df92f07
Dist
smaye81 Jun 22, 2023
8ba8730
Make
smaye81 Jun 22, 2023
3e974ba
Make
smaye81 Jun 22, 2023
5202eb0
Tests
smaye81 Jun 22, 2023
a2c23d2
Tests
smaye81 Jun 23, 2023
b88313a
Fix for server metadata
smaye81 Jun 23, 2023
64953f5
Docker
smaye81 Jun 23, 2023
1b9141d
Lint
smaye81 Jun 23, 2023
0227d1c
Uncommenting test to see it fail in CI
smaye81 Jun 23, 2023
472eabd
Comments
smaye81 Jun 23, 2023
cb5c0e9
Test
smaye81 Jun 27, 2023
52ea67e
Tests
smaye81 Jun 27, 2023
1ee855f
Update web/server/fastify/server.ts
smaye81 Jun 27, 2023
8a161ad
gRPC web test fix
smaye81 Jun 27, 2023
00b58c8
Added envoy
smaye81 Jun 27, 2023
1ba46a3
Removed dist
smaye81 Jun 27, 2023
3f78031
Update to 0.11.0 for JSON response body fix
smaye81 Jun 29, 2023
e3e0c01
Update
smaye81 Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile.crosstest → Dockerfile.crosstestgo
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ARG TEST_CONNECT_GO_BRANCH
COPY go.mod go.sum /workspace/
COPY cmd /workspace/cmd
COPY internal /workspace/internal
COPY proto /workspace/proto
COPY cert /workspace/cert
RUN if [ ! -z "$TEST_CONNECT_GO_BRANCH" ]; then go get github.com/bufbuild/connect-go@$TEST_CONNECT_GO_BRANCH; fi
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile.crosstestweb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ COPY web/package.json web/package-lock.json /workspace/
COPY web/tsconfig.json web/karma.conf.js /workspace/
COPY web/gen /workspace/gen
COPY web/spec /workspace/spec
RUN npm install --production
COPY web/server /workspace/server
COPY cert /workspace/cert
RUN npm install
RUN local_npm_packages="" && \
if [ ! -z "${TEST_PROTOBUF_ES_BRANCH}" ]; then \
git clone --branch "${TEST_PROTOBUF_ES_BRANCH}" --depth 1 https://github.com/bufbuild/protobuf-es.git ../protobuf-es && \
Expand All @@ -30,3 +32,5 @@ RUN local_npm_packages="" && \
if [ ! -z "${local_npm_packages}" ]; then \
npm link ${local_npm_packages}; \
fi
RUN npm run build

52 changes: 31 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-print-directory
BIN := .tmp/bin
COPYRIGHT_YEARS := 2022
LICENSE_IGNORE := -e internal/proto/grpc -e internal/interopgrpc -e web/spec/grpc-web.spec.ts
LICENSE_IGNORE := -e proto/grpc -e internal/interopgrpc -e web/spec/grpc-web.spec.ts -e web/server/fastify/program.ts
# Set to use a different compiler. For example, `GO=go1.18rc1 make test`.
GO ?= go

Expand Down Expand Up @@ -81,30 +81,40 @@ checkgenerate:

.PHONY: dockercomposetestgo
dockercomposetestgo: dockercomposeclean
docker-compose run client-connect-to-server-connect-h1
docker-compose run client-connect-to-server-connect-h2
docker-compose run client-connect-to-server-connect-h3
docker-compose run client-connect-grpc-to-server-connect-h1
docker-compose run client-connect-grpc-to-server-connect-h2
docker-compose run client-connect-grpc-web-to-server-connect-h1
docker-compose run client-connect-grpc-web-to-server-connect-h2
docker-compose run client-connect-grpc-web-to-server-connect-h3
docker-compose run client-connect-grpc-web-to-envoy-server-connect-h1
docker-compose run client-connect-grpc-web-to-envoy-server-grpc-h1
docker-compose run client-connect-grpc-to-server-grpc
docker-compose run client-grpc-to-server-connect
docker-compose run client-grpc-to-server-grpc
docker-compose run client-connect-go-to-server-connect-go-h1
docker-compose run client-connect-go-to-server-connect-go-h2
docker-compose run client-connect-go-to-server-connect-go-h3
docker-compose run client-connect-go-to-server-connect-node-fastify-h1
docker-compose run client-connect-go-to-server-connect-node-fastify-h2
smaye81 marked this conversation as resolved.
Show resolved Hide resolved
docker-compose run client-connect-go-grpc-to-server-connect-node-fastify-h1
docker-compose run client-connect-go-grpc-to-server-connect-node-fastify-h2
docker-compose run client-connect-go-grpc-web-to-server-connect-node-fastify-h1
docker-compose run client-connect-go-grpc-web-to-server-connect-node-fastify-h2
docker-compose run client-connect-go-grpc-to-server-connect-go-h1
docker-compose run client-connect-go-grpc-to-server-connect-go-h2
docker-compose run client-connect-go-grpc-web-to-server-connect-go-h1
docker-compose run client-connect-go-grpc-web-to-server-connect-go-h2
docker-compose run client-connect-go-grpc-web-to-server-connect-go-h3
docker-compose run client-connect-go-grpc-web-to-envoy-server-connect-go-h1
docker-compose run client-connect-go-grpc-web-to-envoy-server-grpc-go-h1
docker-compose run client-connect-go-grpc-to-server-grpc-go
docker-compose run client-grpc-go-to-server-connect-go
docker-compose run client-grpc-go-to-server-grpc-go
docker-compose run client-grpc-go-to-server-connect-node-fastify
$(MAKE) dockercomposeclean

.PHONY: dockercomposetestweb
dockercomposetestweb: dockercomposeclean
docker-compose run client-web-connect-web-to-server-connect-h1
docker-compose run client-web-connect-grpc-web-to-server-connect-h1
docker-compose run client-web-connect-grpc-web-to-envoy-server-connect
docker-compose run client-web-connect-grpc-web-to-envoy-server-grpc
docker-compose run client-web-grpc-web-to-server-connect-h1
docker-compose run client-web-grpc-web-to-envoy-server-connect
docker-compose run client-web-grpc-web-to-envoy-server-grpc
docker-compose run client-connect-web-to-server-connect-go-h1
smaye81 marked this conversation as resolved.
Show resolved Hide resolved
docker-compose run client-connect-web-grpc-web-to-server-connect-go-h1
docker-compose run client-connect-web-grpc-web-to-envoy-server-connect-go
docker-compose run client-connect-web-grpc-web-to-envoy-server-grpc-go
docker-compose run client-grpc-web-to-server-connect-go-h1
docker-compose run client-grpc-web-to-envoy-server-connect-go
docker-compose run client-grpc-web-to-envoy-server-grpc-go
docker-compose run client-connect-web-to-server-connect-node-fastify-h1
docker-compose run client-connect-web-grpc-web-to-server-connect-node-fastify-h1
docker-compose run client-grpc-web-to-server-connect-node-fastify-h1
$(MAKE) dockercomposeclean

.PHONY: dockercomposetest
Expand Down
4 changes: 2 additions & 2 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ plugins:
- name: connect-go
out: internal/gen/proto/connect
opt: paths=source_relative
- plugin: buf.build/bufbuild/es:v1.0.0
- plugin: buf.build/bufbuild/es:v1.2.1
out: web/gen/proto/connect-web
opt: target=ts
- plugin: buf.build/bufbuild/connect-es:v0.8.0
- plugin: buf.build/bufbuild/connect-es:v0.10.0
out: web/gen/proto/connect-web
opt: target=ts
- plugin: buf.build/protocolbuffers/js:v3.21.2
Expand Down
2 changes: 1 addition & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version: v1
directories:
- internal/proto
- proto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a reasonable change, but we have at least one command using the old path here. I'm not sure what Kotlin and Swift do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fix that path once this lands. I checked both repos and they do not seem to rely on that path. Also followed up with Alan and Rebello to verify.

11 changes: 9 additions & 2 deletions cmd/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"golang.org/x/net/http2"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/encoding/gzip"
)

Expand Down Expand Up @@ -138,23 +139,29 @@ func bind(cmd *cobra.Command, flags *flags) error {
func run(flags *flags) {
// tests for grpc client
if flags.implementation == grpcGo {
transportCredentials := credentials.NewTLS(newTLSConfig(flags.certFile, flags.keyFile))
var transportCredentials credentials.TransportCredentials
if !flags.insecure {
transportCredentials = credentials.NewTLS(newTLSConfig(flags.certFile, flags.keyFile))
} else {
transportCredentials = insecure.NewCredentials()
}
clientConn, err := grpc.Dial(
net.JoinHostPort(flags.host, flags.port),
grpc.WithTransportCredentials(transportCredentials),
)
if err != nil {
log.Fatalf("failed grpc dial: %v", err)
}
defer clientConn.Close()
unresolvableClientConn, err := grpc.Dial(
"unresolvable-host.some.domain",
grpc.WithTransportCredentials(transportCredentials),
)
if err != nil {
log.Fatalf("failed grpc dial: %v", err)
}
defer clientConn.Close()
defer unresolvableClientConn.Close()

testGrpc(clientConn, unresolvableClientConn)
return
}
Expand Down
Loading