mirror of
https://github.com/php-win-ext/grpc.git
synced 2026-03-24 09:02:15 +01:00
* replace darwin checks in extconf.rb to exclude TruffleRuby * inherit RANLIB and STRIP from RbConfig, set LDXX * enable overriding ranlib command in top-level makefile * ensure the -no_warning_for_no_symbols flag is only used with Apple's ranlib * don't embed openssl & zlib on truffleruby * add RbConfig's cppflag to CPPFLAGS when using TruffleRuby * this ensure the paths to find the system's OpenSSL are set up correctly with TruffleRuby (includes being able to find an OpenSSL installed via Homebrew etc) * don't statically link standard libraries on Linux with Truffleruby * This does not work when compiling to bitcode. * Prefer SIGTERM to SIGQUIT for graceful shutdown in examples * Overriding SIGQUIT is suboptimal, for example on JVM where it is very useful to dump the thread stacktraces. * Keep the rb_tr_abi_version symbol for TruffleRuby in grpc_c.so * Otherwise TruffleRuby cannot verify the ABI version is correct. * See https://github.com/oracle/truffleruby/issues/2386 * Use RbConfig::CONFIG['STRIP'] instead of just `strip` * Use a local variable for apple_toolchain for consistency * Add a comment about -static-libgcc -static-libstdc++ and TruffleRuby * Split comment into two for openssl/zlib Co-authored-by: Nicolas Laurent <nicolas.laurent@oracle.com>
gRPC in 3 minutes (Ruby)
BACKGROUND
For this sample, we've already generated the server and client stubs from helloworld.proto
PREREQUISITES
-
Ruby 2.x This requires Ruby 2.x, as the gRPC API surface uses keyword args. If you don't have that installed locally, you can use RVM to use Ruby 2.x for testing without upgrading the version of Ruby on your whole system. RVM is also useful if you don't have the necessary privileges to update your system's Ruby.
$ # RVM installation as specified at https://rvm.io/rvm/install $ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 $ \curl -sSL https://get.rvm.io | bash -s stable --ruby=ruby-2 $ $ # follow the instructions to ensure that your're using the latest stable version of Ruby $ # and that the rvm command is installed -
N.B Make sure your run
source $HOME/.rvm/scripts/rvmas instructed to complete the set-up of RVM.
INSTALL
-
Use bundler to install the example package's dependencies
$ # from this directory $ gem install bundler # if you don't already have bundler available $ bundle install
Try it!
-
Run the server
$ # from this directory $ bundle exec ./greeter_server.rb & -
Run the client
$ # from this directory $ bundle exec ./greeter_client.rb
Tutorial
You can find a more detailed tutorial in gRPC Basics: Ruby