Chapters

The Kadé scenario

Every chapter uses the same small company and the same addresses, so each new idea lands on something you have already seen. Come back to this page whenever an address looks unfamiliar.

Start here · Reference, read this first · 3 min read

The story

Kadé is a small online grocery shop in Colombo. Customers order from a mobile app and a website. Both call one backend at api.kade.lk.

You are Kadé's backend engineer. You work from home on your laptop, on your home WiFi. The backend runs in Google Cloud (GCP): one VM for the API and one VM for the database.

Kadé starts simple on purpose. As the course goes on, we will hit real problems with this setup and fix them, adding the pieces real systems use.

The map

home · Colombo · 192.168.1.0/24Laptop.23 · youPhone.40Smart TV.52Printer.60Home routerLAN side 192.168.1.1WAN side 203.0.113.45 (public)api.kade.lk → 34.87.120.15InternetISP + many routersGCP asia-southeast1 · kade-vpc 10.10.0.0/16sn-app · 10.10.1.0/24kade-api (VM, Node app)internal 10.10.1.10external 34.87.120.15sn-data · 10.10.2.0/24kade-db (VM, PostgreSQL)10.10.2.5 · port 5432SQL queriesKadé office · 172.16.0.0/16Office routerstaff .1.0/24 · warehouse .2.0/24WAN 198.51.100.20added in later chaptersLoad balancerHTTPS front doorCloud NATfixed outgoing IPPayGatepayment providerVPNoffice ↔ cloud

Solid boxes exist today. Dashed boxes join the map when a chapter needs them. The map on this page is updated as they arrive.

Wide by design - scroll it sideways.

Address book

#PlaceThingAddressFirst used
1HomeHome network (LAN)192.168.1.0/24Ch 3
2HomeRouter, LAN side192.168.1.1MAC 3c:84:6a:10:ee:01Ch 1
3HomeRouter, WAN side (public)203.0.113.45Ch 3
4HomeYour laptop192.168.1.23MAC a4:83:e7:2b:91:0cCh 1
5HomePhone, smart TV192.168.1.40, 192.168.1.52Ch 1
6HomePrinter (reserved address)192.168.1.60MAC 00:1b:a9:44:7c:21Ch 3
7HomeISP's gateway for the home router203.0.113.1Ch 5
8DNSKadé's API nameapi.kade.lk → 34.87.120.15Ch 1
9GCPkade-vpc10.10.0.0/16Ch 3
10GCPSubnet sn-app10.10.1.0/24gateway 10.10.1.1Ch 3
11GCPkade-api VM10.10.1.10 internal34.87.120.15 externalCh 1
12GCPSubnet sn-data10.10.2.0/24Ch 3
13GCPkade-db VM10.10.2.5, port 5432Ch 4
14OfficeOffice router, WAN side198.51.100.20ISP gateway 198.51.100.1Ch 6
15OfficeStaff network172.16.1.0/24router eth1 172.16.1.1Ch 6
16OfficeFront desk PC, manager laptop, office printer.10, .11, .20Ch 6
17OfficeWarehouse network172.16.2.0/24router eth2 172.16.2.1Ch 6
18OfficeStock scanner, packing PC, label printer.10, .11, .20Ch 6
19DNSkade.lk zone, hosted in GCP Cloud DNSns-cloud-a1…a4.googledomains.comCh 22
20EmailStaff mail: Google Workspace · bulk mail: an email providerMX 1 smtp.google.comCh 23
21IPv6 (planned)Office prefix from LankaNet · staff /64 · warehouse /642001:db8:5c00::/48 · …:1::/64 · …:2::/64Ch 30
22GCPExternal Application Load Balancer; from ch 33, api.kade.lk points here34.120.88.10 (anycast)Ch 33
23GCPkade-api-1, kade-api-2 behind the load balancer (no external IPs)10.10.1.10:8080 · 10.10.1.11:8080Ch 33
All addresses are examples. 203.0.113.x and 198.51.100.x are ranges set aside for documentation, so they never belong to a real home or office. Chapter 2 lists the other special ranges.

MAC addresses used from chapter 7 on:

#DeviceIPMAC
1Your laptop (WiFi)192.168.1.23a4:83:e7:2b:91:0c
2Home router, LAN / WAN side192.168.1.1 / 203.0.113.453c:84:6a:10:ee:01 / :02
3Phone (random private MAC)192.168.1.405e:1a:0b:c3:77:e2
4Front desk PC / manager laptop172.16.1.10 / .113c:7c:3f:10:22:01 / f0:18:98:6d:2e:44
5Office printer172.16.1.2030:05:5c:8a:12:e0
6Packing PC (same maker as front desk PC)172.16.2.113c:7c:3f:10:9e:47
7Office router eth1172.16.1.1e4:8d:8c:00:01:01
8kade-api (set by GCP)10.10.1.1042:01:0a:0a:01:0a

What gets added later

Planned additions, each tied to a real problem. The list will change as the course goes on.

Kadé office (arrived in ch 6)Two private networks behind one router. Staff will later need to reach kade-db without going over the public internet.
Load balancerkade-api's public IP goes away. A load balancer becomes the front door, handles HTTPS and spreads traffic over more VMs.
PayGate + Cloud NATThe payment provider only accepts calls from IPs on its allow list, so Kadé needs a fixed outgoing IP (34.87.200.7) for VMs without external IPs (chapter 10).
VPNConnects the office LAN to kade-vpc privately.
Firewall rulesOnly kade-api may talk to kade-db on port 5432.

Spotted a mistake, or something unclear? Suggest an edit on GitHub