This commit is contained in:
crusader 2018-06-14 16:17:03 +09:00
parent ea8d6ed43e
commit bdfaf81df9
6 changed files with 30 additions and 16 deletions

View File

@ -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'

View File

@ -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"
}
}
}

View File

@ -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
docker push docker.loafle.net/overflow/probe_gateway_rpc:1.0.0-SNAPSHOT

View File

@ -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",

View File

@ -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"
- 19100:80

View File

@ -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 {