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

Bug: Patch Failing Dockerfile #23

Merged
merged 7 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
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
8 changes: 3 additions & 5 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
---
linters-settings:
misspell:
locale: US

linters:
enable:
- bodyclose
- dupl
- errorlint
- funlen
- goconst
- gosec
- misspell
Expand All @@ -29,3 +24,6 @@ linters-settings:
errorlint:
# Report non-wrapping error creation using fmt.Errorf
errorf: false
misspell:
locale: US

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
- Migrate to github actions, normalize analysis tools, Dockerfiles and Makefiles. [#6](https://github.com/xmidt-org/go-parodus/pull/6)
- Patch failing Dockerfile, fx linter issues [#23](https://github.com/xmidt-org/go-parodus/pull/23)

## [v0.2.0]
- updated references to the main branch
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
FROM docker.io/library/golang:1.15-alpine as builder

MAINTAINER Jack Murdock <[email protected]>
FROM docker.io/library/golang:1.19-alpine as builder

WORKDIR /src

ARG VERSION
ARG GITCOMMIT
ARG BUILDTIME


RUN apk add --no-cache --no-progress \
ca-certificates \
make \
curl \
git \
openssh \
gcc \
libc-dev \
upx

RUN go get github.com/geofffranks/spruce/cmd/spruce && chmod +x /go/bin/spruce
RUN mkdir -p /go/bin && \
curl -o /go/bin/spruce https://github.com/geofffranks/spruce/releases/download/v1.29.0/spruce-linux-amd64 && \
chmod +x /go/bin/spruce
COPY . .
RUN make test release

Expand Down
16 changes: 6 additions & 10 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ import (
"context"
"errors"
"fmt"
"github.com/go-kit/kit/log"
"net/url"
"time"

"github.com/go-kit/log"
"github.com/spf13/pflag"
"github.com/xmidt-org/kratos"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/webpa-common/v2/logging" // nolint:staticcheck
"github.com/xmidt-org/wrp-go/v3"
"go.uber.org/fx"
"nanomsg.org/go/mangos/v2"
"nanomsg.org/go/mangos/v2/protocol/pull"
"nanomsg.org/go/mangos/v2/protocol/push"
"net/url"
"time"

// register transports
_ "nanomsg.org/go/mangos/v2/transport/all"
Expand Down Expand Up @@ -117,7 +118,6 @@ func StartClient(config ClientConfig, lc fx.Lifecycle) (SendMessageHandler, erro
msgHandler: config.MSGHandler,
parodusUpstream: make(chan wrp.Message, 100),
}

// create push socket
if parodusSock, err := push.NewSocket(); err != nil {
return nil, fmt.Errorf("can't get new push socket: %s", err)
Expand All @@ -127,7 +127,6 @@ func StartClient(config ClientConfig, lc fx.Lifecycle) (SendMessageHandler, erro
}
client.parodusSock = parodusSock
}

// create pull socket
if serviceSock, err := pull.NewSocket(); err != nil {
return nil, fmt.Errorf("can't get new pull socket: %s", err)
Expand All @@ -142,16 +141,14 @@ func StartClient(config ClientConfig, lc fx.Lifecycle) (SendMessageHandler, erro
wrpBusRead := make(chan wrp.Message, 100)
ticker := time.NewTicker(config.Register)
stopTicker := make(chan struct{}, 1)

lc.Append(fx.Hook{
OnStart: func(context context.Context) error {
go ReadPump(client.serviceSock, dataBus, client.logger)
go WritePump(client.parodusSock, client.parodusUpstream, client.stopSending, client.logger)
go ParseBus(wrpBusRead, dataBus, client.stopParsing, client.logger)
go client.handleMSG(wrpBusRead, client.parodusUpstream)
client.sendRegistration()
// Send alive every tick
go func() {
go func() { // Send alive every tick
for {
select {
case <-stopTicker:
Expand All @@ -173,7 +170,6 @@ func StartClient(config ClientConfig, lc fx.Lifecycle) (SendMessageHandler, erro
return nil
},
})

return &client, nil
}

Expand Down
8 changes: 4 additions & 4 deletions client/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ package client

import (
"fmt"
"github.com/go-kit/kit/log"
"github.com/xmidt-org/webpa-common/logging"

"github.com/go-kit/log"
"github.com/xmidt-org/webpa-common/v2/logging" // nolint:staticcheck
"github.com/xmidt-org/wrp-go/v3"
"nanomsg.org/go/mangos/v2"
"nanomsg.org/go/mangos/v2/protocol/push"
Expand All @@ -36,8 +37,7 @@ func ReadPump(pullSock mangos.Socket, msgBus chan []byte, logger log.Logger) {
}
msgBus <- data
}
pullSock.Close()
logging.Debug(logger).Log(logging.MessageKey(), "read pump has stopped")
// where to close pullSock?
}

func WritePump(pushSock mangos.Socket, bus chan wrp.Message, stopWriting chan struct{}, logger log.Logger) {
Expand Down
8 changes: 3 additions & 5 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package main

import (
"fmt"
"github.com/spf13/pflag"
"go.uber.org/fx"
"strings"
"time"

"github.com/spf13/pflag"
"go.uber.org/fx"
)

const (
Expand All @@ -41,12 +42,9 @@ const (
URLKeyName = "xmidt-url"
MaxBackoffKeyName = "xmidt-backoff-max"
InterfaceKeyName = "xmidt-interface-used"
ProtocolKeyName = ""
UUIDKeyName = ""
LocalURLKeyName = "parodus-local-url"
PartnerIDKeyName = "partner-id"
CertPathKeyName = "ssl-cert-path"
AuthTokenKeyName = ""
IPv4KeyName = "force-ipv4"
IPv6KeyName = "force-ipv6"

Expand Down
7 changes: 4 additions & 3 deletions downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ package main

import (
"context"
"github.com/go-kit/kit/log"
"time"

"github.com/go-kit/log"
libparodus "github.com/xmidt-org/go-parodus/client"
"github.com/xmidt-org/kratos"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/webpa-common/v2/logging" // nolint:staticcheck
"github.com/xmidt-org/wrp-go/v3"
"go.uber.org/fx"
"nanomsg.org/go/mangos/v2"
"nanomsg.org/go/mangos/v2/protocol/pull"
"time"

// register transports
_ "nanomsg.org/go/mangos/v2/transport/all"
Expand Down
7 changes: 4 additions & 3 deletions examples/events/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import (
"context"
"errors"
"fmt"
"net/http"
"time"

"github.com/go-kit/kit/log"
"github.com/xmidt-org/go-parodus/client"
"github.com/xmidt-org/kratos"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/webpa-common/v2/logging"
"github.com/xmidt-org/wrp-go/v3"
"go.uber.org/fx"
"net/http"
"time"
)

func Provide() (client.ClientConfig, *App) {
Expand Down
5 changes: 3 additions & 2 deletions examples/request-response/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ package main
import (
"encoding/json"
"fmt"
"time"

"github.com/go-kit/kit/log"
"github.com/spf13/pflag"
"github.com/xmidt-org/go-parodus/client"
"github.com/xmidt-org/kratos"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/webpa-common/v2/logging"
"github.com/xmidt-org/wrp-go/v3"
"time"

"net/http"
)
Expand Down
10 changes: 5 additions & 5 deletions forwarder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ package main

import (
"fmt"
"github.com/go-kit/kit/log"
"net/http"
"time"

"github.com/go-kit/log"
"github.com/xmidt-org/go-parodus/client"
"github.com/xmidt-org/kratos"
"github.com/xmidt-org/webpa-common/logging"
"github.com/xmidt-org/webpa-common/v2/logging" // nolint:staticcheck
"github.com/xmidt-org/wrp-go/v3"
"nanomsg.org/go/mangos/v2"
"net/http"
"time"
)

// Forwarder struct forwards messages coming from Talaria down to the libparouds clients
//
type Forwarder struct {
Name string
URL string
Expand Down
54 changes: 52 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,64 @@
module github.com/xmidt-org/go-parodus

go 1.14
go 1.19

require (
github.com/go-kit/kit v0.12.0
github.com/go-kit/log v0.2.1
github.com/spf13/pflag v1.0.5
github.com/xmidt-org/kratos v0.2.1
github.com/xmidt-org/themis v0.4.8
github.com/xmidt-org/webpa-common v1.11.9
github.com/xmidt-org/webpa-common/v2 v2.0.7
github.com/xmidt-org/wrp-go/v3 v3.1.4
go.uber.org/fx v1.18.1
nanomsg.org/go/mangos/v2 v2.0.8
)

require (
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/goph/emperror v0.17.3-0.20190703203600-60a8d9faa17b // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/segmentio/ksuid v1.0.4 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/stretchr/testify v1.8.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/xmidt-org/webpa-common v1.11.9 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/dig v1.15.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/sys v0.0.0-20220907062415-87db552b00fd // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading