Skip to content

Commit

Permalink
Use locally generated protos
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Feb 29, 2024
1 parent e28b980 commit 47481e5
Show file tree
Hide file tree
Showing 51 changed files with 20,777 additions and 982 deletions.
2 changes: 1 addition & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DB_CONNECTION_STRING="postgres://postgres:xmtp@localhost:25432/postgres?sslmode=disable"
XMTP_GRPC_ADDRESS="localhost:5556"
XMTP_GRPC_ADDRESS="localhost:25556"
LOG_ENCODING=console
API_PORT="8080"
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
version: v1.45.2
version: v1.54
args: --timeout=5m --config dev/.golangci.yaml
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"protoc": {
"compile_on_save": false,
"options": ["--proto_path=build/tmp/vendor"]
}
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--config=./dev/.golangci.yaml"]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BUILD IMAGE --------------------------------------------------------
FROM golang:1.18-alpine as builder
FROM golang:1.20-alpine as builder

# Get build tools and required header files
RUN apk add --no-cache build-base
Expand Down
20 changes: 16 additions & 4 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
version: v1
managed:
enabled: true
go_package_prefix:
# <module_name> : name in go.mod
# <relative_path> : where generated code should be output
default: github.com/xmtp/example-notification-server-go/pkg/proto
# Remove `except` field if googleapis is not used
except:
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
plugins:
- name: go
- plugin: buf.build/grpc/go:v1.3.0
out: pkg/proto
opt: paths=source_relative
- name: connect-go
opt:
- paths=source_relative
- plugin: buf.build/protocolbuffers/go
out: pkg/proto
opt: paths=source_relative
opt:
- paths=source_relative
3 changes: 3 additions & 0 deletions dev/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ linters:
enable:
- nakedret
- nilerr
issues:
exclude:
- SA5008
16 changes: 2 additions & 14 deletions dev/gen-proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@ if [ -n "$(go env GOPATH)" ]; then
export PATH="${FOUND_GOPATH}/bin:${PATH}"
fi

if ! command -v buf &>/dev/null; then
go install go install github.com/bufbuild/buf/cmd/buf@latest
fi

if ! command -v protoc-gen-go &>/dev/null; then
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
fi

if ! command -v protoc-gen-connect-go &>/dev/null; then
go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest
fi

rm -rf ./pkg/proto
buf build
buf generate
buf generate --template proto/buf.gen.yaml
buf generate buf.build/xmtp/proto
23 changes: 16 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
version: '3'

services:
node:
image: xmtp/node-go:latest
platform: linux/amd64
environment:
- GOWAKU-NODEKEY=8a30dcb604b0b53627a5adc054dbf434b446628d4bd1eccc681d223f0550ce67
command:
- --ws
- --store.enable
- --store.db-connection-string=postgres://postgres:xmtp@db:5432/postgres?sslmode=disable
- --store.reader-db-connection-string=postgres://postgres:xmtp@db:5432/postgres?sslmode=disable
- --ws-port=9001
- --mls-store.db-connection-string=postgres://postgres:xmtp@mlsdb:5432/postgres?sslmode=disable
- --mls-validation.grpc-address=validation:50051
- --api.enable-mls
- --wait-for-db=30s
- --api.authn.enable
ports:
- 5555:5555
- 5556:5556
- 25556:5556
depends_on:
- db

validation:
image: ghcr.io/xmtp/mls-validation-service:main
platform: linux/amd64

db:
image: postgres:13
environment:
POSTGRES_PASSWORD: xmtp
ports:
- 25432:5432

mlsdb:
image: postgres:13
environment:
POSTGRES_PASSWORD: xmtp
69 changes: 41 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,62 +1,75 @@
module github.com/xmtp/example-notification-server-go

go 1.18
go 1.20

require (
connectrpc.com/connect v1.15.0
firebase.google.com/go/v4 v4.10.0
github.com/bufbuild/connect-go v1.1.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0
github.com/jessevdk/go-flags v1.5.0
github.com/pkg/errors v0.8.1
github.com/sideshow/apns2 v0.23.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.4
github.com/uptrace/bun v1.1.8
github.com/uptrace/bun/dialect/pgdialect v1.1.8
github.com/uptrace/bun/driver/pgdriver v1.1.8
github.com/uptrace/bun/extra/bundebug v1.1.8
github.com/xmtp/proto v1.3.2-0.20221114211142-5de75035720f
go.uber.org/zap v1.23.0
golang.org/x/net v0.2.0
google.golang.org/api v0.96.0
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.1
golang.org/x/net v0.21.0
google.golang.org/api v0.162.0
google.golang.org/genproto/googleapis/api v0.0.0-20240213162025-012b6fc9bca9
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.32.0
)

require (
cloud.google.com/go v0.102.1 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/firestore v1.6.1 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
cloud.google.com/go/storage v1.26.0 // indirect
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/firestore v1.14.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/longrunning v0.5.5 // indirect
cloud.google.com/go/storage v1.36.0 // indirect
github.com/MicahParks/keyfunc v1.5.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d // indirect
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/appengine v1.6.7 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/appengine/v2 v2.0.2 // indirect
google.golang.org/genproto v0.0.0-20220810155839-1856144b1d9c // indirect
google.golang.org/genproto v0.0.0-20240228224816-df926f6c8641 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mellium.im/sasl v0.3.0 // indirect
)
Loading

0 comments on commit 47481e5

Please sign in to comment.