Checking your sign-in…
This lesson is in Phase 1 — ₹399, one-time
Pay once with UPI, card or netbanking. Keep it forever. Your progress saves, so you can stop and come back.
← Back to all lessonsStart Here — Phase 1: The Data Tier
Phase 1 · The Data TierWhat this is and why it matters
Phase 1 teaches you how data moves, copies itself, and survives a crash.
In real systems, the worst moment is losing data or going down when one machine dies.
You run small practice systems on your own computer, using fake data, and finish with one fake order flowing through five tools.
Think of it like a small shop.
- Orders come in at the front desk.
- The orders wait in a line until a worker picks them up.
- The worker writes each order in a record book.
- A second record book copies every line, in case the first book is lost.
- A fast notebook on the counter keeps small answers ready, so nobody has to open the big book for every small question.
- Files like receipts go in a big file cupboard.
- A traffic guard at the door sends each visitor to a different worker, so no one worker gets all the visitors.
- If the main record book is destroyed, the copy takes over, and work continues.
Phase 1 builds that shop on your own computer, with fake orders and fake names.
Who this is for
A beginner who can already use a terminal and Docker. If you cannot yet, do Phase 2 first — it teaches Linux, Git and Docker from zero. You need only a computer and internet. No paid tool is needed anywhere in this phase. Every lab runs on your own machine with Docker. No cloud account. No card.
A note on order — read this before you start
This page and Lesson 0 say two things that can confuse a beginner, so here they are side by side.
- Lesson 0 (phase1/lesson-0.md) says: do Lesson 0 first, then go to Phase 1.
- This page says: if you cannot yet use a terminal and Docker, do Phase 2 first, because Phase 2 teaches Linux, Git, and Docker from zero.
Both are true. The order that fits both lines is:
- Do Lesson 0 first. It teaches the words, installs Docker, and checks Docker works.
- If Lesson 0 felt hard, or you have never used a terminal before, do Phase 2 next. Phase 2 teaches the basics from zero. Its file is phase2/start-here.md, and its first hands-on lab is phase2/zero-cost-lab.md.
- Then come back and do Phase 1 in the lab order below.
Do not jump to the last lab first. Do the labs in order. Reading alone is not enough. At every step, do the commands yourself.
Fake data only
Every example in this phase uses made-up data: fake orders, fake names, fake file names. Nothing here is real data from any real system or company. When you build your own version later, use your own test data the same way — never copy real data into a practice setup.
Here is one fake order, exactly as it appears in the end-to-end lab's file phase1/end-to-end/incoming/order-001.json:
{"amount":250,"buyer":"Asha","id":101,"item":"notebook"}Read it as: order number 101, a notebook, bought by a made-up buyer called Asha, for 250. Asha is not a real person. The other two starter orders are a pen for 40 and a mug for 350.
Words you need, before you use them
- Service. One running program in a Docker Compose file. Example: one record store is one service. A service is the name in the recipe file. A container is the running box that the service starts. One service usually starts one container.
- Container. A small sealed box that holds one program and what it needs to run.
- Compose. A tool that starts several containers together from one file. That file is called
docker-compose.yml. - Topic. A named line of messages in Kafka. Example: a topic called
ordersis one named line, like order slips on a kitchen rail. - Producer. A program that puts messages into Kafka.
- Consumer. A program that takes messages out of Kafka and does the work.
- Primary. The main copy of a record store. It takes writes. A write is adding or changing a record.
- Replica / standby. A copy that follows the primary. It takes reads only. A read is asking for a record without changing it. The standby becomes the new primary on failover.
- Replication. Keeping a second copy up to date. The main record store writes down everything it does, and the standby copy reads that list and does the same things, so it is almost as new as the main one.
- WAL. Short for write-ahead log. The list of changes a record store writes down first, before it changes the real data. The replica reads this list to stay in sync. WAL streaming means the replica reads that list live, as changes happen, instead of in one big batch later.
- Failover. The standby taking over. When the main one dies, the standby becomes the new main one, and work continues.
- Port. A numbered door on your computer.
5432is the usual door for PostgreSQL (the main database; its standby copy answers on door5433),6379for Redis,9092for Kafka,9000for the object store (Moto),80for a website. - localhost. This machine. When a lab says open
http://localhost:8080, it means your own machine, door number 8080. Thehttp://part means "open this as a web page". The number8080is a real door number in this phase — the load-balancer lab uses it — but it is only one lab's door. Each lab names its own door numbers; do not assume 8080 works everywhere. - Kafka. A message queue. Think of it as a line of messages waiting in order. One program puts a message in the line. Another program takes messages out of the line and does the work. If the worker is slow or stops, the messages wait safely in the line.
- PostgreSQL. The main record book. A record store that keeps your real records (orders, users, settings) in tables, and keeps them safe even when the power goes out. A table is a grid of rows and columns, like a spreadsheet page.
- Patroni. A watcher for PostgreSQL. It watches the main record store. If the main one dies, Patroni promotes the standby copy to be the new main one, by itself. "By itself" means nobody types a command — that is the difference from the PostgreSQL lab's first part, where you promote the standby by hand with your own command (
SELECT pg_promote();). The lab's Part 1 is by hand; its Part 2 is Patroni doing it for you. - Redis. A fast memory store. It keeps small answers in memory so your app can read them in a blink, instead of asking the record store every time. It is also used as a simple counter and a short-term waiting room.
- Object store. A big file cupboard. It stores files (pictures, documents, uploads) by name. You ask for a file by its name and you get it back.
- Moto. The free stand-in used in this kit for an object store. It speaks the same S3 language as the paid stores, so what you learn here transfers. S3 is the name of a well-known paid file storage service. "Speaks the same language" means Moto accepts the same commands as that paid service. You do not need an S3 account. Moto runs on your own machine.
- Load balancer. A traffic guard. It stands in front of three copies of your app and sends each visitor to a different copy, so no single copy gets all the work. If one copy dies, it sends visitors to the copies that are still alive.
- NGINX. A free program that does the load balancer job in this kit. It teaches the same idea as the paid boxes that do this job in big companies. One paid box the lesson names is called F5. F5 is a brand name for a paid traffic-guard box. You do not need F5. The kit uses NGINX instead, because it is free.
- MirrorMaker 2. A tool that copies messages from one Kafka to a second Kafka. The Kafka lab teaches it, in its own steps. You do not need to know it before that lab.
- Terminal. A plain window where you type commands instead of clicking.
The map — what each thing does, in plain words
Read this first. One idea per line.
- Kafka — a message queue. Think of it as a line of messages waiting in order. One program puts a message in the line. Another program takes messages out of the line and does the work. If the worker is slow or stops, the messages wait safely in the line.
- PostgreSQL — the main record book. A database that stores your real records (orders, users, settings) in tables, and keeps them safe even when the power goes out.
- Patroni — a watcher for PostgreSQL. It watches the main database. If the main one dies, Patroni promotes the standby copy to be the new main one, by itself.
- Redis — a fast memory store. It keeps small answers in memory so your app can read them in a blink, instead of asking the database every time. It is also used as a simple counter and a short-term waiting room.
- Object store — a big file cupboard. It stores files (pictures, documents, uploads) by name. You ask for a file by its name and you get it back. Moto is the free stand-in used in this kit — it speaks the same S3 language as the paid stores, so what you learn here transfers.
- Load balancer — a traffic guard. It stands in front of three copies of your app and sends each visitor to a different copy, so no single copy gets all the work. If one copy dies, it sends visitors to the copies that are still alive. A paid box called F5 does this job in big companies. This kit uses NGINX instead — it is free, and it teaches the same idea.
- Replication — keeping a second copy up to date. The main database writes down everything it does, and the standby copy reads that list and does the same things, so it is always almost as new as the main one.
- Failover — the standby taking over. When the main one dies, the standby becomes the new main one, and work continues.
How they fit together — one generic system
- A visitor arrives. The load balancer sends them to one of three copies of the app.
- The app takes the order and puts a message on Kafka. The message waits in line.
- A worker takes the message from Kafka and saves the order in PostgreSQL.
- The worker also writes a quick count in Redis, so the app can show "how many orders" without asking the database.
- Any files (like a receipt) go into the object store.
- PostgreSQL copies every change to its standby. Kafka copies its messages to its standby too.
- If the main database dies, Patroni (or your own command in the lab) promotes the standby. Work continues. In the PostgreSQL lab, Part 1 is your own command; Part 2 is Patroni.
The order — do the labs in this order
- kafka-lab.md — send and receive messages, then copy them to a second Kafka with MirrorMaker 2. (About 1 day.)
- postgresql-lab.md — a main database and a standby copy, streaming replication, then failover. Includes a Patroni part. (About 2 days.)
- redis-lab.md — a fast cache, expiry, counters, and what two-way sync means. (About half a day.) A cache is a fast copy of an answer, kept so you do not have to ask the slow record store again. Expiry is a time limit after which a saved answer deletes itself. Two-way sync means two stores both accept writes and merge them.
- object-store-lab.md — store files in Moto, copy them to a second store. (About half a day.)
- load-balancer-lab.md — NGINX in front of three backends. Kill one backend and watch the site stay up. (About half a day.) A backend is one copy of your app that sits behind the load balancer and does the work.
- end-to-end-lab.md — all of it together, on one machine, with one command. A fake order flows from a file to the database, then you kill the main database and watch the standby take over. (About 1 day.)
Rough total: about 1 week at 1–2 hours a day, after Phase 2. "About 1 day" means one study session of 1–2 hours, not a full 24 hours. "Done" for a lab means you saw every "you should see" output in that lab, and you saved its proof.
What you need before you start
- Docker running on your machine. Lesson 0 shows how to install it and check it. Phase 2 also teaches it from zero.
- A terminal. All commands run in a terminal.
- About 4 GB of free disk space. The lab images are big. An image is the recipe Docker uses to build a container. To check your free space, use the way your own computer shows storage — on Windows, open Settings, then Storage; on Mac, open the Apple menu, then About This Mac, then Storage. The kit doctor script in Step 3 below also checks disk space for you and prints a FIX line if it is short. If you have less than 4 GB free, free space first.
- A machine with at least 4 GB of memory. Memory is the fast working space your computer uses while programs run. The end-to-end lab runs eleven small services at once. Here they are, each with its job:
kafka(the message line),postgres-primary(the main record store),postgres-replica(its standby copy),redis(the fast memory store),moto(the file cupboard),lb(the traffic guard),web1,web2,web3(the three copies of the app behind the guard),ingest(reads a new order file and sends it on), andworker(takes orders from the line, saves them, and updates the count). You will meet all eleven inside the end-to-end lab. On a 2 GB machine it will be slow. If it is slow, run the single-topic labs one at a time instead. - All passwords in this phase are practice passwords on your own machine, for learning only. Never use them anywhere real.
Step 1 — Find the phase1 folder
What this is: the folder that holds this whole phase.
Why we do it: every command in this phase runs from inside phase1 or inside one of its lab folders. If you are in the wrong folder, the commands cannot find their files.
After unzipping, the Phase 1 zip unzips into one folder called phase1. It holds:
- phase1/start-here.md — this file: the map of the whole phase.
- phase1/lesson-0.md — the true-beginner start: what the words mean, how to install Docker, first checks.
- The 6 lab guides: phase1/kafka-lab.md, phase1/postgresql-lab.md, phase1/redis-lab.md, phase1/object-store-lab.md, phase1/load-balancer-lab.md, phase1/end-to-end-lab.md.
- phase1/error-decoder.md — find your error message, read the fix.
phase1/portfolio/— a README template and blank proof forms. When a lab says "save your proof", the proof goes inphase1/portfolio/proof/. The blank forms there end in-TEMPLATE.txt. You copy a template and fill in your own numbers. The two blank forms arephase1/portfolio/proof/end-to-end-trace-TEMPLATE.txtandphase1/portfolio/proof/failover-log-TEMPLATE.txt. The folderphase1/portfolio/proof/is verified to exist on disk.- One folder per lab (
phase1/kafka-lab,phase1/postgresql-lab,phase1/redis-lab,phase1/object-store-lab,phase1/load-balancer-lab,phase1/end-to-end), each with itsdocker-compose.yml— the list of containers for that lab. You do not read or change it; the lab steps tell you the commands to run. phase1/kit-doctor.sh— checks your machine before you start.phase1/reset.sh— wipes one lab's data and starts it fresh.
Step 2 — Make the lab files readable
What this is: chmod changes who can read a file.
Why we run it: some lab files must be readable by the programs inside the containers, and a zip file can strip that permission. If a file is not readable, the program inside the container cannot open it, and the lab fails.
Run this once, from inside the kit folder. "The kit folder" here means the phase1 folder. Move your terminal into phase1 first, then type this and press Enter:
chmod -R a+r .Word by word:
chmod— short for "change mode". It changes who can read a file.-R— means do this for every file in this folder, and in every folder inside it.a+r— means everyone can read. The letterameans all users. The letterrmeans read. The+means add this permission..— means this folder, the one your terminal is in right now. A single dot is shorthand for "here".
What you should see: nothing. chmod prints nothing when it works. That is normal. Silence means it worked. If a lab later says a file is not readable, you probably ran this command in the wrong folder. Move into the phase1 folder and run it again.
Two labs in this phase call for this same step in their own steps, so you will meet it again there: the PostgreSQL lab (Part 1, Step 1) and the end-to-end lab. Running it once here covers both, but follow each lab's step when you reach it.
Step 3 — Run the kit doctor script
What this is: kit-doctor.sh is a saved list of checks. It checks Docker, ports, disk, and memory, and prints a plain-English FIX line for anything wrong.
Why we run it: it finds setup problems before you start a lab, instead of halfway through one.
Type this in your terminal, while you are inside the phase1 folder, then press Enter:
bash kit-doctor.shWord by word:
bash— the program that runs script files. It reads the script and runs its commands one by one.kit-doctor.sh— the name of the script file. It lives in thephase1folder. That is why you must be insidephase1first.
What you should see: a line starting with OK: for every check. Your numbers will be different from the example in Lesson 0. What matters is OK on every line, not the exact words. A line starting with FIX means that one check failed. Do what the FIX line says, then run the script again.
Step 4 — Start the first lab
What this is: the first lab in the order, Kafka.
Why we start here: the map builds in order. Kafka is the line of messages. Everything after it uses that idea.
Open the file phase1/kafka-lab.md and follow it step by step, one step at a time, in order. Do not jump to the end-to-end lab before you can run Kafka and PostgreSQL alone.
Step 5 — If you get stuck
Do these three steps, in order.
- Run the doctor script again, as in Step 3, from inside the
phase1folder. It prints a FIX line for each problem. - Look the exact error line up in the Error Decoder. That is the file phase1/error-decoder.md. Copy the error line from your terminal, find it in that file, and follow the fix it gives.
- Email support@promptstudioai.in with the exact error line and the step you were on. The lesson says the team replies within 24 hours.
How to use these files
- Every lab follows the same shape: what it is, what you need, then numbered steps. Each step says what to do, what you should see, and what to do if it breaks.
- Every command is copy-paste ready. Type it exactly as shown.
- "You should see" lines show the real output. If yours looks different, read the fix box under that step before moving on.
- All passwords in this phase are practice passwords on your own machine, for learning only. Never use them anywhere real.
Test status — read this first
This phase was written on 20 November 2026. Every lab file in this phase has its own test status at the top. The status means one of three things, and the lab file says which one:
- Run end-to-end — the lab was run start to finish on a clean machine and every "you should see" line matched.
- Syntax-checked only — the files were checked for correct syntax (YAML, shell, Python), but the lab was not run end-to-end. Follow it, and if a step fails, read the error first — that is the real skill. YAML is the plain-text format of the
docker-compose.ymlfiles. Shell is the language of the.shscript files. Python is the language some lab helper files are written in. - Not tested — the step is written from the tool's own docs and is marked clearly. Do not trust it blindly; check the tool's docs if it fails.
No lab in this kit claims a test that did not happen.
The per-lab status, read from the top of each lab file: all six labs in this phase are syntax-checked only (20 November 2026) — Kafka, PostgreSQL, Redis, object store, load balancer, and end-to-end. None of them was run end-to-end on the machine that wrote them.
What this phase will NOT promise
No job guarantee. No salary number. This phase teaches skills and helps you build proof. Hiring depends on the employer, the market, and your interview — things no kit can promise.
Advanced — Restart policies and Dockerfile gotchas (map)
This file is a map, not a lab, so this section is a map too: it names the advanced ideas and points at the lab that teaches each one hands on. The Dockerfile build itself lives in the zero-cost lab's Advanced section — that is the build the Phase 2 start page promises. Do it there.
Restart policies: what happens when a container dies
What this is: a restart policy tells Docker what to do when a container stops by itself — start it again, or leave it stopped. Why it matters: the end-to-end lab's ingest and worker services already use one. Open phase1/end-to-end/docker-compose.yml and you will see restart: unless-stopped on both of them. That line is why the worker comes back by itself after a crash instead of staying dead.
The four values, in plain words:
no— the default. Never restart. The container stays dead until a human starts it. Right for one-off jobs, wrong for anything that must stay up.always— restart it every time it stops, even if you stopped it on purpose, and start it again when Docker itself restarts. Right for services that must always run.unless-stopped— likealways, but if you stopped it on purpose, it stays stopped. This is the usual right answer for long-running services, and the one the end-to-end lab uses.on-failure— restart it only if it stopped with an error (not if it finished cleanly). Right for jobs that should retry on failure but not loop forever on success. You can add a retry count:on-failure:3means try three times, then stop.
On the command line the same idea is a flag: docker run --restart unless-stopped .... The rule: every container that must stay up gets a restart policy. A container with no policy is a service that dies quietly at 3am.
Dockerfile gotchas, in one place
What this is: the list of mistakes every beginner makes with Dockerfiles, so you can skip them. The hands-on version of each one is in the zero-cost lab's Advanced section.
- Pin the base image tag. Every compose file in this phase pins its images (
postgres:16-alpine,redis:7-alpine,nginx:1.27-alpine). Do the same in Dockerfiles.nginxwith no tag means "the newest version" — and the newest version moves under you. A build that worked yesterday can break today, with nothing changed in your file. - Order the layers for the cache. Docker rebuilds a layer whenever a layer above it changed. Copy the dependency list first, install dependencies, then copy your code last — so changing one line of code does not reinstall everything.
- Keep the build folder small.
docker build .sends the whole folder to Docker. A.dockerignorefile lists what to leave out (.git, secrets, big data files) — the same idea as.gitignore, for the build. - Never bake a secret into the image. A password or key copied into the image stays in the image forever, and anyone with the image can read it. Secrets come from the environment or a secrets store at run time, never from the Dockerfile.
- One process per container. A container runs one main program. If you need two programs, run two containers. That is why this kit's labs have one container per service.
- The image runs as root by default. Name it as a risk: a process running as root inside a container that escapes is a process running as root on the machine. The fix is the
USERinstruction in the Dockerfile, at concept level for now.
What you can now say, truthfully — advanced
- "I can explain the four Compose restart policies and why the end-to-end lab's worker uses
unless-stopped." (Only if you read this section and the end-to-end compose file.) - "I know the Dockerfile gotchas: pin the tag, order the layers, ignore the junk, never bake in a secret." (Only if you read this section and did the zero-cost lab's Dockerfile build.)
Quick check — try it yourself
Question: In real systems, what bad problem does copying data help prevent?
Open the practice terminal to test this →
Show answer
It prevents losing your data or having the system go down when one machine dies.