Skip to content

Commit ef49759

Browse files
authored
Merge pull request #2426 from odidev/circle-ci-lp
Deploy CircleCI ARM Native Workflows on SUSE ARM (GCP VM)
2 parents a012bb8 + de25b24 commit ef49759

File tree

18 files changed

+528
-0
lines changed

18 files changed

+528
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: CircleCI Arm Native Workflows on SUSE Arm (GCP VM)
3+
4+
draft: true
5+
cascade:
6+
draft: true
7+
8+
minutes_to_complete: 45
9+
10+
who_is_this_for: This learning path is intended for software developers and DevOps engineers looking to set up and run CircleCI Arm native workflows on SUSE Linux Arm64 VMs, specifically on Google Cloud C4A with Axion processors, using self-hosted runners.
11+
12+
learning_objectives:
13+
- Provision a SUSE Arm64 virtual machine on Google Cloud (C4A with Axion processors)
14+
- Install and configure CircleCI self-hosted machine runners on Arm64
15+
- Create a cloud-native Node.js demo app to run on the self-hosted Arm runner
16+
- Write and execute a CircleCI workflow using a custom Arm resource class
17+
- Test CircleCI workflows locally and understand job execution on Arm64 runners
18+
19+
prerequisites:
20+
- A [Google Cloud Platform (GCP)](https://cloud.google.com/free) account with billing enabled
21+
- Basic familiarity with Linux command line, Node.js, and npm
22+
- Basic understanding of CircleCI concepts such as
23+
[workflows](https://circleci.com/docs/guides/orchestrate/workflows/),
24+
[jobs](https://circleci.com/docs/guides/orchestrate/jobs-steps/),
25+
[resource classes](https://circleci.com/docs/guides/execution-managed/resource-class-overview/), and
26+
[runners](https://circleci.com/docs/guides/execution-runner/runner-overview/)
27+
28+
29+
author: Pareena Verma
30+
31+
##### Tags
32+
skilllevels: Introductory
33+
subjects: CI-CD
34+
cloud_service_providers: Google Cloud
35+
36+
armips:
37+
- Neoverse
38+
39+
tools_software_languages:
40+
- CircleCI
41+
- Node.js
42+
- npm
43+
- Express
44+
- Docker
45+
46+
operatingsystems:
47+
- Linux
48+
49+
# ================================================================================
50+
# FIXED, DO NOT MODIFY
51+
# ================================================================================
52+
further_reading:
53+
- resource:
54+
title: Google Cloud documentation
55+
link: https://cloud.google.com/docs
56+
type: documentation
57+
58+
- resource:
59+
title: CircleCI Self-Hosted Runner Documentation
60+
link: https://circleci.com/docs/guides/execution-runner/install-machine-runner-3-on-linux/
61+
type: documentation
62+
63+
- resource:
64+
title: CircleCI CLI Documentation
65+
link: https://circleci.com/docs/guides/toolkit/local-cli/
66+
type: documentation
67+
68+
- resource:
69+
title: Node.js Express Documentation
70+
link: https://expressjs.com/
71+
type: documentation
72+
73+
weight: 1
74+
layout: "learningpathall"
75+
learning_path_main_page: "yes"
76+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Getting started with CircleCI on Google Axion C4A (Arm Neoverse-V2)
3+
4+
weight: 2
5+
6+
layout: "learningpathall"
7+
---
8+
9+
## Google Axion C4A Arm instances in Google Cloud
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.
12+
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+
15+
To learn more about Google Axion, refer to the [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu) blog.
16+
17+
## CircleCI
18+
19+
CircleCI is a cloud-based **Continuous Integration and Continuous Delivery (CI/CD)** platform that automates the process of **building, testing, and deploying software**.
20+
21+
It integrates with popular version control systems like **GitHub**, **Bitbucket**, and **GitLab**, and allows developers to define custom workflows in a `.circleci/config.yml` file using **YAML syntax**.
22+
23+
CircleCI supports multiple environments, including **Docker**, **Linux**, **macOS**, and **Windows**, and offers advanced features like **parallelism**, **caching**, and **matrix builds** to speed up pipelines and improve efficiency.
24+
25+
It is widely used for **automating tests, running builds, deploying applications, and ensuring code quality** in modern development workflows. Learn more from the [CircleCI official website](https://circleci.com/) and its [documentation](https://circleci.com/docs/).
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
---
2+
title: CircleCI Arm64 Cloud-Native Demo
3+
weight: 8
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Deploying a Cloud-Native Arm64 Node.js App using self-hosted CircleCI Runner on GCP
10+
11+
This guide walks through building and testing a simple **Node.js web app** using a **self-hosted CircleCI Arm64 runner** on a **GCP SUSE Arm64 VM**.
12+
13+
14+
### Install and Configure Docker
15+
Ensure Docker is installed, started, and accessible by both your user and the CircleCI runner service.
16+
17+
- **Install Docker**: Refresh your package manager and install Docker on your system.
18+
- **Enable Docker Service**: Ensure Docker starts on boot and is running.
19+
- **Add User to Docker Group**: Add both your user and the CircleCI runner to the Docker group to grant access.
20+
21+
```console
22+
sudo zypper refresh
23+
sudo zypper install docker
24+
sudo systemctl enable docker
25+
sudo systemctl start docker
26+
sudo systemctl status docker
27+
sudo usermod -aG docker $USER
28+
sudo usermod -aG docker circleci
29+
```
30+
### Validate Docker access
31+
This command switches to the CircleCI user and checks if Docker is working correctly.
32+
33+
```console
34+
sudo -u circleci -i
35+
docker ps
36+
exit
37+
```
38+
39+
### Verify Docker Permissions
40+
Check Docker socket permissions and ensure that the CircleCI runner is active and running.
41+
42+
```console
43+
ls -l /var/run/docker.sock
44+
ps -aux | grep circleci-runner
45+
```
46+
- **Check Docker Socket Permissions**: This command ensures the Docker socket is accessible.
47+
- **Verify CircleCI Runner Process**: Confirm the CircleCI runner service is active and running.
48+
49+
### **Install Node.js and npm**
50+
51+
Before proceeding with the app setup, please make sure **Node.js** and **npm** (Node.js package manager) are installed on the VM, as they are required to run your Node.js app.
52+
53+
- **Install Node.js**: Use the official Node.js package for Arm64 architecture.
54+
- **Install npm**: npm is automatically installed when Node.js is installed.
55+
56+
```console
57+
sudo zypper install nodejs
58+
sudo zypper install npm
59+
```
60+
### Clone Your App Repository
61+
Clone your application repository (or create one locally):
62+
63+
```console
64+
git clone https://github.com/<your-repo>/arm64-node-demo.git
65+
cd arm64-node-demo
66+
```
67+
68+
### Create a Dockerfile
69+
In the root of your project, create a `Dockerfile` that defines how to build and run your application container.
70+
71+
```dockerfile
72+
# Dockerfile
73+
FROM arm64v8/node:20-alpine
74+
WORKDIR /app
75+
COPY package*.json ./
76+
RUN npm install
77+
COPY . .
78+
EXPOSE 3000
79+
CMD ["npm", "start"]
80+
```
81+
- **Use Arm64 Node.js Image**: The `arm64v8/node` image is specifically designed for Arm64 architecture.
82+
- **Install Dependencies**: `RUN npm install` installs the project dependencies listed in `package.json`.
83+
- **Expose Port**: The app will run on port 3000.
84+
- **Start the App**: The container will execute `npm start` to launch the Node.js server.
85+
86+
### Add a CircleCI Configuration
87+
Create a `.circleci/config.yml` file to define the CircleCI pipeline for building and testing your Node.js app on Arm64 architecture.
88+
89+
```yaml
90+
version: 2.1
91+
92+
jobs:
93+
arm64-demo:
94+
machine: true
95+
resource_class: <Your_resource_class>
96+
steps:
97+
- checkout
98+
- run:
99+
name: Show Architecture
100+
command: |
101+
ARCH=$(uname -m)
102+
echo "Detected architecture: $ARCH"
103+
if [ "$ARCH" = "aarch64" ]; then
104+
echo "✅ Running on ARM64 architecture!"
105+
else
106+
echo "Not running on ARM64!"
107+
exit 1
108+
fi
109+
- run:
110+
name: Build Docker Image
111+
command: docker build -t arm64-node-demo .
112+
- run:
113+
name: Run Docker Container
114+
command: docker run -d -p 3000:3000 arm64-node-demo
115+
- run:
116+
name: Test Endpoint
117+
command: |
118+
sleep 5
119+
curl http://localhost:3000
120+
121+
workflows:
122+
version: 2
123+
arm64-workflow:
124+
jobs:
125+
- arm64-demo
126+
```
127+
- **arm64-demo Job**: This job checks if the architecture is Arm64, builds the Docker image, runs it in a container, and tests the app endpoint.
128+
- **resource_class**: Specify the resource class for the CircleCI runner (e.g., a custom Arm64 runner if using self-hosted).
129+
- **Test Endpoint**: The job sends a request to the app to verify it’s working.
130+
131+
### Node.js Application
132+
Here’s the basic code for the Node.js app.
133+
134+
`index.js`:
135+
136+
```javascript
137+
const express = require('express');
138+
const app = express();
139+
const PORT = process.env.PORT || 3000;
140+
141+
app.get('/', (req, res) => {
142+
res.send('Hello from ARM64 Node.js app! 🚀');
143+
});
144+
145+
app.listen(PORT, () => {
146+
console.log(`Server running on port ${PORT}`);
147+
});
148+
```
149+
package.json
150+
151+
```json
152+
{
153+
"name": "arm64-node-demo",
154+
"version": "1.0.0",
155+
"main": "index.js",
156+
"scripts": {
157+
"start": "node index.js",
158+
"test": "echo \"No tests yet\""
159+
},
160+
"dependencies": {
161+
"express": "^4.18.2"
162+
}
163+
}
164+
```
165+
- **Express Server**: The application uses Express.js to handle HTTP requests and respond with a simple message.
166+
- **Package Dependencies**: The app requires the `express` package for handling HTTP requests.
167+
168+
### Push Code to GitHub
169+
170+
Once all files (`Dockerfile`, `index.js`, `package.json`, `.circleci/config.yml`) are ready, push your project to GitHub so CircleCI can build it automatically.
171+
172+
```console
173+
git add .
174+
git commit -m "Add ARM64 CircleCI Node.js demo project"
175+
git push -u origin main
176+
```
177+
- **Add and Commit Changes**: Stage and commit your project files.
178+
- **Push to GitHub**: Push your code to the GitHub repository so that CircleCI can trigger the build.
179+
180+
### Start CircleCI Runner and Execute Job
181+
Ensure that your CircleCI runner is enabled and started. This will allow your self-hosted runner to pick up jobs from CircleCI.
182+
183+
```console
184+
sudo systemctl enable circleci-runner
185+
sudo systemctl start circleci-runner
186+
sudo systemctl status circleci-runner
187+
```
188+
- **Enable CircleCI Runner**: Ensure the CircleCI runner is set to start automatically on boot.
189+
- **Start and Check Status**: Start the CircleCI runner and verify it is running.
190+
191+
After pushing your code to GitHub, open your **CircleCI Dashboard → Projects**, and confirm that your **ARM64 workflow** starts running using your **self-hosted runner**.
192+
193+
If the setup is correct, you’ll see your job running under the resource class you created.
194+
195+
### Output
196+
Once the job starts running, CircleCI will:
197+
198+
- Detect the ARM64 architecture.
199+
200+
![CircleCI Dashboard alt-text#center](images/output1.png "Figure 1: Show architecture")
201+
202+
- Build the Docker image.
203+
204+
![CircleCI Dashboard alt-text#center](images/output2.png "Figure 2: Docker Image")
205+
206+
- Runs a container from that image.
207+
208+
![CircleCI Dashboard alt-text#center](images/output4.png "Figure 3: Container Run")
209+
210+
- Test the application by hitting the endpoint.
211+
212+
![CircleCI Dashboard alt-text#center](images/output3.png "Figure 3: Verify App")
213+
214+
If successful, you will see your CircleCI job running and the app deployed in the CircleCI Dashboard.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Create Resource Class in CircleCI
3+
weight: 5
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## Create a Resource Class for Self-Hosted Runner in CircleCI
10+
This guide explains how to create a **Resource Class** in the **CircleCI Web Dashboard** for a **self-hosted runner**.
11+
A Resource Class defines a unique identifier for your runner and links it to your CircleCI namespace, allowing CircleCI jobs to target your custom machine environment.
12+
13+
### Steps
14+
15+
1. **Go to the CircleCI Web Dashboard**
16+
- From the left sidebar, navigate to **Self-Hosted Runners**.
17+
- You’ll see a screen asking you to accept the **terms of use**.
18+
- **Check the box** that says **“Yes, I agree to the terms”** to enable runners.
19+
- Then click **Self-Hosted Runners** to continue setup.
20+
21+
![Self-Hosted Runners alt-text#center](images/shrunner0.png "Figure 1: Self-Hosted Runners ")
22+
23+
2. **Create a New Resource Class**
24+
25+
Click **Create Resource Class** on your CircleCI dashboard.
26+
27+
**Fill in the following details:**
28+
29+
- **Namespace:** Your CircleCI username or organization name (e.g., `circleci`)
30+
- **Resource Class Name:** A clear, descriptive name for your runner (e.g., `arm64`)
31+
- Click **Create Resource Class**.
32+
33+
![Self-Hosted Runners alt-text#center](images/shrunner1.png "Figure 2: Create Resource Class ")
34+
35+
![Self-Hosted Runners alt-text#center](images/shrunner2.png "Figure 3: Details Resource Class & Namespace")
36+
37+
3. **Save and Copy the Token**
38+
- Once created, CircleCI will generate a **Resource Class Token**.
39+
- Copy this token and store it securely — you will need it to register your runner on the GCP VM.
40+
41+
![Self-Hosted Runners alt-text#center](images/shrunner3.png "Figure 4: Resource Class Token")
42+
43+
Now that your resource class and token are generated, proceed to the next section to set up the CircleCI self-hosted runner.
56.5 KB
Loading
261 KB
Loading
83.9 KB
Loading
127 KB
Loading
56.1 KB
Loading

0 commit comments

Comments
 (0)