Skip to content

Commit c8e2e08

Browse files
Update Django on GCP learning path content
1 parent e88542b commit c8e2e08

7 files changed

Lines changed: 86 additions & 76 deletions

File tree

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
@@ -1,5 +1,5 @@
11
---
2-
title: Get started with Django on Google Axion C4A (Arm Neoverse-V2)
2+
title: Get started with Django on Google Axion C4A (Arm Neoverse V2)
33

44
weight: 2
55

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,23 @@ cd ~/myproject/myproject/
5353

5454
Open `settings.py` using a text editor:
5555

56-
```bash
57-
edit myproject/settings.py
58-
```
59-
60-
- Locate the ALLOWED_HOSTS line
56+
```bash
57+
edit myproject/settings.py
58+
```
6159

62-
Inside the file, find the following line:
60+
Locate the `ALLOWED_HOSTS` line inside the file:
6361

6462
```python
6563
ALLOWED_HOSTS = []
6664
```
6765

6866
Update it to allow your VM's external IP address:
6967

70-
- Allow all hosts (for testing only)
71-
7268
To make your Django app accessible from your VM's external IP address, update it to:
73-
```python
74-
ALLOWED_HOSTS = ['*']
75-
```
69+
70+
```python
71+
ALLOWED_HOSTS = ['*']
72+
```
7673
{{% notice Note %}}
7774
For development and testing only, you can use `ALLOWED_HOSTS = ['*']` to allow all hosts. However, for production deployments, always specify explicit domain names or IP addresses such as `ALLOWED_HOSTS = ['your-external-ip', 'your-domain.com']`.
7875
{{% /notice %}}

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ab -V
3030

3131
The output displays the ApacheBench version.
3232

33-
### Install and configure Gunicorn
33+
## Install and configure Gunicorn
3434

3535
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.
3636

@@ -39,10 +39,12 @@ Before benchmarking your Django application, you need to install Gunicorn, a pro
3939
```bash
4040
python3 -m pip install django gunicorn
4141
```
42-
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.
4342

44-
### Run Django with Gunicorn
45-
Start your Django application using Gunicorn (already running inside GKE):
43+
This installs Django and Gunicorn. Gunicorn is 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.
44+
45+
## Run Django with Gunicorn
46+
47+
Your Django application runs with Gunicorn inside GKE:
4648

4749
Gunicorn is deployed inside your Kubernetes Pods and exposed through a Kubernetes Service and LoadBalancer.
4850
The benchmark is executed against the **external IP of the GKE service**.
@@ -51,7 +53,7 @@ The benchmark is executed against the **external IP of the GKE service**.
5153
Ensure your VM's firewall allows inbound traffic on port 8000. See the firewall setup section if you haven't already configured this.
5254
{{% /notice %}}
5355

54-
### Run the benchmark
56+
## Run the benchmark
5557

5658
Use ApacheBench to test your Django server with simulated traffic:
5759

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This guide converts your Django REST API into a production-grade Arm64 container
1313
### 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

16-
Create a file called: `requirements.txt` and insert the following:
16+
Create a file called `requirements.txt` and insert the following:
1717

1818
```text
1919
django
@@ -33,9 +33,9 @@ RUN pip install --no-cache-dir -r requirements.txt
3333
CMD ["gunicorn","django_api.wsgi:application","--bind","0.0.0.0:8000","--workers","3"]
3434
```
3535

36-
You now have a container blueprint that can run Django in production using Gunicorn on Arm64.
36+
This Dockerfile defines how to build your Django container for production deployment.
3737

38-
### Build and push
38+
### Build and push the image
3939

4040
Build the image on an Arm machine and push it to Artifact Registry, ensuring Kubernetes pulls an Arm-native image.
4141

@@ -53,7 +53,7 @@ Push the built image:
5353
docker push us-central1-docker.pkg.dev/PROJECT_ID/django-arm/api:1.0
5454
```
5555

56-
Your Django API is now stored in Google’s private container registry and ready for GKE.
56+
The image is now stored in Artifact Registry and ready for deployment.
5757

5858
### Deploy to GKE
5959

@@ -112,9 +112,10 @@ NAME READY STATUS RESTARTS AGE IP NO
112112
django-api-XXXXXX 1/1 Running 0 3h52m 10.0.2.9 gke-django-axion-cluster-axion-pool-xxxxxxx <none> <none>
113113
django-api-XXXXXX 1/1 Running 0 3h52m 10.0.1.9 gke-django-axion-cluster-axion-pool-xxxxxxx <none> <none>
114114
```
115-
Your Django API is now running as replicated containers on Axion Arm64 nodes.
116115

117-
### Create Kubernetes service (LoadBalancer)
116+
The Django API is running as replicated containers on Axion Arm64 nodes.
117+
118+
### Create a Kubernetes service (LoadBalancer)
118119
A Service exposes your pods to the internet using **Google Cloud’s managed load balancer**.
119120

120121
Create `k8s/service.yaml`:
@@ -132,7 +133,8 @@ spec:
132133
- port: 80
133134
targetPort: 8000
134135
```
135-
Your Django service is now publicly reachable.
136+
137+
Apply the service configuration:
136138
137139
```bash
138140
kubectl apply -f k8s/service.yaml
@@ -149,7 +151,7 @@ NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
149151
django-api LoadBalancer 34.118.226.245 34.45.23.92 80:31700/TCP 3h57m
150152
```
151153

152-
Wait until the EXTERNAL-IP field is populated. This is needed in the next step.
154+
Wait until the `EXTERNAL-IP` field is populated before proceeding.
153155

154156
### Validate public access
155157

@@ -161,11 +163,11 @@ http://<EXTERNAL-IP>/healthz/
161163

162164
You should see output similar to the following:
163165

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")
166+
![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 alt-txt#center](images/django_framework.png "Django health check validation")
165167

166-
Your Arm-based Django API is live on the internet.
168+
The Arm-based Django API is now accessible over the internet.
167169

168-
### What youve accomplished
170+
## What you've accomplished and what's next
169171
You have deployed a fully cloud-native, Arm-optimized application:
170172

171173
- Django REST API

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Finally, run:
3434
django-admin startproject django_api .
3535
django-admin startapp api
3636
```
37-
You now have a Django project skeleton with all required libraries installed for database, cache, and API support.
37+
38+
The Django project structure is ready with all required libraries for database, cache, and API support.
3839

3940
### Enable Django apps
4041

@@ -57,9 +58,9 @@ INSTALLED_APPS = [
5758
]
5859
```
5960

60-
Your Django project is now configured to run as an API server instead of a development-only web app.
61+
Django is configured to run as an API server.
6162

62-
Configure PostgreSQL and Redis
63+
### Configure PostgreSQL and Redis
6364

6465
This step connects Django to external managed services instead of local SQLite. This mirrors how real production systems operate.
6566

@@ -91,21 +92,21 @@ CACHES = {
9192
}
9293
```
9394

94-
Edit the above edition and set REDIS_IP to the actual IP address that you saved earlier.
95+
Edit the above addition and set `REDIS_IP` to the actual IP address that you saved earlier.
9596

96-
Your application is now wired to a real database and cache, making it production-grade.
97+
The application is configured to use PostgreSQL and Redis.
9798

98-
### Migrate database
99+
### Migrate the database
99100
Django creates tables, metadata, and user models inside PostgreSQL.
100101

101102
```bash
102103
python manage.py migrate
103104
python manage.py createsuperuser
104105
```
105106

106-
PostgreSQL instance now contains all Django system tables and is ready to store application data.
107+
The PostgreSQL instance contains all Django system tables.
107108

108-
### Create health API
109+
### Create a health API endpoint
109110

110111
A health endpoint allows Kubernetes and load balancers to verify if the service is running.
111112

@@ -131,8 +132,7 @@ urlpatterns = [
131132
]
132133
```
133134

134-
135-
You now have a Kubernetes-compatible health endpoint.
135+
The health endpoint is configured.
136136

137137
### Validate locally
138138
Before containerizing or deploying, validate that everything works end-to-end.
@@ -152,15 +152,17 @@ The expected output is:
152152
```output
153153
{"status":"ok"}
154154
```
155-
Your Django API is fully functional with PostgreSQL and Redis connected.
156155

157-
### What you've accomplished
158-
You now have a cloud-ready Django REST API that:
156+
The Django API is functional with PostgreSQL and Redis connected.
157+
158+
## What you've accomplished and what's next
159+
160+
In this section, you built a cloud-ready Django REST API that:
159161

160-
- Uses PostgreSQL for durable data
162+
- Uses PostgreSQL for persistent data storage
161163
- Uses Redis for caching
162-
- Exposes a health endpoint for Kubernetes
163-
- Is ready to be containerized and deployed on GKE Axion (Arm)
164+
- Exposes a health endpoint for Kubernetes probes
165+
- Is ready for containerization and deployment on GKE Axion
164166

165-
This is the exact backend you will deploy in the next stage of the learning path.
167+
Next, you'll containerize this application and deploy it to your Axion-powered GKE cluster.
166168

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@ To create a virtual machine based on the C4A instance type:
3838
## Create the instance
3939

4040
Click **Create** to launch your VM instance. Google Cloud provisions the instance, which typically takes one to two minutes.
41-
Once the instance is running, you'll see it listed in the VM instances table with a green checkmark. Note the External IP address displayed in the listyou'll need this to access your Django application later.
41+
Once the instance is running, you'll see it listed in the VM instances table with a green checkmark. Note the External IP address displayed in the list; you'll need this to access your Django application later.
4242

4343
## Connect using SSH
4444

4545
Click the **SSH** button next to your running instance to open a browser-based terminal session.
4646

47-
![Screenshot of the VM instances list showing the SSH button next to a running instance. The external IP address is visible in the same row#center](images/gcp-pubip-ssh.png "Launching an SSH session from the VM instances list")
47+
![Screenshot of the VM instances list showing the SSH button next to a running instance. The external IP address is visible in the same row alt-txt#center](images/gcp-pubip-ssh.png "Launching an SSH session from the VM instances list")
4848

4949
A browser window opens with a terminal shell connected to your VM. You're now ready to install Django.
5050

51-
![Screenshot of a terminal shell in the browser, connected to the running VM instance. The shell displays a command prompt ready for input#center](images/gcp-shell.png "Terminal shell connected to your VM")
51+
![Screenshot of a terminal shell in the browser, connected to the running VM instance. The shell displays a command prompt ready for input alt-txt#center](images/gcp-shell.png "Terminal shell connected to your VM")
5252

53-
## Summary and what's next
53+
## What you've accomplished and what's next
5454

55-
You have successfully provisioned an Arm-based VM on Google Cloud. Next, you'll install Django and configure your web application.
55+
In this section, you provisioned a Google Axion C4A Arm VM and connected to it using SSH.
56+
57+
Next, you'll install Django and the required dependencies on your VM.

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

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
title: Deploy Django on GKE Axion (Arm) with Managed Data Services
2+
title: Deploy Django on GKE Axion (Arm) with managed data services
33
weight: 7
44

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

9-
## Overview
10-
This guide deploys a **container-native Django REST API** on **Google Kubernetes Engine (GKE)** running on **Axion (ARM64)** nodes.
9+
## Deploy Django REST API on GKE Axion with Cloud SQL and Redis
10+
This guide deploys a container-native Django REST API on Google Kubernetes Engine (GKE) running on Axion (ARM64) nodes.
1111

1212
The application integrates with:
1313

14-
- **Cloud SQL (PostgreSQL – private IP)**
15-
- **Memorystore (Redis)**
16-
- **Artifact Registry**
17-
- **Kubernetes LoadBalancer**
14+
- Cloud SQL (PostgreSQL – private IP)
15+
- Memorystore (Redis)
16+
- Artifact Registry
17+
- Kubernetes LoadBalancer
1818

1919
Performance is validated using **throughput** and **p95 latency**, allowing you to evaluate how an Arm-based Kubernetes platform behaves under real application load.
2020

@@ -33,9 +33,14 @@ GKE (Axion Arm64)
3333
|
3434
|---> Memorystore (Redis)
3535
```
36+
3637
This architecture represents a production-grade microservice deployment where compute runs on Arm, while data services are provided through fully managed GCP offerings over private networking.
3738

38-
## Enable the SUSE Containers module
39+
## Set up the infrastructure
40+
41+
The following sections guide you through provisioning all required GCP services.
42+
43+
### Enable the SUSE Containers module
3944

4045
Enable the SUSE Containers Module to ensure that Docker and container-related tools are fully supported.
4146
```bash
@@ -139,9 +144,10 @@ gcloud artifacts repositories create django-arm \
139144
sudo chmod 777 /etc/containers
140145
gcloud auth configure-docker us-central1-docker.pkg.dev
141146
```
142-
You now have a secure, private Docker registry ready to store Arm-based application images for GKE.
143147

144-
### Create GKE control plane
148+
Artifact Registry is configured to store your container images.
149+
150+
### Create the GKE control plane
145151

146152
Create the Kubernetes control plane that manages scheduling, networking, and workloads. Initially create it with a small node pool so the cluster can bootstrap.
147153

@@ -151,9 +157,9 @@ gcloud container clusters create django-axion-cluster \
151157
--machine-type c4a-standard-4 \
152158
--num-nodes 1 \
153159
--enable-ip-alias
154-
```
160+
```
155161

156-
You now have a running GKE cluster ready to accept custom node pools and workloads.
162+
The GKE cluster is running.
157163

158164
### Configure kubectl access to GKE
159165

@@ -216,9 +222,10 @@ gcloud container node-pools delete default-pool \
216222
--cluster django-axion-cluster \
217223
--zone us-central1-a
218224
```
219-
Your Kubernetes cluster now runs **exclusively on Axion Arm64 nodes**, ensuring native Arm execution.
220225

221-
### Create Cloud SQL (PostgreSQL – private IP)
226+
The Kubernetes cluster runs exclusively on Axion Arm64 nodes.
227+
228+
### Create Cloud SQL (PostgreSQL with private IP)
222229

223230
Cloud SQL provides a fully managed PostgreSQL database. Private IP ensures traffic stays inside Google's private network, improving security and performance.
224231

@@ -262,9 +269,7 @@ gcloud sql instances describe django-postgres \
262269
--format="value(ipAddresses[0].ipAddress)"
263270
```
264271

265-
Save this value as **CLOUDSQL_IP**.
266-
267-
You now have a private, production-grade PostgreSQL database that can be securely accessed from GKE.
272+
Save this IP address as **CLOUDSQL_IP** for later use.
268273

269274
### Create Memorystore (Redis)
270275
Redis is used for caching, sessions, and background job coordination. Memorystore provides a fully managed Redis service that scales and stays highly available.
@@ -279,17 +284,17 @@ gcloud redis instances describe django-redis \
279284
--region=us-central1 \
280285
--format="value(host)"
281286
```
282-
Save this value as **REDIS_IP**.
283287

284-
You now have a **managed Redis cache** available to your Django application over private networking.
288+
Save this IP address as **REDIS_IP** for later use.
285289

286-
### What you've accomplished
287-
You have created:
290+
## What you've accomplished and what's next
288291

289-
- An Axion-based GKE cluster
290-
- Private PostgreSQL
291-
- Redis Memorystore
292-
- Artifact Registry
292+
In this section, you created the complete infrastructure for your Django deployment:
293+
294+
- Axion-based GKE cluster with Arm64 node pools
295+
- Private Cloud SQL PostgreSQL instance
296+
- Memorystore Redis instance
297+
- Artifact Registry for container images
293298

294-
In the next stage, you will package Django into an **Arm-native container**, push it to Artifact Registry, and deploy it onto this platform.
299+
Next, you'll build a Django REST API that connects to these services, then containerize and deploy it to your Axion GKE cluster.
295300

0 commit comments

Comments
 (0)