Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
5ebf8807
Commit
5ebf8807
authored
10 years ago
by
Tim Emiola
Browse files
Options
Downloads
Patches
Plain Diff
Replaces grpc_launch_server with grpc_launch_servers
parent
f2c8901f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/gce_setup/grpc_docker.sh
+44
-36
44 additions, 36 deletions
tools/gce_setup/grpc_docker.sh
with
44 additions
and
36 deletions
tools/gce_setup/grpc_docker.sh
+
44
−
36
View file @
5ebf8807
...
...
@@ -590,7 +590,7 @@ grpc_sync_images() {
done
}
grpc_launch_server_args
()
{
_
grpc_launch_server
s
_args
()
{
[[
-n
$1
]]
&&
{
# host
host
=
$1
shift
...
...
@@ -598,55 +598,63 @@ grpc_launch_server_args() {
echo
"
$FUNCNAME
: missing arg: host"
1>&2
return
1
}
[[
-n
$1
]]
&&
{
# server_type
case
$1
in
cxx
)
grpc_port
=
8010
;;
go
)
grpc_port
=
8020
;;
java
)
grpc_port
=
8030
;;
node
)
grpc_port
=
8040
;;
python
)
grpc_port
=
8050
;;
ruby
)
grpc_port
=
8060
;;
*
)
echo
"bad server_type:
$1
"
1>&2
;
return
1
;;
esac
docker_label
=
"grpc/
$1
"
docker_name
=
"grpc_interop_
$1
"
shift
[[
-n
$1
]]
&&
{
servers
=
"
$@
"
}
||
{
echo
"
$FUNCNAME
: missing arg: server_type"
1>&2
return
1
servers
=
"cxx java go node ruby"
echo
"
$FUNCNAME
: no servers specified, will launch defaults '
$servers
'"
}
}
# Launches
a
server on a docker instance.
# Launches server
s
on a docker instance.
#
# call-seq;
# grpc_launch_server <server_name> <server_type>
# grpc_launch_servers <server_name> [server1 server2 ...]
# E.g
# grpc_launch_server grpc-docker-server ruby node
#
# Runs the server_type on a GCE instance running docker with server_name
grpc_launch_server
()
{
# Restarts all the specified servers on the GCE instance <server_name>
# If no servers are specified, it launches all known servers
grpc_launch_servers
()
{
# declare vars local so that they don't pollute the shell environment
# where they this func is used.
local
grpc_zone grpc_project dry_run
# set by _grpc_set_project_and_zone
# set by grpc_launch_server_args
local
docker_label docker_name host grpc_port
# set by grpc_launch_server
s
_args
local
servers
# set the project zone and check that all necessary args are provided
_grpc_set_project_and_zone
-f
grpc_launch_server_args
"
$@
"
||
return
1
_grpc_set_project_and_zone
-f
_
grpc_launch_server_args
"
$@
"
||
return
1
gce_has_instance
$grpc_project
$host
||
return
1
;
cmd
=
"sudo docker kill
$docker_name
> /dev/null 2>&1; "
cmd+
=
"sudo docker rm
$docker_name
> /dev/null 2>&1; "
cmd+
=
"sudo docker run -d --name
$docker_name
"
cmd+
=
" -p
$grpc_port
:
$grpc_port
$docker_label
"
local
project_opt
=
"--project
$grpc_project
"
local
zone_opt
=
"--zone
$grpc_zone
"
local
ssh_cmd
=
"bash -l -c
\"
$cmd
\"
"
echo
"will run:"
echo
"
$ssh_cmd
"
echo
"on
$host
"
[[
$dry_run
==
1
]]
&&
return
0
# don't run the command on a dry run
gcloud compute
$project_opt
ssh
$zone_opt
$host
--command
"
$cmd
"
# launch each of the servers in turn
for
server
in
$servers
do
local
grpc_port
case
$server
in
cxx
)
grpc_port
=
8010
;;
go
)
grpc_port
=
8020
;;
java
)
grpc_port
=
8030
;;
node
)
grpc_port
=
8040
;;
python
)
grpc_port
=
8050
;;
ruby
)
grpc_port
=
8060
;;
*
)
echo
"bad server_type:
$1
"
1>&2
;
return
1
;;
esac
local
docker_label
=
"grpc/
$server
"
local
docker_name
=
"grpc_interop_
$server
"
cmd
=
"sudo docker kill
$docker_name
> /dev/null 2>&1; "
cmd+
=
"sudo docker rm
$docker_name
> /dev/null 2>&1; "
cmd+
=
"sudo docker run -d --name
$docker_name
"
cmd+
=
" -p
$grpc_port
:
$grpc_port
$docker_label
"
local
project_opt
=
"--project
$grpc_project
"
local
zone_opt
=
"--zone
$grpc_zone
"
local
ssh_cmd
=
"bash -l -c
\"
$cmd
\"
"
echo
"will run:"
echo
"
$ssh_cmd
"
echo
"on
$host
"
[[
$dry_run
==
1
]]
&&
return
0
# don't run the command on a dry run
gcloud compute
$project_opt
ssh
$zone_opt
$host
--command
"
$cmd
"
done
}
# Runs a test command on a docker instance.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment