Chapter 12: Technology Stacks — LAMP, LEMP, MEAN, MERN
Practice Questions and Lab Exercises
Practise running the private PHP catalog and JavaScript notes board in parallel. Stop only the notes database, compare both services and confirm the same data returns after recovery. Rehearse a full reboot separately on a dedicated lab host.
खाजगी lab मध्ये PHP catalog आणि JavaScript notes board एकत्र चालवा. फक्त notes database थांबवा, दोन्ही services तपासा आणि database पुन्हा सुरू झाल्यावर तोच data मिळतो का ते पाहा. पूर्ण reboot स्वतंत्र lab host वर तपासा.
निजी लैब में PHP catalog और JavaScript notes board साथ चलाएँ। केवल notes database रोकें, दोनों services जाँचें और फिर database चालू होने पर वही डेटा मिलता है या नहीं देखें। पूरा reboot अलग lab host पर जाँचें।
- Expand LAMP, LEMP, MEAN and MERN. Draw two actual request paths including any private listener or local socket.
- Show which choice changes when switching between the Apache and Nginx chapter catalogs. Check whether the current Apache app already uses PHP-FPM.
- Read the frontend project's actual build and start scripts. Identify which deployable output it produces and whether it needs a runtime.
- Explain how an explicit frontend path, a missing asset and an unknown API route receive different responses.
- Choose the supported MongoDB package source for your OS release, architecture and series, then validate the actual process and one authorized note read.
- Draw which peers need public, private and administrative network access for the chosen stack deployment.
- Lab. Run the private LAMP catalog and compare an exact PHP-backed product value with an independent SQL query.
- Lab. Run a separate LEMP experiment and prove which site and FastCGI route responded.
- Lab. Run the integrated MERN recovery and verify the recorded note ID after reopening its private MongoDB data directory.
- Lab. Build the Angular board and verify its browser artifact, API route and persisted result.
Got it? LAMP, LEMP, MEAN, MERN – four names, but one pattern: web server in front, app in the middle, database behind. Now let's move on to storage – Amazon EBS.
समजलं का? LAMP, LEMP, MEAN, MERN – चार नावं, पण पॅटर्न एकच: वेब सर्व्हर समोर, ॲप मध्ये, डेटाबेस मागे. आता पुढे जाऊया स्टोरेजकडे – Amazon EBS.
समझ आया? LAMP, LEMP, MEAN, MERN – चार नाम, पर पैटर्न एक ही: वेब सर्वर आगे, ऐप बीच में, डेटाबेस पीछे. अब आगे चलते हैं स्टोरेज की तरफ़ – Amazon EBS.
Quick Revision
- LAMP combines Linux, Apache, MySQL or a chosen alternative such as MariaDB, and PHP. LEMP uses Nginx for the HTTP entry and usually passes PHP through a separate worker.
- MEAN and MERN share MongoDB, Express and Node.js. Angular and React serve the interface role in their chosen render modes.
- For a self-managed MongoDB install, select the supported vendor repository and verify the actual listener, identity and store.
- Serve the browser files for a static client build. Map the intended frontend paths without hiding asset or API errors.
- Use the deployment’s maintained process supervisor and check actual HTTP and database readiness after a managed restart.
Extra labs
- Spring Boot and React. Pick a clear HTTP contract and check both its direct private and proxied responses after serving the frontend artifacts.
- Django and PostgreSQL. Identify the installed process manager and intended web and private database listeners, then compare one real application read with expected data.
- Listener review. Check the actual bindings and permitted peers. Keep local sockets and private connectivity separate from public HTTP access.
- Boot review. On a disposable dedicated host, check managed services and exact stored values before and after a planned reboot.
Expected results
| Check | Expected result |
|---|---|
| Catalog data | Stock starts at seven and becomes twelve after the authorized private SQL update. |
| Board entry | The known page and its fixed fixture bytes remain available through a notes database pause. |
| Notes data | The initial 201 gives an ID. It reads back through both HTTP paths, then returns 503 during the pause, and recovers with the same ID and text. |
| Missing API route | Returns the API's JSON 404 rather than the frontend entry. |
Everyday analogy: after shifting house, you check each switch, tap and lock before calling it done. Do the same after every deploy.
Beginner questions I get in class
Q. How long should these labs take?
About 1–2 hours per stack the first time, and much less later.
Key terms
- Stack: A set of technologies used together.
- SPA: A single-page application pattern. Its JavaScript often manages navigation and updates after the entry loads. Build and rendering mode depend on the project.
- REST API: A resource-oriented interface following REST constraints. JSON is one possible representation format.
- try_files: An Nginx directive that checks candidate paths and can use a final fallback target or status. Use it only where that routing behavior is intended.
- bindIp: The MongoDB setting for which addresses it listens on.
- ODM / ORM: Libraries that map objects to documents or tables, such as Mongoose, Hibernate, EF Core and Django ORM.
Mini case study
Suppose you support a Bengaluru e-commerce team with a PHP admin, a Node storefront and a Python report job on two EC2 instances. Draft a runbook naming each service owner, network entry, effective unit, deployment validation and relevant logs. List the public, private and administrative access your topology requires. State how to test a change while checking a neighboring site remains healthy.
Run two services and prove which one a change affected
Mauli Dairy now uses a PHP catalog for product stock and a JavaScript board for receiving notes. The catalog says how many milk cartons are currently available. The board tells the next shift what work was completed. Their operators share a lab machine but the services have different entry points, runtimes and storage. A trainee hears that the board can't load its notes and wants to restart every service. The shop asks for something different: use observations to identify the affected route and keep the catalog active while you restore the board's data.
This capstone lets you act as the maintainer. Start the previously built LAMP catalog and the React/Nginx board using the shared Express API. Change one fabricated stock item and create one identifiable receiving note. Compare the real responses before deliberately stopping just the notes database. Show which checks stay healthy and which fail. Then restore the same data files and prove the two recorded values are still correct. The goal is to show which service depends on which process and which observations justify a change.
The practice uses private test listeners and temporary database directories you own. Do not run the exercise on an existing public site or against live customer data. Its database pause is only for an intentionally disposable fixture. The main demonstration restarts one child database process, so it tests application recovery from that pause. A later question asks you to design a full managed-host reboot check. That is a different test and belongs on a separately provisioned lab host. Keep those claims precise in your notes.
You should be comfortable with Bash, HTTP status codes and running a command from a named terminal session. Review the stack role lesson before attempting the operational rehearsal. The comparison lesson discusses trade-offs between stacks. Here your task is demonstrating behavior for two concrete implementations. Assume the chosen curl requests use loopback and do not cross the network to a live website.
Draw the connections before starting either application
On the catalog side, a user asks Apache for a file or for the PHP catalog path. The static help file is served directly. Apache's configured FastCGI rule sends a matching dynamic request to PHP-FPM over its private socket. PHP checks the sku value and opens a separately configured MySQL socket to fetch one row. A socket is an endpoint for local process communication here, shown as a file path. The browser never opens that socket. It receives Apache's HTTP response.
On the notes side, the browser obtains React's built files from Nginx. The browser can then send an API request through the same origin. An origin includes scheme, host and port. Nginx relays the API path to a separate Express process, which reads and writes notes via Mongoose and its MongoDB connection. The exact compiled frontend bytes do not depend on the database in this client-rendered example. The notes list and save operations do. Node's liveness path simply answers whether its HTTP application can respond. Its readiness path asks the MongoDB instance for a ping. An allowed note lookup proves still more than either of those alone.
| Probe | Catalog fixture | Notes fixture |
|---|---|---|
| Known static response | /index.html contains the inventory help marker | /board/recent returns the built board entry |
| Application-owned response | /catalog.php?sku=MILK-1 makes a database-backed read | /api/notes/<id> reads the exact stored ID |
| Independent persistence check | Query the same SKU from the private MySQL session | Compare the same ID directly with the private Express interface |
| Intentional fault | Keep it healthy as the neighboring control | Pause only the private MongoDB child, then reopen its files |
A direct Express request still uses the same application and its data connection. It is independent of the Nginx route and browser, not a new MongoDB client. If you need to prove the MongoDB document directly, extend the learner probe from the Notes API lab. That lesson tests an independently opened database client. This capstone deliberately uses one direct backend control, an API comparison and a sandboxed stock query. A release report should state the layer each observation came from and what part of the whole chain it covers.
Draw both paths in a notebook with different colors or labels. Show the listening ports for the three HTTP paths and where each database listens. In the default run, Apache is on 18902, Nginx is on 18905 and the private Node API is on 18915, all bound to IPv4 loopback. The Linux stack names describe the production-style roles. Running the portable training binaries on a local supported operating system gives useful evidence about their request path, while Linux-specific packaging and boot remain separate work.
Prepare independent workspaces and choose the success criteria
Open three ordinary-user Bash sessions on the same dedicated lab machine. Label them Catalog, Notes and Probe so you don't run a command against a different service. Use compatible installed Apache, PHP CLI and FPM, Oracle MySQL Community, MongoDB Community, Nginx, Node.js and npm, as well as curl and Python 3. The linked labs explain tool paths and platform-specific prerequisites. Start only the named steps from each page. Those steps build the exercise you need. Running a linked lab all the way through would remove its fixture before the integrated check began.
- Catalog terminal. Run Steps 1 through 4 of the LAMP lab. Stop after it sets
lamp_url. The products should be seeded, Apache should be accepting connections, and the launcher should retain the SQL and cleanup helpers. - Notes terminal. Run Steps 1 and 2 of the shared Notes API lab. Then run Steps 1 and 2 of the React lab. Stop after it prints the board URL. This leaves a new empty notes fixture, the real build, Nginx and Node. Do not run the linked React mutation or cleanup blocks.
- Probe terminal. Keep both original terminals open. Run the Probe blocks below here. Each HTTP request should show which of the prepared servers actually responded.
Use the default ports if available. If you changed any through a linked exercise's supported variables, set the matching CAPSTONE_LAMP_URL, CAPSTONE_REACT_URL and CAPSTONE_API_URL in the Probe shell. Use only loopback addresses for this capstone. The probe checks they are three distinct explicit local HTTP listeners before it runs the mutating step. Read each command's heading. For example, sending a stop command to the Probe shell won't use the process ID retained by the Notes shell. Separating them teaches you to identify the correct process and owner before altering its state.
Write your target conditions now. In a fresh catalog the item should have seven cartons. The notes list should start as an empty array. After your authorized fixture writes, one should show twelve cartons and the other should contain “Shift handoff complete” with an API-generated ID. During a pause, the catalog should still return twelve. The board entry and liveness should remain responsive while note reads become unavailable. After recovery both the correct count and exact stored ID need to reappear. These measurable conditions make it clear what you need to observe before calling it complete.
Capture baseline observations and verify two separate writes
Step 1. Probe the three loopback addresses from the Probe terminal
set -eu
catalog_url=${CAPSTONE_LAMP_URL:-http://127.0.0.1:18902}
board_url=${CAPSTONE_REACT_URL:-http://127.0.0.1:18905}
api_url=${CAPSTONE_API_URL:-http://127.0.0.1:18915}
python3 - "$catalog_url" "$board_url" "$api_url" <<'PY'
import re, sys
ports = set()
for origin in sys.argv[1:]:
match = re.fullmatch(r"http://127\.0\.0\.1:([0-9]{1,5})", origin)
assert match and 1024 < int(match[1]) <= 65535, origin
ports.add(int(match[1]))
assert len(ports) == 3
PY
umask 077
cap_probe=$(mktemp -d /tmp/rb-stacks-proof.XXXXXX)
cap_probe_cleanup() {
case "$cap_probe" in
/tmp/rb-stacks-proof.??????) rm -rf -- "$cap_probe" ;;
esac
}
trap cap_probe_cleanup EXIT
probe() {
local origin=$1 path=$2 expected=$3 actual
shift 3
actual=$(curl --noproxy '*' --silent --show-error --max-time 8 \
-o "$cap_probe/body" -D "$cap_probe/headers" -w '%{http_code}' \
"$@" "$origin$path")
printf '%s %s%s\n' "$actual" "$origin" "$path"
test "$actual" = "$expected"
}
check_stock() {
python3 - "$cap_probe/body" "$1" <<'PY'
import json, sys
from pathlib import Path
record = json.loads(Path(sys.argv[1]).read_text())
wanted = {"sku": "MILK-1", "name": "Plain Milk", "stock": int(sys.argv[2])}
assert record == wanted and type(record["stock"]) is int, (record, wanted)
print("Catalog stock =", record["stock"])
PY
}
probe "$catalog_url" /index.html 200
grep -Fq 'catalog-help-v1' "$cap_probe/body"
cp "$cap_probe/body" "$cap_probe/catalog.help"
probe "$catalog_url" '/catalog.php?sku=MILK-1' 200
check_stock 7
probe "$board_url" /board/recent 200
grep -Fq 'Mauli Dairy React board' "$cap_probe/body"
cp "$cap_probe/body" "$cap_probe/board.entry"
probe "$board_url" /api/notes 200
grep -Fxq '[]' "$cap_probe/body"
probe "$api_url" /api/notes 200
grep -Fxq '[]' "$cap_probe/body"
probe "$board_url" /api/not-a-route 404
grep -qi '^Content-Type: application/json' "$cap_probe/headers"
grep -Fq 'unknown route' "$cap_probe/body"
The Probe shell checks one physical value in the catalog and one starting state in the board. It saves static response bytes for a later comparison. The catalog detail contains the expected product, description and numeric stock count. Checking a number alone could pass on a body with the wrong item. The notes comparison verifies both the browser-facing path and direct Node path return the same successful empty list. The deliberate missing backend route returns the API's JSON 404 and proves that a navigation route has not swallowed it. If any check fails, find the specific failed path before creating data on either fixture.
A baseline is the state you can compare after a change. Starting from the default seed makes the expected results clear but is not essential in all future deployments. For real services choose a known safe record that shouldn't be changed by an unrelated release. Confirm which route you read and any expected freshness requirement. In this exercise, the two static files are stored for an exact byte comparison. That makes the later statement “the page and catalog stayed healthy” measurable and more specific than a recollection of the initial appearance.
Step 2. Update one row in the Catalog terminal
test -S "$lamp_lab/mysql.sock"
before=$(sql -e "SELECT stock FROM dairy_catalog.products WHERE sku = 'MILK-1';")
test "$before" = 7
sql -e "UPDATE dairy_catalog.products SET stock = 12 WHERE sku = 'MILK-1';"
after=$(sql -e "SELECT stock FROM dairy_catalog.products WHERE sku = 'MILK-1';")
test "$after" = 12
printf 'Private MySQL confirmed milk stock %s to %s.\n' "$before" "$after"
Run this only inside the LAMP shell that prepared the private server. Its SQL helper uses the specific lab socket. The first read checks the expected original value. The update chooses exactly the named SKU. The next read confirms what the database stored. Updating the catalog in the database should not edit the HTML file or alter any note. In a real shop operator flow, write through the authorized application or inventory system and preserve its normal audit trail. Here the direct local connection is deliberate so the learner can verify the chosen stack layer.
Step 3. Create one note through the board from the Probe terminal
probe "$catalog_url" '/catalog.php?sku=MILK-1' 200
check_stock 12
probe "$board_url" /api/notes 201 \
-X POST -H 'Content-Type: application/json' \
--data '{"text":"Shift handoff complete"}'
cp "$cap_probe/body" "$cap_probe/created"
note_id=$(python3 - "$cap_probe/created" <<'PY'
import json, re, sys
from pathlib import Path
note = json.loads(Path(sys.argv[1]).read_text())
assert re.fullmatch(r"[0-9a-f]{24}", note["_id"]), note
assert note["text"] == "Shift handoff complete", note
print(note["_id"])
PY
)
note_path="/api/notes/$note_id"
grep -iq "^Location: $note_path" "$cap_probe/headers"
probe "$board_url" "$note_path" 200
cmp "$cap_probe/created" "$cap_probe/body"
probe "$api_url" "$note_path" 200
cmp "$cap_probe/created" "$cap_probe/body"
The two writes use different interfaces. You changed the catalog under a private administrative SQL helper, then confirmed PHP could read the changed value. You created the note at the normal application-level API path, and the React board's Nginx entry forwarded that request to Express. The response contains an ID assigned by the backend. That ID and the Location header give you the same resource to verify even if other notes eventually exist. The two GETs then check the exact created representation through the edge and direct private HTTP path. This comparison distinguishes an actual backend write from a note displayed only in local UI state.
Use the two IDs carefully. The stock is looked up by the named SKU MILK-1. The note has a generated hexadecimal ID. A result for a different key isn't proof that the operation you issued succeeded. The representation body from this exact fixture is stable between the successful operations, so the exercise compares full bytes as well as extracting the key and text. If another deployment uses variable serialization order, use semantic JSON comparisons of the required fields rather than relying on an exact byte match. Complete a precise comparison while the APIs are healthy so later failures have a baseline.
Pause only MongoDB, observe both stacks, and recheck the exact record
Step 4. Stop the targeted database child in the Notes terminal
test -n "$db_pid"
test -S "$notes_socket"
stop_notes_child "$db_pid"
db_pid=
printf 'Stopped Notes lab MongoDB child.\n'
That command uses the process tracked by the private Notes workspace. It asks the child to stop and waits for it. The process listening on the board port and the Express process continue to run. The catalog terminals and data stay independent. Do not substitute a process found by searching all mongod commands or stop a system-wide service. The purpose of a controlled exercise is knowing exactly what was changed. Keep open the shell that owns the stopped instance so you can reopen the same data directory.
Step 5. Measure the expected difference in the Probe terminal
probe "$catalog_url" /index.html 200
cmp "$cap_probe/catalog.help" "$cap_probe/body"
probe "$catalog_url" '/catalog.php?sku=MILK-1' 200
check_stock 12
probe "$board_url" /board/recent 200
cmp "$cap_probe/board.entry" "$cap_probe/body"
probe "$board_url" /api/health 200
grep -Fq '"running":true' "$cap_probe/body"
probe "$board_url" /api/ready 503
grep -Fq 'notes temporarily unavailable' "$cap_probe/body"
probe "$board_url" "$note_path" 503
grep -Fq 'notes temporarily unavailable' "$cap_probe/body"
probe "$api_url" "$note_path" 503
grep -Fq 'notes temporarily unavailable' "$cap_probe/body"
These results show which dependencies each route uses. The unchanged board HTML proves Nginx can still serve that entry. The liveness request asks whether the Node application can receive and respond, without querying the store. The readiness path attempts a database command and fails after the stop. Both the direct and proxied read of the known note return the application's unavailable response. That shows the error is behind the Nginx HTTP path. The independent catalog still reports twelve through PHP and MySQL because it did not share the stopped data process.
If the board entry itself fails at the same time, do not call that an expected database symptom from this design. Inspect the page listener, URL and built files. If the direct API read and the proxied read disagree, inspect the Nginx target and actual path. If both fail to connect at all, determine whether Node still listens and check its log. Look at one unexpected result at a time. Scope any operation you choose so it doesn't needlessly affect the working catalog. A more systematic incident report gives the exact expected and observed status for each URL.
Step 6. Restart the same private database in the Notes terminal
start_notes_db
for attempt in $(seq 1 20); do
if curl --noproxy '*' --silent --show-error --fail --max-time 4 \
"$notes_url/api/ready" > "$notes_lab/capstone-ready.json"; then
break
fi
sleep 0.25
done
grep -Fq '"storageResponding":true' "$notes_lab/capstone-ready.json"
Start the daemon using its existing folder, not the setup block that creates new data files. The bounded loop allows the backend driver to discover the recovered endpoint and then verifies a known readiness body. A listener can be present before a cached client has reconnected. An open socket or fresh process ID would not prove useful service access by itself. If readiness does not recover, inspect the private MongoDB and API logs before changing unrelated config. Do not erase the data directory to reach a green response. Reopening the existing files is the point of this practice.
Step 7. Verify the recovered values from Probe and clean up each fixture
probe "$board_url" "$note_path" 200
cmp "$cap_probe/created" "$cap_probe/body"
probe "$api_url" "$note_path" 200
cmp "$cap_probe/created" "$cap_probe/body"
probe "$board_url" /board/recent 200
cmp "$cap_probe/board.entry" "$cap_probe/body"
probe "$catalog_url" '/catalog.php?sku=MILK-1' 200
check_stock 12
cap_probe_cleanup
trap - EXIT
test ! -e "$cap_probe"
The exact note ID and body appear on both HTTP paths again. That proves the data persisted in the fixture across this database restart and its original edge still routes correctly. The PHP catalog should still show twelve, with no second update required. Clean up the two server workspaces in their owning terminals after retaining the observations you need. They hold independent process IDs and temporary paths.
lamp_cleanup
trap - EXIT
test ! -e "$lamp_lab"
printf 'Private Apache, PHP and MySQL fixture removed.\n'
react_cleanup
trap - EXIT
test ! -e "$notes_lab"
printf 'Private Nginx, React, Express and MongoDB fixture removed.\n'
If you launched a dedicated cloud machine to do the exercise, separately remove the resources you created after finishing the practice. Stopping regular-user child processes does not terminate an EC2 instance or remove associated cloud resources. Keep the lab network private and avoid modifying a shared machine's global service settings to demonstrate the private recovery. Note the two independent teardown checks so the next class starts from the expected fresh fixtures.
Use the result matrix to choose the first useful check
Use the capstone's observations to practice a real incident conversation. The customer reports that both digital systems seem slow, but the available ticket only names the notes board. Do not infer that one report applies to every route on the machine. Start with the exact request for the page, then the exact request for the data. Capture the status, expected response body pattern and time. Repeat one known check on the catalog. That is the control, an observation deliberately chosen to show whether an unrelated route stayed healthy during the exercise.
| Actual result | Next verification | Reasoning |
|---|---|---|
| Catalog 200 with twelve, board HTML 200, live 200, note 503 at both addresses | Read the shared API's private storage log and verify MongoDB's own captured process and socket | The notes operation crosses a dependency the successful checks don't use |
| Board HTML and direct note 200, proxied note 404 | Compare the exact URI reaching Express through the edge and any location rules | The stored record exists and the backend can find it. The edge may have changed or misdirected the path |
| Board HTML 200, script URL 404, direct note 200 | Check current HTML's generated asset reference against published bytes | Nginx can serve HTML and Express can query MongoDB, but the browser cannot run the expected release |
| Catalog static 200 but dynamic fails, board and notes succeed | Inspect Apache's selected handler, FPM socket and private PHP/MySQL evidence | The neighbor works and the failure starts on the PHP path. The PHP request and app output can narrow it further |
| Both public-shaped loopback entry points fail before HTTP | Check test invocation and listeners on the intended machine | A wrong machine, test proxy or stopped processes can make both requests fail without two separate database errors |
Suppose you get an Nginx 502 from the note route while curl to the direct app port fails to connect. The root problem may be a stopped Node process or incorrect target. A gateway error does not prove MongoDB is down. Compare the upstream endpoint configured by the edge with the service's actual listener. An app log from the wrong working directory is weak evidence because it may describe a different process. In this lesson the private server has the exact environment and temporary directory created by the Notes terminal. In a real service, get the configured unit and effective bind from the service owner before changing the routing file.
Suppose instead that the note URL returns JSON with a graceful 404. That tells you an HTTP service handled the request and could report an absence. Consult the actual body. An unknown-route error and an unknown-note error are different, even though they may have the same HTTP status. The first says the requested path or method was not handled by that app. The second says a handler ran and did not find the requested resource. Compare the ID and route with the confirmed 201 response, then read the same private store if necessary. An unexpected count of twelve for CURD-2 would be another semantic failure even if the PHP request had returned 200.
Your recorded stock and note values make it possible to detect an easy-to-miss mixed environment. An older database with its original seed returns seven for a perfectly valid SKU. Another Notes fixture can give a successful empty list. The app and its endpoints are responding in both cases. The exact values and note ID show that you reached a different data state from the intended one. When reproducing a bug, record which namespace, region, site or data file the process was configured to reach. Those details can matter even when every network and health check passes.
Practice deciding what constitutes recovery. A process may have restarted successfully, and the port may be listening. A response to /api/health confirms the HTTP process can respond. The API can then respond to a lightweight dependency test. Finally, the exact old note must still show up with the same ID and text. Each is stronger evidence for some claim. If the note is missing after a fresh database directory was created, health is restored but data recovery is incomplete. Report those separately. This exercise intentionally starts the same database files after the fault and checks a known resource.
When comparing a normal HTTP status with a client-side connection error, record which evidence exists at all. Curl can report that it never established a connection or did not receive a response before its time limit. In those cases there may be no HTTP status from the intended service. An HTML 502 means a responding gateway handled the request and could not complete its upstream work. A JSON 503 from our application means the request reached its app handler and the dependency check failed. These outcomes ask for different first checks. The probe uses a bounded wait and prints statuses when it receives them, so avoid treating a timed-out command as proof of a particular application response.
For each failed variant choose a test that could prove your initial assumption wrong. If you suspect MongoDB, an authorized independent read of the exact note from the same database might demonstrate that data is available, directing attention to the app credentials or route. If you suspect the FastCGI program, a PHP-generated input validation error can show that your script did execute even if the database-backed branch fails. A useful control changes only one important part of the path while retaining the other conditions. That makes the verification stronger than changing multiple packages and seeing something improve.
Collect a short incident summary with four pieces of evidence. Describe the user-visible symptom. List what stayed healthy. Name the smallest change you made, along with the exact owner or expected target. Record which user-visible and data checks passed afterward. For the exercise, a reasonable conclusion is that the single MongoDB stop left the catalog and static board unchanged, made the Note read unavailable, and allowed both paths to return the same note after the restart. That is a narrower and more useful conclusion than “the server went down and came back.”
Plan a separate reboot test for a disposable Linux deployment
The capstone uses foreground invocations owned by your Bash sessions. They are intentionally not installed services. Closing those sessions stops or cleans up the fixture. A machine reboot would not automatically restore it. To practice persistence across a full server reboot, use a separate dedicated EC2 lab that you own and set up its ordinary services using the supported package and runtime procedures. A deployment should define how each managed service starts, what operating system identity it runs under and which local state it must open.
Begin by writing a manifest, a plain list of the services and content that should remain available. For a LAMP deployment this may include the web server, PHP-FPM if used, and the selected MySQL or MariaDB service. A Node site may have Nginx, an API managed by a service supervisor, and a self-hosted MongoDB instance or a separately managed database. A static client frontend has a release artifact to serve, not a frontend process that necessarily starts at boot. A server-rendered frontend might add its own managed service. Start from the actual architecture you installed instead of enabling a list of product names blindly.
Check your package manager's actual unit names and startup arrangement. On a systemd host, systemctl is-active and systemctl is-enabled answer current-state and future-start questions. A service can have an activation relationship through another unit rather than an enabled setting you apply directly. Check how the backend handles a database that becomes available later than the service process. An ordering dependency typically tells systemd when to start participating units, but successful scheduling is not the same as readiness to handle the first real query. The application may need a bounded retry strategy, health checks or an explicit readiness mechanism.
Consider this concrete failure. After boot, Nginx serves the Angular entry, but the managed Node app tried to connect before MongoDB could answer and exited. The old board looks present because its files came from Nginx. The API requests return a gateway or service error. The remedy is to inspect the actual manager and app startup log and design an appropriate startup and readiness policy. Opening the MongoDB port to wider traffic does not fix a local process that attempted its first connection too early. Check the expected app binding and data source after the real dependency becomes valid.
Before authorizing a reboot of the disposable host, record the exact EC2 instance and verify it is the intended independent lab machine. Check that wiping or losing access to it would not affect a shared website or anyone else's service. Save the needed app settings and data using their documented mechanisms. Prepare the environment and SSH or other approved administrative access for recovery. Record the running processes, listening addresses, chosen external access path, the exact catalog record and note ID, and the current boot time if that is relevant. Schedule or coordinate the reboot at the time you intend. This lesson does not ask you to reboot a production server to verify a local exercise.
After the host returns, compare the same observations. Verify basic host reachability and the supported process manager states, then request the real static and dynamic paths. Look at the changed boot state and service logs when a required listener did not start. Verify that the catalog and notes read the same records and that no temporary installer diagnostic or default web page has become public. If a service requires a manual recovery, capture that fact. A design that starts only after an administrator intervenes still has a different recovery contract from a deployment that resumes automatically. Test those outcomes explicitly rather than learning from a lucky restart.
The network perimeter plan belongs with this rehearsal. A security group describes which network connections AWS permits at attached resources. A public HTTPS site typically allows intended client traffic at its web entry point. Management access should use the approved path, such as a constrained Session Manager or other private method, or explicitly allowed SSH from the relevant place. A remote API or database may still need private traffic from its known service peers. The set of allowed ports is determined by that topology, not by the stack acronym. A local socket doesn't require a cloud inbound rule for the socket operation at all.
Use an observability check alongside permission settings. Confirm both the addresses a process actually binds and the network rules that limit clients. If the only service test came from a host's loopback, nothing about that result proves remote visitors can reach the entry. Conversely, a working public page doesn't verify that credentials or database endpoints are appropriately isolated. In a real configuration confirm which paths can be reached from intended callers and which remain private. The completed private lab does not assign any new cloud rules or prove a boot cycle.
Choose a follow-up rehearsal and define what must stay stable
Run one exercise variation after publishing your results from the main capstone. Each one keeps the same idea while changing one boundary deliberately. Choose based on the layer you want to understand. State the starting state, the exact change, the expected response and which neighboring behavior you will use as a control. Practice one variation at a time. If you mix a new frontend build, new database settings and a proxy change, a failed HTTP result doesn't tell you which action caused it.
Variation A. Switch the PHP entry point from Apache to Nginx
Use the LEMP exercise to prepare its own temporary catalog from the same PHP/MySQL setup. Record the shared response contract for the seeded milk and curd rows. Check the LEMP endpoint using the Nginx inventory hostname and its proper port. Compare exact SKU, product name, quantity and error meaning. Do not compare a seven-carton seed to an already updated twelve-carton LAMP database without recording that deliberate data difference. In a fair side-by-side rehearsal, keep both seed quantities equal or independently verify the intended update in each environment.
Propose a migration acceptance matrix. Include known and missing products, malformed input and one separate site on the same Nginx listener. The LEMP lesson shows why the expected PHP body differs from an Nginx file error. Test that behavior before and after a deliberate private FastCGI route change. A pair of successful static responses will not cover whether the web server passed the request query to PHP. Confirm the dynamic shape and do not edit the other site's configuration during the test.
Variation B. Present the same Notes API through Angular
Use the Angular board exercise on its own private port and from a deliberately started Notes API fixture. Record the actual browser output folder and filenames, not the React build layout. If comparing two frontends together, arrange both edge routes to point to the same fixture and keep their cleanup ownership clear. Do not use two independently seeded databases and claim the same persisted note. Decide which process owns the shared data service and stop that service only when both related exercises are finished.
Choose a known note ID and read it through both edges. Verify expected output and an unknown API path, then check each genuinely known deep link and the actual built asset URLs. The frontend themes and headings may differ. The backend still returns the same content for the same ID. A successful independent re-read of that ID shows that the note remains in the backend after the second screen renders. For browser interaction, submit a distinct text from the intended UI and confirm the resulting representation through the other UI's API path. Separate those observations from command-line asset checks.
Variation C. Design a recovery rehearsal for a released frontend
Identify one prior and one candidate version of a static board. Change only the candidate label or layout, not the notes contract. Record the known page and the exact asset files each version refers to. Keep staging sources and prior files under the protected workspace. Arrange a candidate test as a distinct listener or host. A correct page from the candidate must not require replacing the original page before you've tested it. Once the candidate has been activated in an authorized lab, request both the application data and the exact new bundle. Then rehearse restoring the old deployment and checking its asset paths, data and unaffected neighboring service.
Write down which change did not belong to the rollback. A note created through the API before the frontend cutover should still be stored after a front-end-only rollback. Restoring the earlier build without restoring the entire database allows that. If you did plan a data migration, define its compatibility and verification separately. This follows the same idea as the main capstone: restarting only the affected MongoDB fixture must not roll back the independent catalog's stock or change the board's static bytes.
Explain your evidence and test your recovery decisions
Interview questions and working answers
How would you prove this PHP catalog and React board have separate data dependencies?
Capture exact baseline values for both applications. Pause only the private notes database. Verify the Apache dynamic lookup still returns the same stock while the note lookup returns an availability error through both edge and direct API. Restart the same notes database files and compare the original record. State which components were stopped and which paths never changed.
Why is a functioning board entry not a sufficient availability check?
The HTML and other built assets are served from the web root. They can stay available while an API operation cannot query the database. Check the entry for file delivery, a shallow endpoint for process liveness, and a real stored result for application behavior. Choose the test that matches the actual service claim.
How can an engineer differentiate an Nginx route error from a problem in Express?
Compare the same method, public-shaped path and input with a direct private API request in the authorized lab. A direct known note with an edge failure suggests proxy mapping or content delivery. A structured error from both can point to app behavior or its dependency. Compare the bodies and logs because the same HTTP number alone can arise at more than one layer.
When would you call a boot rehearsal complete?
Confirm the intended host booted again and each required managed service used its intended settings. Then prove the real HTTP paths and exact stored records using the expected network and identities. A green unit label is a process observation; it cannot prove recoverability of actual data. Separately report services that needed manual intervention.
Quick quiz
A restarted database answers ping but the original note ID returns 404. Did the capstone recovery pass?
The process and basic dependency checks pass, while data recovery is still unresolved. Review whether the same data directory and database were opened. Verify the actual note ID and body. A healthy new empty database would not satisfy this exercise.
During the Notes pause, should milk stock return seven, twelve, or 503?
Twelve. The stock update occurred in MySQL and its PHP path remained active. Stopping a separately owned MongoDB process doesn't change that row. A failure or incorrect stock would require further investigation.
Can a learner assume every deployment must open a database port publicly?
Design network access for intended peers. A same-host application can use a local socket or a loopback endpoint, and a separately hosted backend needs a documented private path. The specific public entry and admin rules depend on the deployment.
Submit these practice results
- Provide a small table with the three request phases, healthy, paused, and recovered. Include a catalog dynamic status and stock, board entry status, API liveness and readiness, and note result for each phase. Record the consistent ID but no credentials or private data.
- Describe one observation that would disprove your hypothesis that only the Notes database was affected. Give the first focused check you would make to investigate it.
- Choose a variation and create an acceptance checklist that another learner can follow. Name your baseline, approved layer change, expected data and one neighboring service to verify.
Trace each path to its store
Catalog data uses Apache, PHP-FPM and MySQL. Notes data uses Nginx, Express and MongoDB in this comparison.
Keep a healthy control
Confirm a known unaffected result during a fault and after recovery. Change only the intended process.
Read the exact ID again
Reopening a data process and passing ping are not enough. Match the originally stored record after recovery.
Reboot is a separate test
Check managed startup, effective listeners, application behavior and retained values on the dedicated host.