You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/ruby-on-rails/_index.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,22 @@ title: Deploy Ruby on Rails on Google Cloud C4A (Arm-based Axion VMs)
3
3
4
4
minutes_to_complete: 40
5
5
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.
7
7
8
8
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)
10
10
- Install Ruby on Rails on a SUSE Arm64 (C4A) instance
11
11
- Validate Ruby on Rails functionality using PostgreSQL as the database
12
12
- Benchmark Rails performance using the built-in Ruby Benchmark library on Arm64 (Aarch64) architecture
13
13
14
14
15
15
prerequisites:
16
16
- 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/)
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/ruby-on-rails/background.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
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
3
3
4
4
weight: 2
5
5
@@ -8,7 +8,7 @@ layout: "learningpathall"
8
8
9
9
## Google Axion C4A Arm instances in Google Cloud
10
10
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.
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.
12
12
13
13
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.
14
14
@@ -24,4 +24,9 @@ Rails is widely used for web applications, APIs, and full-stack development proj
24
24
25
25
## What you've accomplished and what's next
26
26
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.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/ruby-on-rails/baseline.md
+51-67Lines changed: 51 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,106 +1,95 @@
1
1
---
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
3
3
weight: 5
4
4
5
5
### FIXED, DO NOT MODIFY
6
6
layout: learningpathall
7
7
---
8
8
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)
11
10
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.
14
12
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:
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
47
45
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:
50
47
51
48
```console
52
49
sudo -u postgres psql -c "CREATE USER gcpuser WITH SUPERUSER PASSWORD 'your_password';"
53
50
```
54
-
This command:
51
+
-This command creates a user named `gcpuser` with superuser privileges.
55
52
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.
59
54
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
61
56
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:
65
58
66
59
```console
67
60
export PGUSER=gcpuser
68
61
export PGPASSWORD=your_password
69
62
export PGHOST=localhost
70
63
```
64
+
-`PGUSER` sets the PostgreSQL user.
65
+
-`PGPASSWORD` stores the password for this session.
66
+
-`PGHOST` points to the local VM.
71
67
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
75
69
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:
78
71
79
72
```console
80
73
rails new db_test_rubyapp -d postgresql
81
74
cd db_test_rubyapp
82
75
bundle install
83
76
```
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.
87
79
88
80
{{% 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`).
90
82
{{% /notice %}}
91
83
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
95
85
96
-
Open the file with your preferred text editor:
86
+
Open `config/database.yml` and confirm the credentials:
97
87
98
88
```console
99
89
sudo vi config/database.yml
100
90
```
101
-
Locate the default and development sections, and make sure they match the PostgreSQL user and password you configured.
91
+
Set these fields:
102
92
103
-
Your configuration file should have the following fields set:
104
93
```output
105
94
default: &default
106
95
adapter: postgresql
@@ -119,6 +108,7 @@ By default, PostgreSQL on many Linux distributions (including SUSE) uses the ide
119
108
120
109
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.
121
110
111
+
Open your configuration file
122
112
```console
123
113
sudo vi /var/lib/pgsql/data/pg_hba.conf
124
114
```
@@ -132,15 +122,15 @@ host all all 127.0.0.1/32 ident
132
122
# IPv6 local connections:
133
123
host all all ::1/128 ident
134
124
```
135
-
Modify both lines to use md5, which enables password-based authentication:
125
+
Change `ident`to `md5`:
136
126
137
127
```output
138
128
# IPv4 local connections:
139
129
host all all 127.0.0.1/32 md5
140
130
# IPv6 local connections:
141
131
host all all ::1/128 md5
142
132
```
143
-
After saving the file, restart the PostgreSQL service to apply the new authentication settings:
133
+
Restart PostgreSQL:
144
134
145
135
```console
146
136
sudo systemctl restart postgresql
@@ -160,7 +150,8 @@ Run the following command from inside your Rails app directory:
160
150
```console
161
151
rails db:create
162
152
```
163
-
You should see output similar to:
153
+
The expected output is:
154
+
164
155
```output
165
156
Created database 'db_test_rubyapp_development'
166
157
Created database 'db_test_rubyapp_test'
@@ -177,37 +168,30 @@ Run the following command inside your Rails project directory:
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
203
188
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:
206
190
207
191
```console
208
192
sudo -u postgres psql
209
193
```
210
-
Inside the PostgreSQL shell, run:
194
+
In the PostgreSQL shell, run:
211
195
212
196
```console
213
197
\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
290
274
```console
291
275
rails server -b 0.0.0.0
292
276
```
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.
295
278
279
+
### Access your Rails app
296
280
297
281
### Access the Application:
298
282
Open a web browser on your local machine (Chrome, Firefox, Edge, etc.) and enter the following URL in the address bar:
299
283
300
-
```console
284
+
```
301
285
http://[YOUR_VM_EXTERNAL_IP]:3000
302
286
```
303
287
- 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
310
294
311
295
## What you've accomplished
312
296
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
+
Youset 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