Skip to content

Commit

Permalink
Upgrade golang and remove dingo (#17)
Browse files Browse the repository at this point in the history
* TRAF-1451 - Provide homing-pigeon with a Pub/Sub ack service

* Improve naming and format

* Improve naming

* Improve proto naming

* Change ENV var in docker-compose

* TRAF-1451 - Add ACK broker and remove dingo

* update go mod

* Remove ack broker client (example)

* grpc.withinsecure is deprecated

* Fix unhandled error

* Remove services container

* Skeleton to add new adapters

* Rename broker address to broker port

* Add ENV variables to choose between adapters

* Broker middleware

* Dummy implementation when no adatper is defined

* feat: update Golang to 1.17 and remove Dingo

* feat: update imports

* feat: try to fix linter

* revert changes in ci.yml

* change ci steps order

* revert ci.yaml

* skip pkg cache

* try to fix pipeline

* revert skip pkg cache

* upgrade golangci lint to v3

* upgrade action version

* skipt build and pkg cache

* update insecure packages

* revert to golangci-lint v2

* update to go 1.19

* upgrade golangci-lint

* revert to go 1.17

* use go 1.19

* try disabling package caching

* fix lint errors

* revert socket name
  • Loading branch information
paupm authored Aug 12, 2024
1 parent 0dd0c10 commit e5c6b8b
Show file tree
Hide file tree
Showing 21 changed files with 472 additions and 1,038 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ jobs:
test:
strategy:
matrix:
go-version: [1.13.x]
go-version: [1.19]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
# - name: Cache go modules
Expand All @@ -30,8 +30,9 @@ jobs:
sudo apt-get install -y protobuf-compiler
make build
- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v4
with:
version: v1.29
version: v1.54
skip-pkg-cache: true
- name: Test
run: go test -v -race ./...
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
*.out

# Ignore generated files
pkg/generatedServices
bin
sockets
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.13-buster AS build
FROM golang:1.19-buster AS build

RUN apt-get update \
&& apt-get install -y protobuf-compiler
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ generate-proto:
protoc -I proto/ proto/middleware.proto --go_out=plugins=grpc:proto
dep:
go get -u github.com/rakyll/gotest
go get -u github.com/sarulabs/dingo/dingo
go get -u github.com/vektra/mockery/.../
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
go install github.com/golang/protobuf/protoc-gen-go@v1.3.2
go get -u google.golang.org/grpc
go mod download
build: dep generate-proto
dingo -src="./pkg/services" -dest="./pkg/generatedServices"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags="-w -s" -o bin/homing-pigeon pkg/main.go
stress-build: dep generate-proto
dingo -src="./pkg/services" -dest="./pkg/generatedServices"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags="-w -s" -o bin/stress-pigeon pkg/stress/main.go
docker-build:
docker build -t softonic/homing-pigeon:${TAG} .
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ In order to start up correctly, it needs well defined environment variables:

##### Core

| Name | Value |
| ------------------------------------ | -------------------------------------------------------------------------- |
| MESSAGE_BUFFER_LENGTH | Buffer length for internal golang channel used for messaging |
| ACK_BUFFER_LENGTH | Buffer length for internal golang channel used for acks |
| MIDDLEWARES_SOCKET | Socket to connect to middlewares. Ex: passthrough:///unix://tmp/test.sock" |
| Name | Value |
|-----------------------|----------------------------------------------------------------------------|
| MESSAGE_BUFFER_LENGTH | Buffer length for internal golang channel used for messaging |
| ACK_BUFFER_LENGTH | Buffer length for internal golang channel used for acks |
| MIDDLEWARES_SOCKET | Socket to connect to middlewares. Ex: passthrough:///unix://tmp/test.sock" |
| READ_ADAPTER | Read interface implementation. Default: AMQP |
| WRITE_ADAPTER | Write interface implementation. Default: ELASTIC |

##### Read Adapters

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ services:
GRPC_GO_LOG_VERBOSITY_LEVEL: 99
GRPC_GO_LOG_SEVERITY_LEVEL: info
MIDDLEWARES_SOCKET: "passthrough:///unix:///tmp/hp"
READ_ADAPTER: "AMQP"
WRITE_ADAPTER: "ELASTIC"
hp-middleware-pass:
volumes:
- ./sockets:/tmp
Expand Down
39 changes: 19 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@ module github.com/softonic/homing-pigeon

require (
github.com/elastic/go-elasticsearch/v7 v7.10.0
github.com/gobuffalo/envy v1.9.0 // indirect
github.com/gobuffalo/packd v1.0.0 // indirect
github.com/gobuffalo/packr v1.30.1 // indirect
github.com/golang/protobuf v1.4.3
github.com/golangci/golangci-lint v1.33.0 // indirect
github.com/rakyll/gotest v0.0.5 // indirect
github.com/rogpeppe/go-internal v1.6.2 // indirect
github.com/sarulabs/dingo v2.0.0+incompatible
github.com/golang/protobuf v1.5.2
github.com/streadway/amqp v1.0.0
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.6.1
github.com/vektra/mockery v1.1.2 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
golang.org/x/text v0.3.4 // indirect
golang.org/x/tools v0.0.0-20201121010211-780cb80bd7fb // indirect
google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 // indirect
google.golang.org/grpc v1.33.2
google.golang.org/protobuf v1.25.0
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
github.com/stretchr/testify v1.7.0
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.27.1
k8s.io/klog v1.0.0
)

go 1.13
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
golang.org/x/net v0.0.0-20220225143137-f80d34dcf065 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/text v0.3.8 // indirect
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)

go 1.19
Loading

0 comments on commit e5c6b8b

Please sign in to comment.