The code and data behind xeiaso.net
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(thoth): avoid hairpinning by connecting directly to thoth in the cluster

Signed-off-by: Xe Iaso <me@xeiaso.net>

Xe Iaso 01b9eb24 a1243147

+19 -6
+12 -3
cmd/sponsor-panel/internal/thoth/thoth.go
··· 11 11 "github.com/prometheus/client_golang/prometheus" 12 12 "google.golang.org/grpc" 13 13 "google.golang.org/grpc/credentials" 14 + "google.golang.org/grpc/credentials/insecure" 14 15 healthv1 "google.golang.org/grpc/health/grpc_health_v1" 15 16 "google.golang.org/grpc/metadata" 16 17 adminv1 "xeiaso.net/v4/gen/techaro/thoth/auth/admin/v1" ··· 25 26 AdminUsers adminv1.UsersServiceClient 26 27 } 27 28 28 - func New(ctx context.Context, thothURL, apiToken string) (*Client, error) { 29 + func New(ctx context.Context, thothURL, apiToken string, noTLS bool) (*Client, error) { 29 30 clMetrics := grpcprom.NewClientMetrics( 30 31 grpcprom.WithClientHandlingTimeHistogram( 31 32 grpcprom.WithHistogramBuckets([]float64{0.001, 0.01, 0.1, 0.3, 0.6, 1, 3, 6, 9, 20, 30, 60, 90, 120}), ··· 33 34 ) 34 35 prometheus.DefaultRegisterer.Register(clMetrics) 35 36 37 + var transportCreds credentials.TransportCredentials 38 + 39 + switch noTLS { 40 + case true: 41 + transportCreds = insecure.NewCredentials() 42 + case false: 43 + transportCreds = credentials.NewTLS(&tls.Config{}) 44 + } 45 + 36 46 conn, err := grpc.NewClient( 37 47 thothURL, 38 - grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})), 39 - //grpc.WithTransportCredentials(insecure.NewCredentials()), 48 + grpc.WithTransportCredentials(transportCreds), 40 49 grpc.WithChainUnaryInterceptor( 41 50 timeout.UnaryClientInterceptor(5*time.Minute), 42 51 clMetrics.UnaryClientInterceptor(),
+3 -2
cmd/sponsor-panel/main.go
··· 59 59 patreonFiftyPlus = flag.String("patreon-fifty-plus", "", "Comma-separated list of Patreon usernames always treated as $50+ sponsors") 60 60 61 61 // Thoth settings 62 - thothToken = flag.String("thoth-token", "", "Thoth API token (use a god token)") 63 - thothURL = flag.String("thoth-url", "passthrough:///thoth.techaro.lol:443", "URL for the Thoth API server") 62 + thothInsecure = flag.Bool("thoth-insecure", false, "if true, connect to thoth without TLS") 63 + thothToken = flag.String("thoth-token", "", "Thoth API token (use a god token)") 64 + thothURL = flag.String("thoth-url", "passthrough:///thoth.techaro.lol:443", "URL for the Thoth API server") 64 65 65 66 //go:embed static 66 67 staticFS embed.FS
+1
docker/patreon-saasproxy.Dockerfile
··· 11 11 RUN go mod download 12 12 13 13 COPY . . 14 + RUN apk -U add git 14 15 RUN --mount=type=cache,target=/root/.cache GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -ldflags="-X xeiaso.net/v4.Version=$(git describe --tags --always --dirty)" -gcflags "all=-N -l" -o /app/bin/patreon-saasproxy ./cmd/patreon-saasproxy 15 16 16 17 FROM alpine:${ALPINE_VERSION} AS run
+1 -1
docker/sponsor-panel.Dockerfile
··· 12 12 RUN go mod download 13 13 14 14 COPY . . 15 - RUN apk -U add nodejs npm \ 15 + RUN apk -U add git nodejs npm \ 16 16 && npm ci \ 17 17 && cd ./cmd/sponsor-panel \ 18 18 && go generate ./...
+2
manifest/sponsor-panel/deployment.yaml
··· 37 37 value: ":4823" 38 38 - name: SLOG_LEVEL 39 39 value: "info" 40 + - name: "THOTH_INSECURE" 41 + value: "true" 40 42 ports: 41 43 - containerPort: 4823 42 44 name: http