Talks

Summarized using AI

Google Cloud Love Ruby

Remi Taylor • April 25, 2017 • Phoenix, AZ

In the talk "Google Cloud Love Ruby," Remi Taylor, a developer programs engineer at Google Cloud, presents the improvements and offerings for Ruby developers using the Google Cloud Platform (GCP). The session highlights key resources and tools built specifically for Ruby applications within the GCP environment, aiming to ease deployment, debugging, and scaling processes.

Key Points Discussed:

- Introduction of Ruby Team at Google Cloud: A dedicated team, known as Rubeus, has been established to improve the experience for Ruby developers on GCP. They focus on building Ruby libraries and tools to reduce friction for developers.

- Ruby Client Libraries: Taylor emphasizes the creation of over 15 Ruby client libraries for various GCP services, such as Google Cloud Storage and Cloud Vision API, and how these libraries incorporate Ruby idioms and conventions.

- Deployment with App Engine: The session covers the deployment of Ruby on Rails applications on Google App Engine, illustrating how developers can easily deploy and manage their apps, benefitting from automatic scaling and built-in logging facilities.

- Google Cloud SDK: Developers are guided on how to set up the Google Cloud SDK, which provides command-line tools to facilitate interactions with GCP resources. They can use commands like gcloud app deploy to manage their applications.

- Debugging Tools: Taylor introduces Stackdriver, a suite for monitoring and logging applications. It includes error reporting, logging, and performance tracing, allowing developers to effectively troubleshoot their applications.

- Conclusion and Resources: The speaker encourages the audience to visit cloud.google.com/ruby for essential documentation and resources. He invites developers to contribute to the open-source Ruby libraries on GitHub, emphasizing the collaborative nature of improving these tools.

Overall, this talk demonstrated Google Cloud's commitment to enhancing the developer experience for Ruby users and provided practical insights into leveraging GCP's capabilities effectively.

Google Cloud Love Ruby
Remi Taylor • April 25, 2017 • Phoenix, AZ

Google Cloud Love Ruby by Remi Taylor

This is a sponsored talk by Google Cloud Platform.

Ruby developers welcome! Our dedicated Google Cloud Platform Ruby team has built a great experience for Ruby developers using GCP. In this session, we'll walk through the steps to deploy, debug and scale a Ruby on Rails application on Google App Engine. You'll also learn about some of the exciting Ruby libraries available today for adding features to your app with GCP services like BigQuery and Cloud Vision API.

RailsConf 2017

00:00:11.929 Great everyone! Thank you for coming. I apologize for starting a little late. The last time I gave this talk, it ran about an hour, and we have about 25 minutes left, so hopefully we’ll be okay.
00:00:17.640 I’ve squished it a bit but added some new content. Thank you again for coming. This is Google Cloud Platform Loves Ruby.
00:00:25.230 Because we do! And of course, you’re here in the sponsor track, so this talk is brought to you by Google Cloud Platform, the most favored cloud platform according to me.
00:00:32.969 Hi, I’m Remi Taylor. I’m a developer programs engineer working in DevRel for Google Cloud. If you didn’t guess, I’m a Rubyista.
00:00:39.739 Fun fact: I’m also from Phoenix! Are there any Phoenix Rubyists here? I’m just curious. A couple? Okay, great! I did my first Rails up here and many other things.
00:01:00.539 So it’s really good to see you all. This is a sponsor talk. I appreciated putting in the program that "Ruby developers are welcome" for my RailsConf talk. Because I reused this abstract, Ruby developers are definitely welcome.
00:01:16.740 What we’re going to talk about is this: we have put together a dedicated Ruby team at Google Cloud. A lot of people are surprised to hear that we have a Ruby team, but we do! And it’s been growing over the past two years. We’ve gathered a diverse set of engineers and product managers, and our goal, our mandate if you will, is to make the experience for Rubyists on Google Cloud as good as possible.
00:01:43.140 We use the cloud all the time; we call our API for Google Cloud and deploy our Ruby code. We work on eliminating any friction to make that experience the best possible. What that has looked like is building a number of resources, including Ruby libraries. We're going to spend much of the first part of this talk focusing on those.
00:02:11.400 We'll also look at App Engine, which is one of the many places where you can deploy your Ruby code. And we'll discuss debugging. Once your Ruby code is up and running, how do you maintain it? If there's one takeaway I’d like you all to have today, it’s cloud.google.com/ruby. You’ll see this printed on the back of our t-shirts at our GCP booth, which I highly recommend checking out.
00:02:34.319 Please feel free to inundate us with any questions! We have been compiling articles and resources on this site to help people get started, so it’s a good jumping-off point, and we continue to add more information.
00:03:02.280 Today, I’ll walk through some libraries we’ve spent a lot of time on.
00:03:07.410 Google Cloud has a lot of products. I couldn’t fit them all on the screen due to my OCD, but a lot of these products have powerful APIs. I want Rubyists to find it as easy as possible to call out to these APIs.
00:03:25.410 For Ruby, we’ve put together a number of client libraries. I’ve highlighted about 15 of them available today. You can go and use them, and please provide us with feedback. What does it look like to use one of these? Let me get you started.
00:03:56.519 If you tell us to use an API, we’re probably going to look for a gem. For instance, if we want to use Google Cloud Storage, which is one of our products, it’s essentially a file object store. You’d install the Google Cloud Storage gem, and for a lot of our other Google Cloud products, you would install gems like Google Cloud Vision, Google Cloud Speech, and so on.
00:04:16.229 Now, let me show you what we’re going to do with our code example to get started. What I have open here is the Google Cloud console. If you’re using Google Cloud, you’ll be here a lot.
00:04:43.539 Right now, I have the storage browser open. In Cloud Storage, we manage our files in buckets. Here, we’re browsing one of them called "my cat pictures." As you can see, it says there aren’t any objects in this bucket.
00:05:03.610 So, let’s fix that right now. Presuming you have the Google Cloud Storage gem installed or included in your gem file, your Ruby code will look like this.
00:05:25.710 We’ll require Google Cloud Storage just like the gem. Pretty simple! Additionally, we need some kind of service object to make our calls to the API. We will create a storage object using Google Cloud Storage.
00:05:58.400 If you want to add a file to that bucket, you can use the bucket.new_file method. Assuming you have the file "my_cat.png," that will work! It’s a cool feature that I want to highlight today.
00:06:25.630 You see, we Rubyists love our idioms. If you don’t want to call new_file because you prefer a different method name, you don’t have to! You could use create_file or upload_file. If anyone saw DHHS’ keynote yesterday, he talked a lot about Ruby’s belief systems.
00:06:51.780 For instance, we prefer to have multiple ways to achieve something. We love using aliases. As Rubeus, who made these client libraries, you’ll notice plenty of Ruby idioms in there because we want to use those ourselves.
00:07:19.150 For example, if you don’t want to pass a file string like a path, you can pass a Ruby file object. It’s a typical Ruby approach to treat that as an I/O stream.
00:07:39.490 Alternatively, if you want to pass a string, you can use something called il, which essentially tricks the system into treating it like a file.
00:08:10.410 These are the kinds of very Ruby-like things we do. Once we’ve done that, we have our cat picture, and the world is a great place again... it would be even better if it were a dog.
00:08:38.060 I want to point you to a couple of places where you can get up and running with these client libraries. All of our client libraries are open source on GitHub, hosted in the Google Cloud Platform organization.
00:09:10.750 Yes, we are accepting contributions! Please send us your pull requests or file issues. We love receiving feedback, and many times, we’ve made updates based on user suggestions.
00:09:43.679 For example, we made recent changes after user reported issues. We’re focused on enhancing the developer experience.
00:10:00.960 This is our GitHub page for all the client libraries. I spend a lot of my day job using these libraries and gathering feedback on them. We have new libraries coming out continuously, and the APIs are frequently evolving.
00:10:23.160 If you’re searching for where to get help with the methods and usage, you’ll find solid documentation to assist your learning curve. And if you’re managing products in Google Cloud Vision, don’t forget our product pages.
00:10:48.360 These client libraries pages will provide you with a comprehensive guide on using our products. Every page summarizes everything you need to know, including authentication methods.
00:11:06.739 You’ll need to install a tool and set up authentication the first time you call out to the APIs. You’ll do this once, and it’s all here, complete with code snippets and links.
00:11:42.960 The great thing about our client libraries is we aim to keep them consistent, so if you learn one library, switching to any others should be easy.
00:12:03.510 Here’s an example using storage. To remind you, we require storage, then create a client and a bucket to loop through files.
00:12:29.880 Here’s a different product, our NoSQL database solution, Datastore. We create a service, run a query, and loop over the results to display the names of dogs. Simple!
00:12:53.390 Next, we’re managing DNS entries. We grab a zone from the DNS service and print out the records.
00:13:16.210 In Pub/Sub, we retrieve a subscription. Whenever you publish messages to a topic, they get pushed to subscriptions. A common use case is to listen to a subscription and process messages for background jobs.
00:13:38.360 Take a look at some machine learning APIs as well! One of my colleagues will discuss natural language processing later today right here.
00:13:56.950 We’re taking sentences or even full documents and calling our language API to gather sentiments for each sentence.
00:14:11.870 Look at how easy it is to upload an audio file and get the text detected by our speech API. Just upload an image of your dog, and you'll get labels like dog, golden retriever, mammal, etc.
00:14:28.920 For our vision API, a similar process is used to identify landmarks. The results include latitude and longitude.
00:14:49.870 I love how straightforward and idiomatic these libraries are.
00:15:07.460 For our Datastore, the query you saw was simple. Here’s a more complex one that resembles code interchanges we use with SQL or NoSQL document stores.
00:15:42.480 A cool DSL we have for DNS allows you to add an A record for a subdomain to an IP or change MX records and manage TTLs.
00:16:01.240 When we started using our logging solutions, we realized our Ruby applications utilized the standard Ruby logger. Thus, we changed our logging client library from the custom API methods to provide a standard Ruby logger.
00:16:23.470 This is just another great example of what we can achieve when Rubeus use these products and feel the friction.
00:16:42.160 I want to end by discussing BigQuery, which has datasets with tables. If you’re familiar with Rails, the syntax looks similar to ActiveRecord migrations. This is the syntax for our migrations.
00:17:03.650 We've come a long way since 2009, when I first gave a talk about running Ruby on App Engine. Back then, App Engine primarily used Java.
00:17:26.220 Using JRuby, it was interesting to see how I ran my Ruby in an environment that hadn’t been made for it.
00:17:44.000 Nine years later, we are more equipped. If you want full control, you can use Compute Engine for full virtual machines.
00:18:03.900 If you’re using containers and Docker, you’ll want to try Google Container Engine, which is Google's hosted Kubernetes.
00:18:41.990 What I want to focus on is App Engine, as I’m an app developer. I want to hand over my application to Google and have it managed.
00:19:05.020 The new App Engine flexible environment supports multiple languages including the Ruby runtime.
00:19:23.710 Today, I can run my Ruby on App Engine and still benefit from all the scaling capabilities.
00:19:40.700 If you want to get started, we have tutorials for using Ruby on App Engine, along with Compute Engine and Container Engine.
00:20:30.420 If you haven’t yet logged into Google Cloud Console, go ahead and create an account, make a project, and start associating resources.
00:21:01.090 Install the Google Cloud SDK, which provides the gcloud command line tool, enabling interaction with our cloud products.
00:21:20.950 Once everything is set, it could be a Rails app or a simple Rack application, use gcloud to deploy your app. It'll recognize it as a Ruby application and provide deployment instructions.
00:21:48.110 After a few moments, your app is deployed! From there, you'll want to tackle actual pain points that you encounter in production.
00:22:10.800 One of the first things you'll likely need is to specify the Ruby version, which can be done easily using a ruby version file.
00:22:54.090 Installing gems is another common challenge. To minimize the pain, we ensured that the top 1000 most downloaded Ruby gems install successfully on our runtimes.
00:23:17.490 If you need to install something custom, use the gcloud app gen config custom command, which generates a Dockerfile for your app.
00:23:52.060 Remember, App Engine flexible is Docker-based, so you can take your Docker runtime to other environments if you choose.
00:24:16.950 When you deploy and after getting your Hello World up, the documentation for the Ruby runtime should be your next stop.
00:24:41.040 There, you’ll find guidance on setting Ruby versions, making custom Dockerfiles, and handling SSH connections to your app.
00:25:12.690 The documentation also covers FAQs, such as managing traffic between versions.
00:25:34.450 As your application runs, issues may arise. For debugging, I recommend our Stackdriver suite of tools for logging and reporting.
00:26:05.660 Remember, after deploying your app with gcloud, you can quickly access logs through the console or via the command line.
00:26:27.390 By default, we log standard output and standard error, so you can track your app's activity and identify any exceptions.
00:26:54.640 To improve error reporting, I recommend integrating Stackdriver. Simply include the stackdriver gem in your Gemfile and redeploy.
00:27:20.540 Once deployed, you should notice enhanced error visibility, including severity levels.
00:27:47.960 When errors occur, pulling up the Stackdriver dashboard gives you an overview of the exceptions encountered.
00:28:11.180 Clicking through lets you see detailed information about occurrences and analyze how to resolve them.
00:28:40.560 Lastly, notice that error logs are linked to source code, allowing efficient trace debugging.
00:29:06.390 Another significant bonus to having the stackdriver gem installed is the latency tracing to gain insight into processing times.
00:29:30.580 I’ve covered many tools and methods here today, and I encourage you to explore Stackdriver further.
00:29:58.920 Be sure to check out cloud.google.com/ruby for documentation, GitHub for libraries, and helpful resources.
00:30:19.920 Shoutouts to the team! There will be valuable sessions coming up, like natural language processing; don’t miss them.
00:30:36.870 Thank you for your time! I’m open for questions.
00:31:23.680 One question: do we offer tools for existing orchestration tools like Chef? Currently, we rely on the open-source community for that but are open to contributions.
00:32:09.510 Another question: how tightly is Stackdriver integrated with Google products? Not tightly! It can be used across different cloud platforms. Just check the integration guides.
00:33:47.480 As we wrap up, what are the pricing details? Pricing is based on compute hours and usage. You can find more specifics on our billing pages.
00:34:15.090 It took time for Ruby to get integrated into App Engine due to prioritization, but we’re excited by the availability of Docker now.
00:34:37.470 Lastly, check out our booth, where you can find us wearing Google Cloud shirts with the ruby logos. Thank you!
Explore all talks recorded at RailsConf 2017
+109