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 _docker/bin/* /usr/local/overflow/bin/
COPY dist/probe_gateway_rpc /usr/local/overflow/bin/ COPY dist/probe_gateway_rpc /usr/local/overflow/bin/
RUN mkdir -p /etc/overflow/config; \ RUN mkdir -p /var/overflow/logs; \
mkdir -p /usr/local/overflow/bin; \
mkdir -p /var/overflow/logs; \
chmod +x /usr/local/overflow/bin/docker-entrypoint.sh /usr/local/overflow/bin/probe_gateway_rpc; chmod +x /usr/local/overflow/bin/docker-entrypoint.sh /usr/local/overflow/bin/probe_gateway_rpc;
ENV TINI_VERSION='0.17.0' ENV TINI_VERSION='0.17.0'

View File

@ -19,11 +19,11 @@
"external": { "external": {
"grpc": { "grpc": {
"network": "tcp4", "network": "tcp4",
"address": "192.168.1.50:50006" "address": "central:9111"
}, },
"redis": { "redis": {
"network": "tcp4", "network": "tcp4",
"address": "192.168.1.50:6379" "address": "redis:6379"
} }
} }
} }

View File

@ -3,6 +3,6 @@
rm ./dist rm ./dist
CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/probe_gateway_rpc 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": { "serverHandler": {
"name": "Gateway Probe RPC", "name": "Gateway Probe RPC",
"network": "tcp4", "network": "tcp4",
"address": ":19091", "address": ":19100",
"concurrency": 262144, "concurrency": 262144,
"keepAlive": 60, "keepAlive": 60,
"handshakeTimeout": 60, "handshakeTimeout": 60,
@ -19,7 +19,7 @@
"external": { "external": {
"grpc": { "grpc": {
"network": "tcp4", "network": "tcp4",
"address": "192.168.1.101:50006" "address": "192.168.1.101:9111"
}, },
"redis": { "redis": {
"network": "tcp4", "network": "tcp4",

View File

@ -2,10 +2,11 @@ version: "3"
services: services:
probe_gateway_rpc: 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 container_name: probe_gateway_rpc
# volumes: hostname: probe_gateway_rpc
# - /service/redis/data/var/redis:/data restart: always
# - /service/redis/data/usr/local/etc/redis/redis.conf:/usr/local/etc/redis/redis.conf volumes:
- /service/overflow/data/probe_gateway_rpc/var/overflow/logs:/var/overflow/logs
ports: ports:
- "19091:80" - 19100:80

View File

@ -1,10 +1,13 @@
package servlet package servlet
import ( import (
"bytes"
"compress/gzip"
"context" "context"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"github.com/valyala/fasthttp" "github.com/valyala/fasthttp"
@ -80,11 +83,23 @@ func (s *AuthServlets) Handshake(servletCtx server.ServletCtx, ctx *fasthttp.Req
if nil == bInfo { if nil == bInfo {
return nil, fmt.Errorf("Unexpected Request Header Key NoAuthProbe Info") 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 { if nil != err {
return nil, fmt.Errorf("Base64 Encoding Error: %s", err.Error()) 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() grpcCTX := context.Background()
r, err := oeg.Exec(grpcCTX, "NoAuthProbeService.regist", string(rJSON)) r, err := oeg.Exec(grpcCTX, "NoAuthProbeService.regist", string(rJSON))
if nil != err { if nil != err {