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

Create Posts “dialing-on-the-public-internet-with-grpc-go-cloudflare-and-caddy” #82

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Dialing on the Public Internet With gRPC-Go, Cloudflare, and Caddy
layout: post
date: 2023-01-10T17:38:28.209Z
categories:
- programming
---

```
$ amostra work https://grpc.domain.com
FATA[2023-01-10T17:43:00Z] ../worker.go:146 failed to call schedule client allocs: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp: lookup tcp///grpc.100brushes.com: Servname not supported for ai_socktype"
```

Enable support buried deep in menu in https://support.cloudflare.com/hc/en-us/articles/360050483011-Understanding-Cloudflare-gRPC-support

Caddy config:

```
grpc.domain.com {
reverse_proxy h2c://127.0.0.1:42000
}
```

```
$ amostra work grpc.100brushes.com:443
FATA[2023-01-10T17:34:01Z] ../worker.go:138 failed to call schedule client allocs: rpc error: code = Unavailable desc = conne
ction error: desc = "error reading server preface: http2: frame too large"
```

Needed to get system certs

```
systemCertPool, err := x509.SystemCertPool()
if err != nil {
log.Fatal("can't get system cert pool", err)
}
conn, err := grpc.Dial(cliCtx.Args().Get(0), grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{
RootCAs: systemCertPool,
})))
if err != nil {
logrus.Fatalf("fail to dial: %v", err)
}
```

```
$ amostra work dns:///dev.100brushes.com
... Connected and ready to work ...
```