Running Rails on Google Cloud Platform

It's easy to get started developing Ruby on Rails apps that run on Google Cloud Platform. And because the apps you create will run on the same infrastructure that powers all of Google's products, you can be confident that they will scale to serve all of your users, whether there are a few or millions of them.

Hosting platforms

There are three main options for deploying Rails on Cloud Platform.

Rails deployment option Use if you want Don't use if you need Get started
Google App Engine Flexible Environment
  • Most of the advantages of App Engine
  • System libraries and RubyGems that depend on them
  • Custom Docker runtimes
  • You need total control over the underlying virtual machines.
Rails on App Engine Flexible Environment
Google Container Engine
  • Rails containers in a microservice environment
  • A toolkit to design your own container-based platform
  • A fully-featured platform as a service. For a container-based PaaS, consider flexible environment.
Rails on Container Engine
Google Compute Engine
  • Familiar infrastructure as a service using VMs
  • Windows VMs
  • A serverless environment without the need to configure your own infrastructure
Rails in Compute Engine

Databases

Relational databases

Rails ActiveRecord works best with a traditional SQL database. If you are starting a new project, Google Cloud SQL is a good choice. With a few clicks you can create a database that is fully managed and scaled by Google, with no management on your end. You can learn more by reviewing our Using Cloud SQL with Rails 5 tutorial.

You can also use other SQL databases like PostgreSQL if you're willing to manage them yourself on Compute Engine or another service. You can learn more by reviewing our Rails Bookshelf tutorial using PostgresSQL which uses PostgresSQL. For a click-to-deploy enterprise PostgreSQL database on Compute Engine, consider EDB Postgres Enterprise. For a managed PostgreSQL service hosted outside of Google, consider ElephantSQL.

NoSQL databases

In many situations, there are compelling reasons to use a NoSQL database, for example, scalability or suitability for your data model. Although using Rails models with a NoSQL database can be challenging, it is possible with some limitations. For example, many types of database joins can be expressed in Rails, but are not supported by Cloud Datastore and other NoSQL databases like MongoDB. You can learn more by reviewing our Rails Bookshelf tutorial using Datastore, which uses Datastore as its non-relational database. For a managed, massively-scalable NoSQL solution, consider Cloud Datastore , which is a non-relational database that often scales better than a SQL solution.

If you choose to use MongoDB, you can deploy it using Cloud Launcher and do your own management, or you can use the managed MongoDB hosting service provided by mLab.

Caches

To install Memcached on Compute Engine, you can use Cloud Launcher. To install Memcached on either Compute Engine or Container Engine, you can use the Memcached Docker image. Similarly, you can install Redis by using Cloud Launcher or the Redis docker image.

Send feedback about...