-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·56 lines (42 loc) · 1.77 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
FILE=gsvc
if [ -f $FILE ]; then
echo "
------------------------------------------------------
-- Building update.
------------------------------------------------------
"
else
echo "
------------------------------------------------------
-- README FIRST TO GET IT WORKING
------------------------------------------------------
Install protobuf compiler...
$ sudo apt-get install autoconf automake libtool curl make g++ unzip #!!! THIS will work on debian/ubuntu
$ git clone https://github.com/google/protobuf
$ cd protobuf
$ ./autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig
Install the protoc Go plugin
$ go get -u github.com/golang/protobuf/protoc-gen-go
Rebuild the generated Go code
$ protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld
"
fi
#Generate certificates for gRPC
#Common Name (e.g. server FQDN or YOUR name) []:backend.local
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./backend.key -out ./backend.cert -subj "/C=US/ST=San Francisco/L=San Francisco/O=SFPL/OU=IT Department/CN=backend.local"
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./frontend.key -out ./frontend.cert -subj "/C=US/ST=San Francisco/L=San Francisco/O=SFPL/OU=IT Department/CN=frontend.local"
#go generate github.com/dioptre/gtrpc/proto
protoc -I proto/ proto/helloworld.proto --go_out=plugins=grpc:proto/
#Build client & server
go get ./service/ ./client/
go build -o gsvc -tags netgo service/service.go
go build -o gcli -tags netgo client/client.go
./gsvc # & ./gcli
#Not used
#go get -u github.com/celrenheit/sandglass-client/go/sg