Skip to content

Commit 3125c8d

Browse files
Update Ruby on Rails learning path content
1 parent ed21755 commit 3125c8d

File tree

5 files changed

+114
-112
lines changed

5 files changed

+114
-112
lines changed

content/learning-paths/servers-and-cloud-computing/ruby-on-rails/_index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ title: Deploy Ruby on Rails on Google Cloud C4A (Arm-based Axion VMs)
33

44
minutes_to_complete: 40
55

6-
who_is_this_for: This is an introductory topic intended for software developers deploying and optimizing Ruby on Rails workloads on Linux Arm64 environments, specifically using Google Cloud C4A virtual machines powered by Axion processors.
6+
who_is_this_for: This is an introductory topic for developers deploying and optimizing Ruby on Rails workloads in Linux Arm64 environments, specifically using Google Cloud C4A virtual machines powered by Axion processors.
77

88
learning_objectives:
9-
- Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors)
9+
- Provision an Arm-based SUSE SLES (SUSE Linux Enterprise Server) virtual machine on Google Cloud (C4A with Axion processors)
1010
- Install Ruby on Rails on a SUSE Arm64 (C4A) instance
1111
- Validate Ruby on Rails functionality using PostgreSQL as the database
1212
- Benchmark Rails performance using the built-in Ruby Benchmark library on Arm64 (Aarch64) architecture
1313

1414

1515
prerequisites:
1616
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free) account with billing enabled
17-
- Basic familiarity with Ruby programming, the Rails framework, and [relational databases](https://www.postgresql.org/)
17+
- Basic familiarity with Ruby programming, the Rails framework, and the [PostgreSQL Relational Database](https://www.postgresql.org/)
1818

1919
author: Pareena Verma
2020

21-
##### Tags
21+
### Tags
2222
skilllevels: Introductory
2323
subjects: Web
2424
cloud_service_providers: Google Cloud

content/learning-paths/servers-and-cloud-computing/ruby-on-rails/background.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Getting started with Ruby/Rails on Google Axion C4A (Arm Neoverse-V2)
2+
title: Getting started with Ruby on Rails on Google Axion C4A
33

44
weight: 2
55

@@ -8,7 +8,7 @@ layout: "learningpathall"
88

99
## Google Axion C4A Arm instances in Google Cloud
1010

11-
Google Axion C4A is a family of Arm-based virtual machines built on Googles custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these virtual machines offer strong performance for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
11+
Google Axion C4A is a family of Arm-based virtual machines built on Google's custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these virtual machines offer strong performance for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
1212

1313
The C4A series provides a cost-effective alternative to x86 virtual machines while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
1414

@@ -24,4 +24,9 @@ Rails is widely used for web applications, APIs, and full-stack development proj
2424

2525
## What you've accomplished and what's next
2626

27-
You’ve now learned about Google Axion C4A Arm instances and the fundamentals of Ruby on Rails. Understanding these technologies sets the stage for deploying and optimizing Rails workloads on Arm-based cloud infrastructure.
27+
Understanding these technologies sets the stage for deploying and optimizing Rails workloads on Arm-based cloud infrastructure. Now that you have the foundational context, you’re ready to set up your development environment and begin working with Ruby on Rails on Google Axion C4A instances.
28+
29+
In the next section, you’ll install the required tools and configure your environment to run Rails applications on Arm-based Google Cloud VMs. This hands-on setup will help you build, test, and deploy Rails projects efficiently on Arm architecture.
30+
31+
Continue to the installation steps to get started.
32+

content/learning-paths/servers-and-cloud-computing/ruby-on-rails/baseline.md

Lines changed: 51 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,95 @@
11
---
2-
title: Ruby on Rails Baseline Testing on Google Axion C4A Arm Virtual Machine
2+
title: Set up Ruby on Rails baseline testing on Google Axion C4A Arm virtual machine
33
weight: 5
44

55
### FIXED, DO NOT MODIFY
66
layout: learningpathall
77
---
88

9-
## Baseline Setup for Ruby on Rails with PostgreSQL
10-
This section sets up PostgreSQL and connects it with a Ruby on Rails application on a SUSE Arm64 Google Cloud C4A virtual machine. You’ll install PostgreSQL, configure it for Rails, create a database user, and verify that Rails can connect and serve requests successfully.
9+
## Set up Ruby on Rails with PostgreSQL on SUSE Arm64 (Google Cloud C4A)
1110

12-
### Install and Configure PostgreSQL
13-
PostgreSQL is a robust, production-grade relational database that integrates seamlessly with Ruby on Rails.
11+
Follow these steps to install PostgreSQL, connect it to a Ruby on Rails app, and verify everything works on a SUSE Arm64 Google Cloud C4A VM.
1412

15-
Install PostgreSQL and its development headers:
13+
### Install PostgreSQL and development headers
14+
15+
Install PostgreSQL and its development headers so Rails can use the `pg` gem:
1616

1717
```console
1818
sudo zypper install postgresql-devel postgresql-server
1919
```
20-
- `postgresql-devel` is required to compile the pg gem for Rails.
20+
- `postgresql-devel` lets you compile the `pg` gem for Rails.
2121

22-
After installation, ensure that PostgreSQL is running and configured to start automatically at boot:
22+
Start PostgreSQL and enable it to run at boot:
2323

2424
```console
2525
sudo systemctl start postgresql
2626
sudo systemctl enable postgresql
2727
systemctl status postgresql
2828
```
29-
The output should look like:
29+
The output is similar to:
30+
3031
```output
3132
● postgresql.service - PostgreSQL database server
32-
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
33-
Active: active (running) since Tue 2025-11-04 21:25:59 UTC; 18s ago
33+
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
34+
Active: active (running) since Tue 2025-11-04 21:25:59 UTC; 18s ago
3435
Main PID: 26997 (postgres)
35-
Tasks: 7
36-
CPU: 372ms
37-
CGroup: /system.slice/postgresql.service
38-
├─ 26997 /usr/lib/postgresql15/bin/postgres -D /var/lib/pgsql/data
39-
├─ 26998 "postgres: logger " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
40-
├─ 26999 "postgres: checkpointer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
41-
├─ 27000 "postgres: background writer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
42-
├─ 27002 "postgres: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
43-
├─ 27003 "postgres: autovacuum launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
44-
└─ 27004 "postgres: logical replication launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
36+
Tasks: 7
37+
CPU: 372ms
38+
CGroup: /system.slice/postgresql.service
39+
├─ 26997 /usr/lib/postgresql15/bin/postgres -D /var/lib/pgsql/data
40+
└─ ... (other postgres processes)
4541
```
46-
If the Active state reads running, your PostgreSQL service is operational and ready for configuration.
42+
If the Active state is running, PostgreSQL is ready.
43+
44+
### Create a PostgreSQL user for Rails
4745

48-
### Create a Database Role for Rails
49-
Next, create a dedicated PostgreSQL role (user) that Rails will use to connect to the database.
46+
Create a dedicated PostgreSQL user for your Rails app:
5047

5148
```console
5249
sudo -u postgres psql -c "CREATE USER gcpuser WITH SUPERUSER PASSWORD 'your_password';"
5350
```
54-
This command:
51+
- This command creates a user named `gcpuser` with superuser privileges.
5552

56-
Executes under the default PostgreSQL superuser account (postgres).
57-
Creates a new PostgreSQL role called gcpuser.
58-
Assigns superuser privileges, allowing the user to create databases, manage roles, and execute administrative tasks.
53+
You’ll use this user in your Rails configuration.
5954

60-
This user will serve as the Rails database owner and be referenced in the Rails configuration file (config/database.yml) later.
55+
### Set environment variables
6156

62-
### Set Environment variables
63-
64-
Before creating your Rails application, export environment variables so Rails and the `pg gem` can authenticate automatically with PostgreSQL.
57+
Export environment variables so Rails and the `pg` gem can connect to PostgreSQL:
6558

6659
```console
6760
export PGUSER=gcpuser
6861
export PGPASSWORD=your_password
6962
export PGHOST=localhost
7063
```
64+
- `PGUSER` sets the PostgreSQL user.
65+
- `PGPASSWORD` stores the password for this session.
66+
- `PGHOST` points to the local VM.
7167

72-
PGUSER → Specifies the PostgreSQL user that Rails will connect as.
73-
PGPASSWORD → Stores the password for that user in memory (temporary for this session).
74-
PGHOST → Points to the PostgreSQL host (in this case, the local VM).
68+
### Create a new Rails app with PostgreSQL
7569

76-
### Create a Rails App with PostgreSQL
77-
Now, generate a new Rails application configured to use PostgreSQL as its default database adapter:
70+
Generate a new Rails app that uses PostgreSQL:
7871

7972
```console
8073
rails new db_test_rubyapp -d postgresql
8174
cd db_test_rubyapp
8275
bundle install
8376
```
84-
- rails new db_test_rubyapp → Creates a new Rails application named db_test_rubyapp.
85-
- `d postgresql` → Instructs Rails to use PostgreSQL instead of the default SQLite database.
86-
- bundle install → Installs all gem dependencies defined in the Gemfile, including the pg gem that connects Rails to PostgreSQL.
77+
- `rails new db_test_rubyapp -d postgresql` creates a Rails app using PostgreSQL.
78+
- `bundle install` installs gem dependencies, including the `pg` gem.
8779

8880
{{% notice Note %}}
89-
Check `config/database.yml` to ensure the `username` and `password` match your PostgreSQL role `(gcpuser)`.
81+
Check `config/database.yml` and make sure `username` and `password` match your PostgreSQL user (`gcpuser`).
9082
{{% /notice %}}
9183

92-
### Verify and Update Database Configuration
93-
Rails uses the `config/database.yml` file to define how it connects to databases in different environments (development, test, and production).
94-
It's important to verify that these credentials align with the PostgreSQL role you created earlier.
84+
### Update Rails database configuration
9585

96-
Open the file with your preferred text editor:
86+
Open `config/database.yml` and confirm the credentials:
9787

9888
```console
9989
sudo vi config/database.yml
10090
```
101-
Locate the default and development sections, and make sure they match the PostgreSQL user and password you configured.
91+
Set these fields:
10292

103-
Your configuration file should have the following fields set:
10493
```output
10594
default: &default
10695
adapter: postgresql
@@ -119,6 +108,7 @@ By default, PostgreSQL on many Linux distributions (including SUSE) uses the ide
119108

120109
To allow Rails to connect using a username and password, change the authentication method in PostgreSQL’s configuration file `pg_hba.conf` from ident to md5.
121110

111+
Open your configuration file
122112
```console
123113
sudo vi /var/lib/pgsql/data/pg_hba.conf
124114
```
@@ -132,15 +122,15 @@ host all all 127.0.0.1/32 ident
132122
# IPv6 local connections:
133123
host all all ::1/128 ident
134124
```
135-
Modify both lines to use md5, which enables password-based authentication:
125+
Change `ident` to `md5`:
136126

137127
```output
138128
# IPv4 local connections:
139129
host all all 127.0.0.1/32 md5
140130
# IPv6 local connections:
141131
host all all ::1/128 md5
142132
```
143-
After saving the file, restart the PostgreSQL service to apply the new authentication settings:
133+
Restart PostgreSQL:
144134

145135
```console
146136
sudo systemctl restart postgresql
@@ -160,7 +150,8 @@ Run the following command from inside your Rails app directory:
160150
```console
161151
rails db:create
162152
```
163-
You should see output similar to:
153+
The expected output is:
154+
164155
```output
165156
Created database 'db_test_rubyapp_development'
166157
Created database 'db_test_rubyapp_test'
@@ -177,37 +168,30 @@ Run the following command inside your Rails project directory:
177168
```console
178169
rails generate scaffold task title:string due_date:date
179170
```
180-
This single command automatically generates:
181-
A database migration to create the tasks table in PostgreSQL.
182-
A model file (app/models/task.rb) that maps to the tasks table.
183-
A controller (app/controllers/tasks_controller.rb) with full CRUD actions (index, show, new, create, edit, update, destroy).
184-
Corresponding views in app/views/tasks/ with ready-to-use HTML + embedded Ruby templates.
185-
Route entries in config/routes.rb to make the new resource accessible via /tasks.
171+
- This command generates a model, controller, views, and migration for tasks.
186172

187-
Now apply the migration to create the tasks table in your PostgreSQL database:
173+
Apply the migration:
188174

189175
```console
190176
rails db:migrate
191177
```
178+
You’ll see output like:
192179

193-
You should see output similar to:
194180
```output
195181
== 20251006101717 CreateTasks: migrating ======================================
196182
-- create_table(:tasks)
197183
-> 0.0127s
198184
== 20251006101717 CreateTasks: migrated (0.0128s) =============================
199185
```
200186

201-
This confirms that Rails connected successfully to PostgreSQL and the database schema was updated.
202-
The new tasks table was created inside your db_test_rubyapp_development database.
187+
### Verify the tasks table in PostgreSQL
203188

204-
### Verify Table and Database Connectivity
205-
TThe scaffold created a tasks table in your PostgreSQL database. Verify it exists and has the expected schema:
189+
Check that the `tasks` table exists:
206190

207191
```console
208192
sudo -u postgres psql
209193
```
210-
Inside the PostgreSQL shell, run:
194+
In the PostgreSQL shell, run:
211195

212196
```console
213197
\c db_test_rubyapp_development
@@ -290,14 +274,14 @@ Now that port 3000 is allowed in your VM’s ingress firewall rules, you can sta
290274
```console
291275
rails server -b 0.0.0.0
292276
```
293-
- `rails server -b 0.0.0.0` → Starts the Rails server and binds it to all network interfaces, not just `localhost`.
294-
- Binding to `0.0.0.0` allows other machines (or your local browser) to access the Rails app running on the VM using its external IP.
277+
- This command lets you access Rails from your browser using the VM’s external IP.
295278

279+
### Access your Rails app
296280

297281
### Access the Application:
298282
Open a web browser on your local machine (Chrome, Firefox, Edge, etc.) and enter the following URL in the address bar:
299283

300-
```console
284+
```
301285
http://[YOUR_VM_EXTERNAL_IP]:3000
302286
```
303287
- Replace `<YOUR_VM_PUBLIC_IP>` with the public IP of your GCP VM.
@@ -310,4 +294,4 @@ With port 3000 reachable and the welcome page loading, your Rails stack on SUSE
310294

311295
## What you've accomplished
312296

313-
You’ve successfully set up a Ruby on Rails application with PostgreSQL on a Google Cloud C4A Arm-based virtual machine running SUSE Linux. You installed and configured PostgreSQL, created a dedicated database user, and connected your Rails app to the database. You verified connectivity, generated a scaffold for CRUD operations, and ensured your application is accessible over the network. With your Rails stack running on Arm, you’re ready to move on to benchmarking and performance validation.
297+
You set up a Ruby on Rails app with PostgreSQL on a Google Cloud C4A Arm-based VM running SUSE Linux. You installed and configured PostgreSQL, created a database user, connected Rails, verified connectivity, generated a scaffold, and made your app accessible over the network. Your Rails stack is now ready for benchmarking and performance testing on Arm.

0 commit comments

Comments
 (0)