gRPC microservice that converts a timestamp into a target IANA timezone, matching the Java implementation.
- Ruby 3.2+ (3.3.7 recommended; see
.ruby-version) - Bundler (
gem install bundler) - grpcurl for manual calls and load tests (
brew install grpcurl)
System Ruby (2.6) is too old. Use Homebrew or rbenv:
# Option A — Homebrew
brew install ruby
export PATH="/usr/local/opt/ruby/bin:$PATH" # Intel
# export PATH="/opt/homebrew/opt/ruby/bin:$PATH" # Apple Silicon
# Option B — rbenv
brew install rbenv ruby-build
rbenv install 3.3.7
rbenv global 3.3.7gem install bundler
bundle install
bundle exec rake test # generates proto stubs, runs RSpec
bundle exec rake server # or: bundle exec ruby -I lib lib/server.rbServer listens on port 8080 by default (PORT env overrides).
./curl.shStart the server, then in another terminal:
# Light smoke
DURATION_SECONDS=30 CONCURRENCY=8 ./simulate_traffic.sh
# Run on another port when Node/Java use 8080
PORT=8081 bundle exec rake server
HOST=localhost:8081 DURATION_SECONDS=10 CONCURRENCY=4 ./simulate_traffic.sh| Item | Value |
|---|---|
| Service | timezone.TimeZoneConverter |
| Method | ConvertTime |
| Port | 8080 (plaintext gRPC) |
Golden example: 2024-12-04T15:00:00Z + America/New_York → 2024-12-04T10:00:00-05:00
proto/api.proto— gRPC contractlib/time_converter.rb— conversion logic (TZInfo)lib/time_zone_converter_service.rb— RPC handlerlib/server.rb— server entrypointlib/timezone/proto/— generated protobuf/gRPC stubs (rake proto)
| Task | Description |
|---|---|
rake proto |
Generate Ruby stubs from proto/api.proto |
rake test |
Proto gen + RSpec |
rake server |
Start gRPC server |