The project is based on the official Getting Started from the Ruby On Rails team. You can follow this tutorial to deploy it.
-
Ruby version: 2.7.0
-
System dependencies:
sqlite3
andmysql
-
Database : Mysql
The project uses Google Cloud Run as a serverless backend.
-
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. -
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.
- 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.