The state of Ruby on Google Cloud Platform

By Aja Hammerly, Developer Advocate

At Google Cloud Next ’17 last month we announced that App Engine flexible environment is now generally available. This brings the convenience of App Engine to Rubyists running Rails, Sinatra or other Rack based web frameworks.

One question we frequently get is, “Can I run gems like nokogiri or database adapters that have C extensions on App Engine?” and the answer is yes. We tested the top 1000 Ruby libraries, a.k.a., gems, to ensure that the necessary dependencies are available. We also tested common tools like paperclip that don’t build against C libraries but require them at runtime. And we know that people are using different versions of Ruby and Rails; App Engine obeys .ruby-version and we support all currently supported versions of MRI. We’ve also tested the gems with Rails 3, Rails 4 and Rails 5. At Next we also announced that Postgres on Cloud SQL is in beta. All of these things should make it easier to move your Rails and Sinatra applications to App Engine. More info on using Ruby on Google Cloud Platform (GCP) is available at http://cloud.google.com/ruby.

New gems on tap
We also have three gems that have reached general availability for the following products: Stackdriver Logging, Google Cloud Datastore and Google Cloud Storage. In addition there are three gems currently in beta for Google BigQuery, Google Cloud Translation API and Google Cloud Vision API. Our philosophy when working on the gems has been to embrace the Ruby ethos that programming should be fun. We try to make our gems idiomatic and make sense to Rubyists. For example, our logging library provides a drop-in replacement for the standard Ruby logger:

require “google/cloud/logging”

logging = Google::Cloud::Logging.new
logger = logging.logger “my_app_log”, resource, env: :production

logger.info “Job started”
logger.info { “Job started” }
logger.debug?

With the Cloud Datastore gem, creating entities is similar to creating tables using ActiveRecord. And with Cloud Storage, you can upload files or you can upload Ruby IO Objects. Using our products should not add significant cognitive load to your development tasks. And having a philosophy of “By Rubyists for Rubyists” makes that easier to do.

RailsConf
If you want to try out some of these libraries or spin up an application on App Engine, come find us at RailsConf 2017 in Phoenix, Arizona later this month. We’re proud to be a Gold sponsor again this year. Based on feedback from last year, we’re making our booth more interactive with codelabs, demos and of course even more stickers.

We also have three folks from the Google Ruby team giving talks. Daniel Azuma’s talk, “What’s my app really doing in production” will show you tools and tricks to instrument and debug misbehaving apps. Remi Taylor’s talk, “Google Cloud >3 Ruby,” will teach you about all the different tools we have for Ruby developers. Finally, in my talk, “Syntax isn’t everything: NLP for Rubyists,” I use the Google Cloud Natural Language API library and some stupid Ruby tricks to introduce you to natural language processing. If you’ll be at RailsConf we really hope you’ll come say hi.
Quelle: Google Cloud Platform

Published by