blob: 66647fd6cfca30dc3a7bedaa40c597bf25e33a97 [file] [log] [blame] [view]
Tim Emiolaeb158ff2015-02-21 06:29:53 -08001gRPC in 3 minutes (Ruby)
2========================
Tim Emiola49f3ccd2015-02-19 11:09:19 -08003
Dan Cirulibc4b1ce2015-02-25 15:22:58 -08004BACKGROUND
5-------------
6For this sample, we've already generated the server and client stubs from [helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto).
7
Tim Emiolaeb158ff2015-02-21 06:29:53 -08008PREREQUISITES
9-------------
Tim Emiola49f3ccd2015-02-19 11:09:19 -080010
Tim Emiolaeb158ff2015-02-21 06:29:53 -080011This requires Ruby 2.1, as the gRPC API surface uses keyword args.
Tim Emiola5b5e1462015-02-25 04:18:56 -080012If you don't have that installed locally, you can use [RVM](https://www.rvm.io/) to use Ruby 2.1 for testing without upgrading the version of Ruby on your whole system.
Tim Emiola8af51752015-02-26 02:04:15 -080013RVM is also useful if you don't have the necessary privileges to update your system's Ruby.
Tim Emiola5b5e1462015-02-25 04:18:56 -080014```sh
Tim Emiola8af51752015-02-26 02:04:15 -080015$ # RVM installation as specified at https://rvm.io/rvm/install
16$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Tim Emiola5b5e1462015-02-25 04:18:56 -080017$ \curl -sSL https://get.rvm.io | bash -s stable --ruby=ruby-2.1
18$
19$ # follow the instructions to ensure that your're using the latest stable version of Ruby
20$ # and that the rvm command is installed
21```
Tim Emiola8af51752015-02-26 02:04:15 -080022- *N.B* Make sure your run `source $HOME/.rvm/scripts/rvm` as instructed to complete the set-up of RVM.
Tim Emiola5b5e1462015-02-25 04:18:56 -080023
Tim Emiola49f3ccd2015-02-19 11:09:19 -080024INSTALL
25-------
26
27- Clone this repository.
Tim Emiola5828df62015-02-26 12:57:10 -080028
29- Download the grpc debian packages from the [latest grpc release](https://github.com/grpc/grpc/releases) and install them.
30 - Later, it will possible to install them directly using `apt-get install`
31```sh
32$ wget https://github.com/grpc/grpc/releases/download/release-0_5_0/libgrpc_0.5.0_amd64.deb
33$ wget https://github.com/grpc/grpc/releases/download/release-0_5_0/libgrpc-dev_0.5.0_amd64.deb
34$ sudo dpkg -i libgrpc_0.5.0_amd64.deb libgrpc-dev_0.5.0_amd64.deb
35```
36
37- Use bundler to install the example package's dependencies
Tim Emiola49f3ccd2015-02-19 11:09:19 -080038```sh
39$ # from this directory
Tim Emiola5828df62015-02-26 12:57:10 -080040$ gem install bundler # if you don't already have bundler available
41$ bundle install
Tim Emiola49f3ccd2015-02-19 11:09:19 -080042```
43
Tim Emiolaeb158ff2015-02-21 06:29:53 -080044Try it!
45-------
Tim Emiola49f3ccd2015-02-19 11:09:19 -080046
47- Run the server
48```sh
49$ # from this directory
50$ bundle exec ./greeter_server.rb &
51```
52
53- Run the client
54```sh
55$ # from this directory
56$ bundle exec ./greeter_client.rb
57```
Tim Emiolac66fe1e2015-02-26 03:53:16 -080058
59Tutorial
60--------
61
62You can find a more detailed tutorial in [gRPC Basics: Ruby](https://github.com/grpc/grpc-common/blob/master/ruby/route_guide/README.md)