Skip to content

Commit 22c1a75

Browse files
Copilot updates for the techreview
1 parent 5bb1d6c commit 22c1a75

10 files changed

Lines changed: 160 additions & 147 deletions

File tree

content/learning-paths/servers-and-cloud-computing/django-on-gcp/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ further_reading:
6666
type: documentation
6767

6868
- resource:
69-
title: Apache-bench documentation
69+
title: Apache Bench documentation
7070
link: https://httpd.apache.org/docs/2.4/programs/ab.html
7171
type: documentation
7272

content/learning-paths/servers-and-cloud-computing/django-on-gcp/background.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ To learn more, visit the [Django website](https://www.djangoproject.com/) and ex
3131

3232
You now understand the capabilities of Google Axion C4A Arm-based VMs and why Django is an excellent choice for building web applications on Arm infrastructure. The combination provides a cost-effective, high-performance platform for deploying Python web applications at scale.
3333

34-
In the next sections, you'll provision your own Arm-based VM on Google Cloud, install Django, and benchmark your application's performance. You're ready to start building!
34+
In the next sections, you'll provision your own Arm-based VM on Google Cloud, install Django, and benchmark your application's performance.
3535

3636

content/learning-paths/servers-and-cloud-computing/django-on-gcp/baseline.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,11 @@ layout: learningpathall
88

99
## Verify Django is working on your Arm-based VM
1010

11-
In this section, you'll confirm that Django is installed correctly and can serve web requests on your Google Cloud C4A VM. You'll create a Django project, run the development server, and access it from your browser. This hands-on verification ensures your environment is ready for development and testing.
12-
13-
By the end of this section, you'll have:
14-
- Created a Django project with proper directory structure
15-
- Configured Django to accept requests from your VM's external IP
16-
- Run the development server and accessed it from your browser
17-
- Built a simple Django app with custom routing and views
18-
- Verified that Django can handle HTTP requests and render responses
19-
20-
Let's get started!
21-
22-
## Create and test a basic Django project
11+
In this section, you'll confirm that Django is installed correctly and can serve web requests on your Google Cloud C4A VM. You'll create a Django project, run the development server, and access it from your browser.
2312

2413
Run the following command to create a new Django project named `myproject`:
2514

26-
```console
15+
```bash
2716
django-admin startproject myproject
2817
cd myproject
2918
```
@@ -46,7 +35,7 @@ The `manage.py` file is Django's command-line utility for project management. Th
4635

4736
Set up your project's database by running migrations, which create the required tables for Django's built-in apps:
4837

49-
```console
38+
```bash
5039
python3 manage.py migrate
5140
```
5241

@@ -58,27 +47,29 @@ Before starting the Django development server, you must configure your `ALLOWED_
5847

5948
Navigate to your project settings directory:
6049

61-
```console
50+
```bash
6251
cd ~/myproject/myproject/
6352
```
6453

6554
Open `settings.py` using a text editor:
6655

67-
```console
56+
```bash
6857
edit myproject/settings.py
6958
```
7059

71-
- Locate the `ALLOWED_HOSTS` Line
72-
Inside the file, find the following line:
60+
- Locate the ALLOWED_HOSTS line
61+
62+
Inside the file, find the following line:
7363

7464
```python
7565
ALLOWED_HOSTS = []
7666
```
7767

7868
Update it to allow your VM's external IP address:
7969

80-
- Allow All Hosts (for Testing Only)
81-
To make your Django app accessible from your VM’s external IP address, update it to:
70+
- Allow all hosts (for testing only)
71+
72+
To make your Django app accessible from your VM's external IP address, update it to:
8273
```python
8374
ALLOWED_HOSTS = ['*']
8475
```
@@ -92,7 +83,7 @@ ALLOWED_HOSTS = ['your-external-ip', 'your-domain.com']
9283

9384
Now that you've configured `ALLOWED_HOSTS`, start the development server:
9485

95-
```console
86+
```bash
9687
python3 manage.py runserver 0.0.0.0:8000
9788
```
9889

@@ -110,7 +101,7 @@ Replace `<YOUR_VM_EXTERNAL_IP>` with the public IP address of your GCP VM.
110101

111102
You should see the Django welcome page with the message "The install worked successfully!":
112103

113-
![Screenshot of the Django welcome page displayed in a web browser. The page features a large heading stating The install worked successfully followed by a subheading congratulating the user on successfully installing Django. Below are instructions for the next steps, including editing the settings file and reading the Django documentation. The page has a clean white background with blue highlights. alt-text#center](images/django-welcome-page.png "Django welcome page")
104+
![Screenshot of the Django welcome page displayed in a web browser. The page features a large heading stating The install worked successfully followed by a subheading congratulating the user on successfully installing Django. Below are instructions for the next steps, including editing the settings file and reading the Django documentation. The page has a clean white background with blue highlights#center](images/django-welcome-page.png "Django welcome page")
114105

115106
## Build a simple Django app with custom routing
116107

@@ -124,7 +115,7 @@ Press **Ctrl + C** in your terminal to stop the Django development server.
124115

125116
Within your Django project directory, create a new app named `hello`:
126117

127-
```console
118+
```bash
128119
python3 manage.py startapp hello
129120
```
130121

@@ -220,7 +211,7 @@ INSTALLED_APPS = [
220211

221212
Restart the Django development server:
222213

223-
```console
214+
```bash
224215
python3 manage.py runserver 0.0.0.0:8000
225216
```
226217

@@ -234,8 +225,8 @@ http://<YOUR_VM_EXTERNAL_IP>:8000
234225

235226
You should now see your custom message displayed:
236227

237-
![Screenshot of a web browser displaying a Django app with a large heading that reads Hello, Django on Arm centered on a clean white background. The page contains no additional content or navigation, creating a straightforward and welcoming tone. alt-text#center](images/django-app.png "Django custom app")
228+
![Screenshot of a web browser displaying a Django app with a large heading that reads Hello, Django on Arm centered on a clean white background. The page contains no additional content or navigation, creating a straightforward and welcoming tone#center](images/django-app.png "Django custom app")
238229

239230
## Summary and what's next
240231

241-
You've successfully verified that Django is installed and working on your Arm-based VM. Your application can serve web requests, handle routing, and render custom views. Great job, you're ready to benchmark your Django application!
232+
You've successfully verified that Django is installed and working on your Arm-based VM. Your application can serve web requests, handle routing, and render custom views.

content/learning-paths/servers-and-cloud-computing/django-on-gcp/benchmarking.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,35 @@ To begin, if your Django development server is still running, stop it using `Ctr
1616

1717
ApacheBench (`ab`) is a command-line tool that simulates multiple HTTP requests to measure web server performance. Install it using the following:
1818

19-
```console
19+
```bash
2020
sudo zypper install -y apache2-utils
2121
```
2222

2323
### Verify installation
24-
This command confirms ApacheBench is correctly installed and available system-wide:
2524

26-
```console
25+
Confirm ApacheBench is correctly installed and available:
26+
27+
```bash
2728
ab -V
2829
```
2930

30-
The output displays the ApacheBench version, confirming successful installation.
31+
The output displays the ApacheBench version.
3132

3233
### Install and configure Gunicorn
3334

3435
Before benchmarking your Django application, you need to install Gunicorn, a production-grade WSGI HTTP server. Gunicorn provides better performance characteristics than Django's development server and more accurately represents real-world deployment scenarios.
3536

3637
### Install both Django and Gunicorn using pip:
3738

38-
```console
39+
```bash
3940
python3 -m pip install django gunicorn
4041
```
4142
This command installs two essential packages. Django is the Python web framework you're benchmarking, while Gunicorn serves as a high-performance WSGI HTTP server that handles multiple concurrent requests efficiently. Unlike Django's built-in development server, Gunicorn is designed for production workloads and provides the multi-worker architecture needed for accurate performance testing.
4243

4344
### Run Django with Gunicorn
4445
Start your Django application using Gunicorn (already running inside GKE):
4546

46-
Gunicorn is deployed inside your Kubernetes Pods and exposed via a Kubernetes Service and LoadBalancer.
47+
Gunicorn is deployed inside your Kubernetes Pods and exposed through a Kubernetes Service and LoadBalancer.
4748
The benchmark is executed against the **external IP of the GKE service**.
4849

4950
{{% notice Note %}}
@@ -54,10 +55,13 @@ Ensure your VM's firewall allows inbound traffic on port 8000. See the firewall
5455

5556
Use ApacheBench to test your Django server with simulated traffic:
5657

57-
```console
58+
```bash
5859
ab -n 5000 -c 100 http://<external_IP_of_the_GKE_service>/healthz/
5960
```
60-
This sends 5000 requests using 100 concurrent connections to your Django REST endpoint exposed through the GKE LoadBalancer. After a few minutes, press "CTRL-C" to stop the benchmark and display results similar to:
61+
62+
This sends 5000 requests using 100 concurrent connections to your Django REST endpoint exposed through the GKE LoadBalancer. After a few minutes, press CTRL-C to stop the benchmark.
63+
64+
The output is similar to:
6165

6266
```output
6367
Server Software: gunicorn
@@ -154,7 +158,7 @@ Results from the run on the `Axion (C4A) Arm64 GKE nodes`:
154158
The benchmark results demonstrate the strength of running Django on Google Axion (Arm64) GKE:
155159

156160
- Extreme Throughput: The cluster sustained 14,000+ requests per second through a public LoadBalancer → GKE → Gunicorn → Django → Cloud SQL → Redis stack.
157-
- Ultra-Low p95 Latency: Even at 100 concurrent users, 95% of all requests completed within 11 ms, proving excellent tail-latency control.
161+
- Ultra-Low p95 Latency: Even at 100 concurrent users, 95% of all requests completed within 11 ms.
158162
- Production Stability: Zero failed requests confirms the platform is resilient under heavy parallel load.
159163
- Efficient Networking: Over 4.4 MB/sec of data transfer through the GKE LoadBalancer shows Arm-based networking is highly optimized.
160164
- Cloud-native Scalability: These results validate that Axion Arm64 nodes are well-suited for high-performance, horizontally scalable REST APIs in production.

content/learning-paths/servers-and-cloud-computing/django-on-gcp/containerization-and-deploy.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ weight: 9
66
layout: learningpathall
77
---
88

9-
## Containerize and Deploy Django on Axion GKE
10-
This guide converts your Django REST API into a **production-grade Arm64 container** and deploys it on **Axion-powered Google Kubernetes Engine (GKE)**.
11-
You will validate that the workload runs **natively on Arm** and is **publicly accessible** via a cloud Load Balancer.
9+
## Containerize and deploy Django on Axion GKE
1210

13-
### Create Docker Image
11+
This guide converts your Django REST API into a production-grade Arm64 container and deploys it on Axion-powered Google Kubernetes Engine (GKE). You will validate that the workload runs natively on Arm and is publicly accessible through a cloud Load Balancer.
12+
13+
### Create Docker image
1414
This step packages your Django API and all its dependencies into a **portable container image** that can run on any Axion Arm64 node.
1515

1616
Create a file called: `requirements.txt` and insert the following:
@@ -35,37 +35,39 @@ CMD ["gunicorn","django_api.wsgi:application","--bind","0.0.0.0:8000","--workers
3535

3636
You now have a container blueprint that can run Django in production using Gunicorn on Arm64.
3737

38-
### Build and Push
39-
This builds the image on an Arm machine and pushes it to Artifact Registry, ensuring Kubernetes pulls an Arm-native image:
38+
### Build and push
39+
40+
Build the image on an Arm machine and push it to Artifact Registry, ensuring Kubernetes pulls an Arm-native image.
4041

41-
(Please replace PROJECT_ID with your current project)
42+
Replace PROJECT_ID with your current project.
4243

43-
Build the docker image first:
44+
Build the docker image:
4445

45-
```console
46+
```bash
4647
docker build -t us-central1-docker.pkg.dev/PROJECT_ID/django-arm/api:1.0 .
4748
```
4849

49-
Then, push the built image:
50+
Push the built image:
5051

51-
```console
52+
```bash
5253
docker push us-central1-docker.pkg.dev/PROJECT_ID/django-arm/api:1.0
5354
```
5455

5556
Your Django API is now stored in Google’s private container registry and ready for GKE.
5657

5758
### Deploy to GKE
59+
5860
Kubernetes Deployments define how many containers run and where. The nodeSelector forces pods onto Axion ARM64 nodes.
5961

6062
First, make a directory:
6163

62-
```console
64+
```bash
6365
mkdir ./k8s
6466
```
6567

66-
Next, let's create `k8s/deployment.yaml` file with the following contents (replace PROJECT_ID with your current project):
68+
Next, create `k8s/deployment.yaml` file with the following contents (replace PROJECT_ID with your current project):
6769

68-
```python
70+
```yaml
6971
apiVersion: apps/v1
7072
kind: Deployment
7173
metadata:
@@ -92,15 +94,15 @@ spec:
9294
value: django_api.settings
9395
```
9496
95-
**Apply:**
97+
Apply the deployment:
9698
97-
```console
99+
```bash
98100
kubectl apply -f k8s/deployment.yaml
99101
```
100102

101-
**Verify pods are running on Axion Arm nodes:**
103+
Verify pods are running on Axion Arm nodes:
102104

103-
```console
105+
```bash
104106
kubectl get pods -o wide
105107
```
106108

@@ -112,12 +114,12 @@ django-api-XXXXXX 1/1 Running 0 3h52m 10.0.1.9 gke-django-a
112114
```
113115
Your Django API is now running as replicated containers on Axion Arm64 nodes.
114116

115-
### Create Kubernetes Service (LoadBalancer)
117+
### Create Kubernetes service (LoadBalancer)
116118
A Service exposes your pods to the internet using **Google Cloud’s managed load balancer**.
117119

118120
Create `k8s/service.yaml`:
119121

120-
```python
122+
```yaml
121123
apiVersion: v1
122124
kind: Service
123125
metadata:
@@ -132,13 +134,13 @@ spec:
132134
```
133135
Your Django service is now publicly reachable.
134136
135-
```console
137+
```bash
136138
kubectl apply -f k8s/service.yaml
137139
```
138140

139-
### Validate Public Access
141+
### Validate public access
140142

141-
```console
143+
```bash
142144
kubectl get svc django-api
143145
```
144146

@@ -147,7 +149,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
147149
django-api LoadBalancer 34.118.226.245 34.45.23.92 80:31700/TCP 3h57m
148150
```
149151

150-
Please wait until the EXTERNAL-IP field gets populated! It will be needed in the next step.
152+
Wait until the EXTERNAL-IP field is populated. This is needed in the next step.
151153

152154
### Validate public access
153155

@@ -159,7 +161,7 @@ http://<EXTERNAL-IP>/healthz/
159161

160162
You should see output similar to the following:
161163

162-
![ Django health check alt-text#center](images/django_framework.png "Django Validation")
164+
![Screenshot showing Django health check endpoint returning a JSON response with status ok, indicating successful deployment and validation of the Django application running on GKE#center](images/django_framework.png "Django health check validation")
163165

164166
Your Arm-based Django API is live on the internet.
165167

@@ -171,6 +173,6 @@ You have deployed a fully cloud-native, Arm-optimized application:
171173
- Exposed through Google Cloud LoadBalancer
172174
- Backed by Cloud SQL PostgreSQL
173175
- Accelerated by Memorystore Redis
174-
- Delivered via Artifact Registry
176+
- Delivered through Artifact Registry
175177

176178
This is a real production architecture running on Arm in GCP.

0 commit comments

Comments
 (0)