Skip to content

Commit

Permalink
Clean up the ports that Yorkie uses
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerwins committed Aug 21, 2020
1 parent 0885d00 commit f0f6a17
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 262 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ COPY . .
# Build the yorkie
RUN make build

# Expose port 9090 to the outside world
EXPOSE 9090
# Expose port 11101, 11102 to the outside world
EXPOSE 11101
EXPOSE 11102

# Command to run the executable
ENTRYPOINT ["/app/bin/yorkie", "agent"]
4 changes: 2 additions & 2 deletions docker/docker-compose-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
image: prom/prometheus:latest
container_name: prometheus
ports:
- 19090:9090
- 9090:9090
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
Expand All @@ -28,4 +28,4 @@ services:
image: redis:latest
container_name: redis
ports:
- 6379:6379
- 6379:6379
26 changes: 14 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,31 @@ module github.com/yorkie-team/yorkie
go 1.13

require (
github.com/bombsimon/wsl/v2 v2.0.0 // indirect
github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.2
github.com/golang/snappy v0.0.1 // indirect
github.com/golangci/golangci-lint v1.27.0 // indirect
github.com/google/go-cmp v0.3.0 // indirect
github.com/google/go-cmp v0.5.0 // indirect
github.com/google/uuid v1.1.1
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/kr/text v0.2.0 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v0.9.3
github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83 // indirect
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.5.1
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.6.1
github.com/tidwall/pretty v1.0.0 // indirect
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
github.com/xdg/stringprep v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.1.2
go.uber.org/multierr v1.2.0 // indirect
go.uber.org/zap v1.11.0
golang.org/x/crypto v0.0.0-20191117063200-497ca9f6d64f // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/tools v0.0.0-20200702044944-0cc1aa72b347 // indirect
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a
google.golang.org/grpc v1.24.0
honnef.co/go/tools v0.0.1-2020.1.3 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
)
281 changes: 44 additions & 237 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion testhelper/testhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var testStartedAt int64

const (
RPCPort = 1101
MetricsPort = 2202
MetricsPort = 1102

MongoConnectionURI = "mongodb://localhost:27017"
MongoConnectionTimeoutSec = 5
Expand Down
4 changes: 2 additions & 2 deletions yorkie/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
)

const (
DefaultRPCPort = 9090
DefaultMetricsPort = 2112
DefaultRPCPort = 11101
DefaultMetricsPort = 11102

DefaultMongoConnectionURI = "mongodb://localhost:27017"
DefaultMongoConnectionTimeoutSec = 5
Expand Down
4 changes: 2 additions & 2 deletions yorkie/config.sample.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"RPC": {
"Port": 9090,
"Port": 11101,
"CertFile": "",
"KeyFile": ""
},
"Metrics": {
"Port": 2112
"Port": 11102
},
"Mongo": {
"ConnectionTimeoutSec": 5,
Expand Down
14 changes: 10 additions & 4 deletions yorkie/rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import (
"fmt"
"net"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/status"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/yorkie-team/yorkie/api"
"github.com/yorkie-team/yorkie/api/converter"
"github.com/yorkie-team/yorkie/pkg/document/key"
Expand Down Expand Up @@ -63,8 +63,14 @@ type Server struct {
// NewServer creates a new instance of Server.
func NewServer(conf *Config, be *backend.Backend) (*Server, error) {
opts := []grpc.ServerOption{
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(unaryInterceptor, grpc_prometheus.UnaryServerInterceptor)),
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(streamInterceptor, grpc_prometheus.StreamServerInterceptor)),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
unaryInterceptor,
grpc_prometheus.UnaryServerInterceptor,
)),
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
streamInterceptor,
grpc_prometheus.StreamServerInterceptor,
)),
}

if conf.CertFile != "" && conf.KeyFile != "" {
Expand Down

0 comments on commit f0f6a17

Please sign in to comment.