Deploy Ruby On Rails On Google Cloud

Опубликовано: 16 Июль 2026
на канале: nETSETOS
5,082
50

Google App Engine Flexible environment applications are easy to create, easy to maintain, and easy to scale as your traffic and data storage changes. With App Engine, there are no servers to maintain. You simply upload your application and it's ready to go.

Learnings:-

How to create a new Rails application using the Cloud Shell.
How to test a Rails application using Web Preview in the Cloud Shell before deployment.
How to add a Welcome page to the Rails application.
How to prepare your deployment configuration.
How to deploy a new Rails application to Google App Engine.
Familiarity with Ruby on Rails.

Commands:-

gem install rails
rails new app_name
bundle install
bundle exec rails server --port 8080
bundle exec rails generate controller Welcome index
bundle exec rails secret
gcloud beta runtime-config configs create flex-env-config-1
gcloud beta runtime-config configs variables set \
--config-name=flex-env-config --is-text \
SECRET_KEY_BASE "[SECRET_KEY]"

---------------------------------------app.yaml---------------------------------------------------------
How to start your application
entrypoint: bundle exec rackup --port $PORT
Use App Engine flexible environment
env: flex
Use the supported Ruby runtime
runtime: ruby

App Engine flexible environment will load the configuration
values from the Runtime Configuration Service defined by
flex-env-config and create a .env file used by your
application to determine environment values.
runtime_config:
dotenv_config: flex-env-config

---------------------------------------app.yaml---------------------------------------------------------
bundle add dotenv-rails
export PROJECT_ID=$(gcloud config get-value project)
gcloud projects list --filter $PROJECT_ID
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member=serviceAccount:[PROJECT_NUMBER]@cloudbuild.gserviceaccount.com \
--role=roles/editor
gcloud app deploy

#deploy #rubyonrails #googlecloud