From bdfaf81df9cb32c1477345c9e6b4ea02f1f6443f Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 14 Jun 2018 16:17:03 +0900 Subject: [PATCH] ing --- Dockerfile | 4 +--- _docker/config/config.json | 4 ++-- build.sh | 4 ++-- config.json | 4 ++-- docker-compose.yml | 11 ++++++----- servlet/auth-servlet.go | 19 +++++++++++++++++-- 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7b688c..6d8fb02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,7 @@ COPY _docker/config/* /etc/overflow/config/ COPY _docker/bin/* /usr/local/overflow/bin/ COPY dist/probe_gateway_rpc /usr/local/overflow/bin/ -RUN mkdir -p /etc/overflow/config; \ - mkdir -p /usr/local/overflow/bin; \ - mkdir -p /var/overflow/logs; \ +RUN mkdir -p /var/overflow/logs; \ chmod +x /usr/local/overflow/bin/docker-entrypoint.sh /usr/local/overflow/bin/probe_gateway_rpc; ENV TINI_VERSION='0.17.0' diff --git a/_docker/config/config.json b/_docker/config/config.json index bfa7641..dc8af99 100644 --- a/_docker/config/config.json +++ b/_docker/config/config.json @@ -19,11 +19,11 @@ "external": { "grpc": { "network": "tcp4", - "address": "192.168.1.50:50006" + "address": "central:9111" }, "redis": { "network": "tcp4", - "address": "192.168.1.50:6379" + "address": "redis:6379" } } } diff --git a/build.sh b/build.sh index d1c77e4..0232ebf 100755 --- a/build.sh +++ b/build.sh @@ -3,6 +3,6 @@ rm ./dist CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/probe_gateway_rpc -docker build -t docker.loafle.net/overflow/probe_gateway_rpc:1.0.0 . +docker build -t docker.loafle.net/overflow/probe_gateway_rpc:1.0.0-SNAPSHOT . -docker push docker.loafle.net/overflow/probe_gateway_rpc:1.0.0 \ No newline at end of file +docker push docker.loafle.net/overflow/probe_gateway_rpc:1.0.0-SNAPSHOT \ No newline at end of file diff --git a/config.json b/config.json index 3ff943c..4e08413 100644 --- a/config.json +++ b/config.json @@ -2,7 +2,7 @@ "serverHandler": { "name": "Gateway Probe RPC", "network": "tcp4", - "address": ":19091", + "address": ":19100", "concurrency": 262144, "keepAlive": 60, "handshakeTimeout": 60, @@ -19,7 +19,7 @@ "external": { "grpc": { "network": "tcp4", - "address": "192.168.1.101:50006" + "address": "192.168.1.101:9111" }, "redis": { "network": "tcp4", diff --git a/docker-compose.yml b/docker-compose.yml index 8ae2144..4a89da4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,10 +2,11 @@ version: "3" services: probe_gateway_rpc: - image: docker.loafle.net/overflow/probe_gateway_rpc:1.0.0 + image: docker.loafle.net/overflow/probe_gateway_rpc:1.0.0-SNAPSHOT container_name: probe_gateway_rpc - # volumes: - # - /service/redis/data/var/redis:/data - # - /service/redis/data/usr/local/etc/redis/redis.conf:/usr/local/etc/redis/redis.conf + hostname: probe_gateway_rpc + restart: always + volumes: + - /service/overflow/data/probe_gateway_rpc/var/overflow/logs:/var/overflow/logs ports: - - "19091:80" \ No newline at end of file + - 19100:80 \ No newline at end of file diff --git a/servlet/auth-servlet.go b/servlet/auth-servlet.go index 5d558f7..f00efba 100644 --- a/servlet/auth-servlet.go +++ b/servlet/auth-servlet.go @@ -1,10 +1,13 @@ package servlet import ( + "bytes" + "compress/gzip" "context" "encoding/base64" "encoding/json" "fmt" + "io/ioutil" "github.com/valyala/fasthttp" @@ -80,11 +83,23 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req if nil == bInfo { return nil, fmt.Errorf("Unexpected Request Header Key NoAuthProbe Info") } - rJSON := make([]byte, base64.StdEncoding.DecodedLen(len(bInfo))) - _, err := base64.StdEncoding.Decode(rJSON, bInfo) + + buf := make([]byte, base64.StdEncoding.DecodedLen(len(bInfo))) + _, err := base64.StdEncoding.Decode(buf, bInfo) if nil != err { return nil, fmt.Errorf("Base64 Encoding Error: %s", err.Error()) } + + bReader := bytes.NewReader(buf) + gReader, err := gzip.NewReader(bReader) + if nil != err { + return nil, fmt.Errorf("gzip Error: %s", err.Error()) + } + rJSON, err := ioutil.ReadAll(gReader) + if nil != err { + return nil, fmt.Errorf("gzip Error: %s", err.Error()) + } + grpcCTX := context.Background() r, err := oeg.Exec(grpcCTX, "NoAuthProbeService.regist", string(rJSON)) if nil != err {