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

Johnlin/remove influxdb #15

Merged
merged 8 commits into from
Jun 20, 2018
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
6 changes: 1 addition & 5 deletions config/k8s.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
"url": "mongodb://35.189.177.37:31717/votex"
}
},
"influxdb": {
"url": "http://influxdb.default:8086",
"database": "lisa"
},
"logger": {
"dir": "./logs",
"level": "debug",
Expand All @@ -41,4 +37,4 @@
"version": "<GIT_COMMIT>",
"logFileName": "access_log"
}
}
}
6 changes: 1 addition & 5 deletions config/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
"mongo": {
"url": "mongodb://localhost:31717/vortex_test"
},
"influxdb": {
"url": "http://localhost:8086",
"database": "lisa"
},
"logger": {
"dir": "./logs",
"level": "debug",
Expand All @@ -30,4 +26,4 @@
"version": "local",
"logFileName": "access_log"
}
}
}
6 changes: 1 addition & 5 deletions config/testing.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
"mongo": {
"url": "mongodb://localhost:27017/vortex_test"
},
"influxdb": {
"url": "http://localhost:8086",
"database": "lisa"
},
"logger": {
"dir": "./logs",
"level": "debug",
Expand All @@ -30,4 +26,4 @@
"version": "local",
"logFileName": "access_log"
}
}
}
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN go install ./src/cmd/...

# the final image: vortex
FROM alpine:3.7
RUN apk add --no-cache ca-certificates rsync
RUN apk add --no-cache ca-certificates
WORKDIR /vortex

# copy the go binaries from the build image
Expand Down
41 changes: 41 additions & 0 deletions src/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package config

import (
"encoding/json"
"fmt"
"os"

"github.com/linkernetworks/logger"
"github.com/linkernetworks/mongo"
"github.com/linkernetworks/redis"
)

type Config struct {
Redis *redis.RedisConfig `json:"redis"`
Mongo *mongo.MongoConfig `json:"mongo"`
Logger logger.LoggerConfig `json:"logger"`

// the version settings of the current application
Version string `json:"version"`
}

func Read(path string) (c Config, err error) {
file, err := os.Open(path)
if err != nil {
return c, fmt.Errorf("Failed to open the config file: %v\n", err)
}
defer file.Close()
decoder := json.NewDecoder(file)
if err := decoder.Decode(&c); err != nil {
return c, fmt.Errorf("Failed to load the config file: %v\n", err)
}
return c, nil
}

func MustRead(path string) Config {
c, err := Read(path)
if err != nil {
panic(err)
}
return c
}
2 changes: 1 addition & 1 deletion src/server/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net"
"net/http"

"github.com/linkernetworks/config"
"github.com/linkernetworks/logger"
"github.com/linkernetworks/vortex/src/config"
"github.com/linkernetworks/vortex/src/serviceprovider"
)

Expand Down
4 changes: 2 additions & 2 deletions src/server/handler_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"testing"

restful "github.com/emicklei/go-restful"
"github.com/influxdata/influxdb/pkg/testing/assert"
"github.com/linkernetworks/config"
"github.com/linkernetworks/vortex/src/config"
"github.com/linkernetworks/vortex/src/entity"
"github.com/linkernetworks/vortex/src/serviceprovider"
"github.com/stretchr/testify/assert"
mgo "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
Expand Down
27 changes: 7 additions & 20 deletions src/serviceprovider/serviceprovider.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
package serviceprovider

import (
"github.com/linkernetworks/config"
"github.com/linkernetworks/logger"
"github.com/linkernetworks/vortex/src/config"

"github.com/linkernetworks/gearman"
"github.com/linkernetworks/influxdb"
"github.com/linkernetworks/mongo"
"github.com/linkernetworks/redis"
)

type Container struct {
Config config.Config
Redis *redis.Service
Mongo *mongo.Service
Gearman *gearman.Service
Influxdb *influxdb.InfluxdbService
Config config.Config
Redis *redis.Service
Mongo *mongo.Service
}

type ServiceDiscoverResponse struct {
Expand All @@ -24,11 +20,6 @@ type ServiceDiscoverResponse struct {

type Service interface{}

func NewInfluxdbService(cf *influxdb.InfluxdbConfig) *influxdb.InfluxdbService {
logger.Infof("Connecting to influxdb: %s", cf.Url)
return &influxdb.InfluxdbService{Url: cf.Url}
}

func New(cf config.Config) *Container {
// setup logger configuration
logger.Setup(cf.Logger)
Expand All @@ -39,14 +30,10 @@ func New(cf config.Config) *Container {
logger.Infof("Connecting to mongodb: %s", cf.Mongo.Url)
mongo := mongo.New(cf.Mongo.Url)

logger.Infof("Connecting to influxdb: %s", cf.Influxdb.Url)
influx := &influxdb.InfluxdbService{Url: cf.Influxdb.Url}

sp := &Container{
Config: cf,
Redis: redisService,
Mongo: mongo,
Influxdb: influx,
Config: cf,
Redis: redisService,
Mongo: mongo,
}

return sp
Expand Down
60 changes: 0 additions & 60 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,36 +206,6 @@
"revision": "9cad4c3443a7200dd6400aef47183728de563a38",
"revisionTime": "2018-03-05T23:10:24Z"
},
{
"checksumSHA1": "OUzCEucDbeVwgno7zJyewECEP8U=",
"path": "github.com/influxdata/influxdb",
"revision": "968a3906213bba5c129fd9a4c1062874db60a611",
"revisionTime": "2018-06-14T00:50:14Z"
},
{
"checksumSHA1": "t06GpE7X4olsyp2d26RuKCDzC7w=",
"path": "github.com/influxdata/influxdb/client/v2",
"revision": "968a3906213bba5c129fd9a4c1062874db60a611",
"revisionTime": "2018-06-14T00:50:14Z"
},
{
"checksumSHA1": "CY8B/OcEr0wPuocuJ6lek0XmMys=",
"path": "github.com/influxdata/influxdb/models",
"revision": "968a3906213bba5c129fd9a4c1062874db60a611",
"revisionTime": "2018-06-14T00:50:14Z"
},
{
"checksumSHA1": "Z0Bb5PWa5WL/j5Dm2KJCLGn1l7U=",
"path": "github.com/influxdata/influxdb/pkg/escape",
"revision": "968a3906213bba5c129fd9a4c1062874db60a611",
"revisionTime": "2018-06-14T00:50:14Z"
},
{
"checksumSHA1": "FeDHPB6MLEx2dZAGDeCt2tf9Y+w=",
"path": "github.com/influxdata/influxdb/pkg/testing/assert",
"revision": "968a3906213bba5c129fd9a4c1062874db60a611",
"revisionTime": "2018-06-14T00:50:14Z"
},
{
"checksumSHA1": "NY84PNFBfNvxJgNEMVKUOJhcVsY=",
"path": "github.com/json-iterator/go",
Expand All @@ -260,36 +230,6 @@
"revision": "ba3bf9c1d0421aa146564a632931730344f1f9f1",
"revisionTime": "2018-02-20T04:22:22Z"
},
{
"path": "github.com/linkernetworks/aurora-debug",
"revision": ""
},
{
"path": "github.com/linkernetworks/aurora-debug/github.com/emicklei/go-restful",
"revision": ""
},
{
"path": "github.com/linkernetworks/aurora/src/net/http",
"revision": ""
},
{
"checksumSHA1": "ZhjkfAPQ1hqwwB+9j6GJ87tEnic=",
"path": "github.com/linkernetworks/config",
"revision": "cbdafe0080a7c89be42fa877ffb56d4f31456461",
"revisionTime": "2018-05-31T09:50:42Z"
},
{
"checksumSHA1": "WCxdMPK7lH+ioCiLYCs7ZE7msHs=",
"path": "github.com/linkernetworks/gearman",
"revision": "00fe5cdcf5ea006ce07ee865d773cfd151b9eb4e",
"revisionTime": "2018-05-25T05:43:38Z"
},
{
"checksumSHA1": "9t3LloU9ZmgeFE1blkKyXap0jyY=",
"path": "github.com/linkernetworks/influxdb",
"revision": "ad9cd5b7d4402a0cbd0613d043d48fb6e476d8bd",
"revisionTime": "2018-05-25T05:46:49Z"
},
{
"checksumSHA1": "Ywtth3s9PIYxkXxuojeo76lGO14=",
"path": "github.com/linkernetworks/logger",
Expand Down