Skip to content

Commit

Permalink
(r) go modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ont committed Sep 21, 2020
1 parent fd85613 commit 91525d8
Show file tree
Hide file tree
Showing 18 changed files with 661 additions and 429 deletions.
5 changes: 1 addition & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ pipeline:
build:
image: andrexus/golang-dep
commands:
- export GOPATH=$(pwd)
- cd src/flux
- dep ensure -vendor-only
- go build
- go build -o bin/server cmd/server/main.go

publish-docker:
image: plugins/docker
Expand Down
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,4 @@
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

pkg/
src/flux/flux
src/flux/vendor/
bin/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
FROM alpine

# fix "/bin/sh: /stick: not found" SEE: https://stackoverflow.com/a/35613430/434255
# fix "/bin/sh: /app-name: not found" SEE: https://stackoverflow.com/a/35613430/434255
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2

# install root CAs
Expand Down
17 changes: 9 additions & 8 deletions src/flux/main.go → cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package main
import (
"os"

"github.com/kataras/iris"
"flux/pkg/server"

"github.com/kataras/iris/v12"
log "github.com/sirupsen/logrus"
"gopkg.in/alecthomas/kingpin.v2"
)
Expand All @@ -24,22 +26,22 @@ func main() {

app := iris.New()

grammar := NewGrammar(*config)
grammar := server.NewGrammar(*config)

PrintConfig(grammar, *debugConfig, *verbose)
server.PrintConfig(grammar, *debugConfig, *verbose)

if *test != "" {
testRegexps(grammar, *test)
server.TestRegexps(grammar, *test)
os.Exit(0)
}

rootConsumer := NewRootConsumer(app)
rootConsumer := server.NewRootConsumer(app)

for _, route := range grammar.Routes {
consumer, queue := NewConsumer(app, route)
consumer, queue := server.NewConsumer(app, route)
rootConsumer.AddConsumer(route.Name, consumer)

workers := NewWorkers(queue, route.Metrics)
workers := server.NewWorkers(queue, route.Metrics)
for _, worker := range workers {
go worker.Start()
}
Expand All @@ -50,7 +52,6 @@ func main() {
iris.WithoutServerError(iris.ErrServerClosed),
iris.WithOptimizations,
iris.WithoutBanner,
iris.WithoutVersionChecker,
)

}
50 changes: 50 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module flux

go 1.15

require (
github.com/ajg/form v1.5.1 // indirect
github.com/alecthomas/participle v0.6.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
github.com/andybalholm/brotli v1.0.1-0.20200619015827-c3da72aa01ed // indirect
github.com/davecgh/go-spew v1.1.1
github.com/dlclark/regexp2 v1.2.1 // indirect
github.com/dop251/goja v0.0.0-20200912112403-81ddb8a7cc41
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/influxdata/influxdb v1.8.2
github.com/iris-contrib/jade v1.1.4 // indirect
github.com/iris-contrib/schema v0.0.2 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/kataras/golog v0.0.18 // indirect
github.com/kataras/iris/v12 v12.1.8
github.com/klauspost/compress v1.10.10 // indirect
github.com/microcosm-cc/bluemonday v1.0.3 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/moul/http2curl v1.0.0 // indirect
github.com/onsi/ginkgo v1.14.1 // indirect
github.com/onsi/gomega v1.10.2 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.6.0
github.com/stretchr/testify v1.6.1 // indirect
github.com/valyala/fasthttp v1.16.0 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de // indirect
golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
golang.org/x/sys v0.0.0-20200808120158-1030fc2bf1d9 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/ini.v1 v1.57.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
)
585 changes: 585 additions & 0 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/flux/config.go → pkg/server/config.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package main
package server

import (
"os"
"time"

influx "github.com/influxdata/influxdb/client/v2"
"github.com/kataras/iris"
"github.com/kataras/iris/v12"
log "github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion src/flux/consumer-base.go → pkg/server/consumer-base.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import (
"bufio"
Expand Down
4 changes: 2 additions & 2 deletions src/flux/consumer-root.go → pkg/server/consumer-root.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main
package server

import (
"github.com/kataras/iris"
"github.com/kataras/iris/v12"
log "github.com/sirupsen/logrus"
)

Expand Down
4 changes: 2 additions & 2 deletions src/flux/consumer.go → pkg/server/consumer.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main
package server

import (
"github.com/kataras/iris/context"
"github.com/kataras/iris/v12/context"
log "github.com/sirupsen/logrus"
)

Expand Down
4 changes: 2 additions & 2 deletions src/flux/debug-config.go → pkg/server/debug-config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import (
"fmt"
Expand Down Expand Up @@ -46,7 +46,7 @@ func printGrammar(grammar *Grammar, verbose bool) {
}
}

func testRegexps(grammar *Grammar, data string) {
func TestRegexps(grammar *Grammar, data string) {
for _, route := range grammar.Routes {
fmt.Printf("== Route \"%s\"\n", route.Name)
for _, metric := range route.Metrics {
Expand Down
2 changes: 1 addition & 1 deletion src/flux/grammar.go → pkg/server/grammar.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion src/flux/helpers.go → pkg/server/helpers.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion src/flux/log-message.go → pkg/server/log-message.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import log "github.com/sirupsen/logrus"

Expand Down
2 changes: 1 addition & 1 deletion src/flux/script.go → pkg/server/script.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import (
"github.com/dop251/goja"
Expand Down
2 changes: 1 addition & 1 deletion src/flux/worker.go → pkg/server/worker.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package server

import (
"strconv"
Expand Down
Loading

0 comments on commit 91525d8

Please sign in to comment.