# Deploying a Rails App Using HatchBox onto Google Cloud Platform

DevFeed: [Deploying a Rails App Using HatchBox onto Google Cloud Platform](<https://devfeed.tech/articles/deploying-a-rails-app-using-hatchbox-onto-google-cloud-platform-28268.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2020/03/22/deploying-a-rails-app-using-hatchbox-onto-google-cloud-platform.html>)

Author: Fuzzygroup

Published: 2020-03-22T00:00:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [Google Cloud Platform (GCP)](<https://devfeed.tech/topics/google-cloud.md>), [cloud-sql](<https://devfeed.tech/topics/cloud-sql.md>)

Tags: [cloud-sql](<https://devfeed.tech/tags/cloud-sql.md>), [digital-ocean](<https://devfeed.tech/tags/digital-ocean.md>), [gcp](<https://devfeed.tech/tags/gcp.md>), [git](<https://devfeed.tech/tags/git.md>), [google-cloud-platform](<https://devfeed.tech/tags/google-cloud-platform.md>), [hatchbox](<https://devfeed.tech/tags/hatchbox.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [rails](<https://devfeed.tech/tags/rails.md>), [redis](<https://devfeed.tech/tags/redis.md>)

## AI overview

The post describes deploying the Rails app CovidNearMe to GCP with HatchBox: create a cluster using "Somewhere Else" and "Everything on a Single Server," enter the server IPs, and provision it by running HatchBox's SSH command as root. The author reports a provisioning issue that required adding local Redis back to the Roles list, even when using GCP Redis. Then create an app linked to the cluster and Git repository; for Cloud SQL, configure an external PostgreSQL URL. The initial deployment is HTTP only; HTTPS requires assigning a domain, while the SSL setup is deferred to a future post. The author also says GCP SSH access must allow the HatchBox deployment engine's IP, which the post gives as 94.53.199.250 as of March 24, 2020.

## Source excerpt

This blog post is a quickie where I document how I deployed CovidNearMe onto Google Cloud Platform or GCP using HatchBox.io. I need to start by giving a huge shout out to Tony Carnevale from Google who went above and beyond in providing outstanding support. Here are the stages. Stage 1: Create a Cluster Note: Even a single machine is considered a cluster. Go to HatchBox.io Login with your account. Click on Clusters and define a New Cluster. Name the cluster GCP Covid Near Me (or that's what I did). Select Somewhere Else as the hosting provider. Select the Everything on a Single Server option. If you are using the GCP Cloud SQL (postgresql) and GCP Redis then remove these options from the Roles list. Enter the IP address under public ip. Set the private IP to 127.0.0. There appears to be a bug where you can't provision the server unless a local redis installation is selected so add it back. Click provision the server and you will be given an SSH command to run as root on the box. You SSH in, do a sudo su, execute the command and exit out You click Test / Provision (I forget which) and your server will be flawlessly setup. Stage 2: Create an App on the Cluster Click on Apps. Click on Create a New App. Choose the cluster from the drop down list. Click on your git repo host. Set the name of your application (I like to include the name of the cluster with the app name since this app is already deployed to digital ocean). Enter the name of the repo (easily find this from .git/config in your Rails root directory). Set external host for the database if you are using Google's Cloud SQL. This means that you need to define a postgres configuration url. The format for this url is this: postgresql://user:password@databasehost.com/database. You simply need to replace user with your username, password with your password, databasehost.com with your database server and database with the name of the database. Define your Rails Master Key right away so you don't screw this up and have