Skip to content

The official Getting Started from the Ruby On Rails team. Modified to work in a serverless manner on GCP.

Notifications You must be signed in to change notification settings

hadyrashwan/ruby-on-rails-getting-started

Repository files navigation

Ruby On Rails Getting Started on GCP

The project is based on the official Getting Started from the Ruby On Rails team. You can follow this tutorial to deploy it.

The project used the following:

  • Ruby version: 2.7.0

  • System dependencies: sqlite3 and mysql

  • Database : Mysql

Deployment on GCP as serverless :

The project uses Google Cloud Run as a serverless backend.

  • Setup Google Cloud SQL for Mysql.

  • Configuring private IP for the database .

  • Add a database called ruby_blog_mysql_development to your cloud sql instance.

  • Run rake secret command and write down the output. This will be our secret key.

  • Update the deploy.sh file with your project ID.

  • Install gcloud and run ./deploy.sh. Write down the deployment URL.

  • Enable Cloud SQL on Cloud Run.

  • Update your environment variables with the following:

    Key Value
    BLOG_DATABASE_HOST Private IP
    BLOG_DATABASE_PASSWORD Password
    SECRET_KEY_BASE Secret key
  • Your app should be ready now go to the deployment URL on your browser .

  • In my test the response took over 20 seconds coming from a cold start and 254 ms afterwards.

  • I disabled the webpack caching mechanism and used environment variables instead of the secret manger for the demo purposes.

Running on local:

  • Setup Mysql environment.
  • Create A new database called ruby_blog_mysql_development.
  • Clone the project.
  • Run cd ruby-on-rails-getting-started/.
  • Change the password in database.yml line 18 to your mysql password.
  • Run gem install bundler && bundle install.
  • Run bundle install.
  • Run rails db:migrate.
  • Start the app using rails server command.

About

The official Getting Started from the Ruby On Rails team. Modified to work in a serverless manner on GCP.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published