-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
411 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
# go v1.16.15安装 | ||
|
||
cd /usr/local | ||
sudo wget https://golang.google.cn/dl/go1.18.2.linux-amd64.tar.gz | ||
sudo tar zxvf go1.18.2.linux-amd64.tar.gz | ||
sudo chown -R $USER /usr/local/go | ||
|
||
设置好go env | ||
go env -w GO111MODULE=on | ||
go env -w GOPROXY=https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,direct | ||
go env -w CGO_ENABLED=0 | ||
|
||
# centos7 protoc工具安装 | ||
|
||
1、下载https://github.com/protocolbuffers/protobuf/archive/v3.11.4.tar.gz | ||
1、下载https://github.com/protocolbuffers/protobuf/archive/v3.15.8.tar.gz | ||
cd /usr/local/src | ||
sudo wget https://github.com/protocolbuffers/protobuf/archive/v3.11.4.tar.gz | ||
sudo wget https://github.com/protocolbuffers/protobuf/archive/v3.15.8.tar.gz | ||
|
||
2、开始安装 | ||
sudo mv v3.11.4.tar.gz protobuf-3.11.4.tar.gz | ||
sudo tar zxvf protobuf-3.11.4.tar.gz | ||
cd protobuf-3.11.4 | ||
sudo mv v3.15.8.tar.gz protobuf-3.15.8.tar.gz | ||
sudo tar zxvf protobuf-3.15.8.tar.gz | ||
cd protobuf-3.15.8 | ||
sudo yum install gcc-c++ cmake libtool | ||
$ sudo mkdir /usr/local/protobuf | ||
|
||
|
@@ -24,25 +36,23 @@ | |
安装完成后,查看版本: | ||
$ cd /usr/local/protobuf/bin | ||
$ ./protoc --version | ||
libprotoc 3.11.4 | ||
libprotoc 3.15.8 | ||
建立软链接 | ||
$ sudo ln -s /usr/local/protobuf/bin/protoc /usr/bin/protoc | ||
|
||
# go protoc工具安装 | ||
|
||
执行如下命令 | ||
go get -u github.com/golang/protobuf/proto | ||
|
||
go get -u github.com/golang/protobuf/protoc-gen-go | ||
|
||
go get -u google.golang.org/grpc | ||
|
||
cd $GOPATH/pkg/mod/github.com/golang/[email protected]/protoc-gen-go | ||
go install | ||
|
||
cd $GOPATH/pkg/mod/github.com/golang/[email protected]/proto | ||
go install | ||
go install github.com/golang/protobuf/protoc-gen-go@latest | ||
go install google.golang.org/grpc@latest | ||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest | ||
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest | ||
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@latest | ||
go get -u github.com/go-playground/validator/v10 | ||
go install github.com/golang/mock/mockgen@latest | ||
go install github.com/favadi/protoc-go-inject-tag@latest | ||
|
||
# centos7 php grpc_php工具安装 | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# install nodejs | ||
|
||
cd /usr/local/ | ||
sudo wget https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz | ||
sudo apt-get install xz-utils | ||
sudo xz -d node-v12.16.2-linux-x64.tar.xz | ||
sudo tar xvf node-v12.16.2-linux-x64.tar | ||
sudo mv node-v12.16.2-linux-x64 nodejs | ||
|
||
# For the convenience of the current user, set nodejs to belong to the current user, | ||
# which is not recommended in the production environment | ||
|
||
sudo chown -R $USER /usr/local/nodejs | ||
sudo ln -s /usr/local/nodejs/bin/npm /usr/bin/npm | ||
sudo chmod +x /usr/bin/npm | ||
|
||
# add env path | ||
vim ~/.bashrc | ||
export NODEJS_HOME=/usr/local/nodejs | ||
export PATH=$NODEJS_HOME/bin:$PATH | ||
|
||
:wq | ||
source ~/.bashrc | ||
|
||
# install cnpm | ||
|
||
npm install -g cnpm --registry=https://registry.npm.taobao.org | ||
|
||
# nodejs gprc install | ||
|
||
cnpm install grpc-tools -g | ||
cnpm install google-protobuf -g | ||
cnpm install grpc -g | ||
|
||
# nodejs generate code | ||
|
||
sh bin/nodejs-generate.sh | ||
|
||
# nodejs client run | ||
|
||
cd gmicro/example/clients/nodejs | ||
cnpm install | ||
node hello.js | ||
{ | ||
wrappers_: null, | ||
messageId_: undefined, | ||
arrayIndexOffset_: -1, | ||
array: [ 'hello,heige', 'call ok' ], | ||
pivot_: 1.7976931348623157e+308, | ||
convertedPrimitiveFields_: {} | ||
} | ||
call ok | ||
hello,heige |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
{ | ||
"devDependencies": { | ||
"grpc-tools": "^1.7.3" | ||
}, | ||
"dependencies": { | ||
"google-protobuf": "^3.8.0", | ||
"grpc": "^1.24.3", | ||
"node-pre-gyp": "^0.15.0" | ||
"google-protobuf": "^3.20.1", | ||
"grpc": "^1.24.11", | ||
"grpc-tools": "^1.11.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
module github.com/daheige/gmicro | ||
|
||
go 1.13 | ||
go 1.16 | ||
|
||
require ( | ||
github.com/golang/protobuf v1.5.2 | ||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 | ||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 | ||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 | ||
github.com/prometheus/client_golang v1.11.0 | ||
github.com/stretchr/testify v1.7.0 | ||
golang.org/x/net v0.0.0-20210614182718-04defd469f4e | ||
google.golang.org/genproto v0.0.0-20210617175327-b9e0b3197ced | ||
google.golang.org/grpc v1.38.0 | ||
google.golang.org/protobuf v1.27.1 | ||
github.com/prometheus/client_golang v1.12.2 | ||
github.com/stretchr/testify v1.7.1 | ||
golang.org/x/net v0.0.0-20220513224357-95641704303c | ||
google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3 | ||
google.golang.org/grpc v1.46.2 | ||
google.golang.org/protobuf v1.28.0 | ||
) |
Oops, something went wrong.