Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 10: Dynamic Website Hosting (PHP, Python, Node.js with MySQL)

AWS Cloud

Practice Questions and Lab Exercises

Come on, now practice! Complete one end-to-end report on an assigned machine. Compare additional stacks or operating systems if the prerequisites are available.

  1. Draw the 3-tier architecture of a dynamic website on a single EC2 instance.
  2. What is PHP-FPM? How does Nginx communicate with it?
  3. When does a same-host app use loopback, and what listener is needed when the web front and app are on different hosts?
  4. Write a table-level grant for a dedicated read account. Explain when a separate disposable practice role needs INSERT and how to verify the matched identity.
  5. What is the purpose of Gunicorn? Of pm2?
  6. Explain each line of the Flask systemd unit file.
  7. What causes 502 Bad Gateway? Give three checks.
  8. Lab: Run the assigned PHP route and verify it renders the seed markers. Use only the isolated local form mode if an authorized synthetic write is part of your assignment.
  9. Lab: Verify the assigned Flask runtime, readiness and actual JSON report. If a managed start is in scope, use the owned service and verify those checks after its controlled restart.
  10. Lab: Use the private Node and Nginx exercise. Stop only the owned upstream, record the gateway failure, restore the app and confirm the real named report.

Trace the chosen front, app and database connections. Use loopback for the same-host app exercise and the approved private address when those services live separately.

Quick Revision

  • Dynamic output uses application logic and input or state. A database is one possible source.
  • DB: verify supported engine, package and connection settings for your environment. Use an operation-scoped role and restrict listener access to intended clients.
  • PHP: inspect the front’s approved FastCGI mapping, FPM listener and pool context. Verify an actual script response.
  • Python: use the chosen Flask service runtime, dependencies, assigned private address and scoped dependency check.
  • Node: verify the supported runtime and reviewed packages. Assign one launch path and use the configured private listener.
  • Reverse proxy: compare the effective Nginx proxy_pass or Apache ProxyPass mapping with the exact direct app request and the approved host policy.

Extra labs across stacks

  1. Lab: Spring Boot + MySQL. In the assigned disposable app, configure the dependency indicator and approved credentials. Verify its authorized status and a real scoped read.
  2. Lab: Django + PostgreSQL. In an assigned scratch database, separate migration and runtime scope. Query a known synthetic row after checking server reachability.
  3. Lab: Node + MongoDB. Work in the assigned isolated test instance with its approved authentication. Assign only the operations needed for your synthetic collection.
  4. Lab: controlled failure. In a disposable app copy, use a missing fixture. Record a functioning health response and matching report failure, then restore the fixture and verify the earlier result.
  5. Lab: startup check. Verify the assigned process after its owned start. Reboot only an explicitly assigned disposable system or under an approved isolated boot plan.
Reboot testRebootsystemd /PM2 startApps on127.0.0.1curl throughnginx = 200
Optional isolated boot check. Verify the intended managed service, real application route and expected report.

Expected evidence for the main labs

Private app data request: 200 with known seeded IDs and names
Named report through the practice front: 200 with the same data markers
Unmatched practice hostname or raw IP: 404 from the catch-all
Private app stopped: direct connection refused; named report 502
App restored: named report 200 and intended data returns

Real-world tie-in: the same three-tier check is used by support teams at companies like HCL and Tech Mahindra when they take over a server from another team.

Key terms

  • Three tiers: Web, app and data.
  • WSGI / ASGI: Python app interfaces used by Gunicorn and Uvicorn.
  • PM2: Node.js process manager.
  • systemd unit: A service definition with restart and boot rules.
  • Least-privilege DB user: A role scoped to the databases, tables and operations its job requires.
  • 504: A gateway did not receive the upstream response it needed in time.

Mini case study

Suppose we are a junior cloud engineer at a Bengaluru e-commerce startup (sample data). The team runs a PHP admin, a Node.js storefront API and a Python report job on two EC2 instances. Using this chapter, you write a one-page runbook: which service listens where, how to test and reload each one, which logs to read, and which ports are public (only 80 and 443, plus 22 from the office IP). New team members can then fix most problems on their own.

Practice running a workshop report from data source to reader

The design assignment is a site for a weekend workshop. Learners should see a short syllabus and an up-to-date list of fictitious students used in class. An instructor may try one synthetic write under an explicitly approved local exercise. The normal managed version only reads. Your job is to explain the route, get the expected result and leave a repeatable record for the next learner. You can finish the core work on one development machine. Running different operating systems is an optional comparison after a complete working exercise.

Begin with a dry run on paper. Name the browser URL, web front, application listener, database address and role. Identify the tool or configuration which owns each. The browser knows a named site and a route. The web front decides where to send that route. Application code parses the request and checks the intended mode. The app has separate access to storage. Your diagram should show distinct connections, including whether front and app communicate with HTTP or FastCGI. A drawing that places one port number on every tier cannot explain the separate boundaries.

QuestionEvidence to submitExample for the one-host lab
Which site did your client actually reach?Named URL, response status, and a recognizable response header or body field.The synthetic workshop host and its intended route.
Which process answered the application request?Runtime, mode, specific listener and the expected received path.Owned Flask or Express on its assigned loopback port.
Where did the data come from?Actual scope of the authorized table and read, with expected markers.Separate practice schema with fictional seed entries.
What remains after the exercise?Disposal or retention record for the processes, logs, files and records you created.Local listeners closed and only approved training artifacts retained.

Use the lesson-specific code where indicated. Start from a disposable workspace and record which setup you chose. PHP with FPM, Python with Flask and Node with Express teach different runtime and binding tasks, so choose a stack your system supports. If an optional component is unavailable, state which portions you performed and use the written prediction for the other stack. A named local loopback exercise demonstrates software behavior, though it does not establish that someone else can connect over the internet or that a production host is configured correctly.

Exercise one. Design two valid placements for the same service

Draw the first design with one host. Readers contact an assigned web front. If your app uses Express or Flask, the front sends HTTP to the loopback listener on that host. If using the managed PHP example, draw FastCGI to the PHP-FPM address or local socket. A separate connection goes to an assigned SQL endpoint. The same-host SQL exercise uses IPv4 loopback TCP for its app client. In a managed site, the chosen SQL endpoint could be reachable over a private network. Record which paths should accept public traffic and which only need to accept communication from an authorized process.

Draw the second design with an Application Load Balancer, application instances and an RDS database. Mark the configured target port and protocol. If a front server runs on each application instance, the load balancer can contact that front as planned, and the front can keep its local app mapping. If the load balancer talks directly to an app on another network interface, its target must bind to an appropriate address and permit the intended peer through network policy. The database security group can allow the intended app clients. SQL authentication and grants remain separate from that reachability. Use approved subnets, source rules and certificate choices for the deployment.

Mark a health probe, a readiness probe and a representative user operation on each drawing. If the first merely shows the app can reply, the readiness test should deliberately observe one critical dependency. If the system uses a health route that must stay internal, mark how its caller can reach it and what details it exposes. The final reader operation should confirm the named expected report fields and not just any response. Give one example where each preceding check could pass while the next fails. You may cite the partial-schema result from the troubleshooting lesson as an example of precisely limited evidence.

Compare the failure domain of each design. On one host, a failure of that host can affect front, app and data. A multi-instance design may distribute the app but still rely on a shared data service. A locally stored attachment or in-memory session may not be visible to the next target. Your target design must address the state and trust requirements of the exercise. Adding a load balancer without saying where state lives or who accepts traffic is an incomplete architecture answer. For this assignment the second design is a written exercise. No AWS resource creation is needed.

Lab two. Prove a scoped write and undo it in the same SQL session

Use the setup from the MySQL and MariaDB lesson. This exercise requires a disposable appdb.students table using InnoDB, the authorized training account with SELECT and INSERT on that table, and the assigned local TCP endpoint. No other live writer should change the synthetic dataset during this comparison. Confirm you are connected to that intended practice database. A SQL-only exercise does not need a public site, and it does not require an administrator identity for the runtime test. If you have only the read-only managed role, predict the insert denial separately and have the lab owner assign the intended temporary writer if your exercise requires it.

Open the MySQL client on the actual training port. Set the shell variable to that approved port first. Request a password prompt rather than attaching a credential to the command. Catastrophic mistakes start with running the right command on the wrong database. Use the actual host, port and expected effective role deliberately. Compare the initial output to the known seed markers. If an unexpected record or account appears, leave this exercise and check your context rather than cleaning a dataset you have not identified.

mysql --protocol=TCP --host=127.0.0.1 --port="$DB_PORT" \
  --user=appuser --password --database=appdb

In the same client enter the following. It reads a bounded result, starts one transaction, inserts a fictional marker, reads its assigned ID and rolls back without preserving the inserted row. Keep the statements in order and use this exact unique marker only if the preflight shows no earlier match. If a statement fails after starting the transaction, issue the rollback promptly before further experimenting. Do not replace the work with a DELETE under a broader account.

SELECT DATABASE() AS selected_db, CURRENT_USER() AS matched_identity;
SELECT COUNT(*) AS initial_count FROM students;
SELECT COUNT(*) AS initial_marker_rows FROM students
WHERE name = 'Practice rollback marker';

START TRANSACTION;
INSERT INTO students (name, city) VALUES ('Practice rollback marker', 'Nashik');
SELECT LAST_INSERT_ID() AS tentative_id;
SELECT id, name, city FROM students WHERE id = LAST_INSERT_ID();
ROLLBACK;

SELECT COUNT(*) AS final_count FROM students;
SELECT COUNT(*) AS final_marker_rows FROM students
WHERE name = 'Practice rollback marker';

In a clean copy, both counts should be three, both marker counts zero outside the transaction and one matching row visible before rollback. Your actual tentative ID can differ. InnoDB's generated sequence can leave gaps after rollback. An ID is a useful identifier, not proof of the count or evidence that a prior record remains. Show both comparisons after rollback. If you want a second authorized check, open a fresh session and verify that the temporary marker is not visible. A read-only connection and a probe from the original session can now agree.

Write the scope explicitly. You proved this role could read the seeded table, issue one insert inside its explicit transaction and remove the uncommitted effect through rollback. You did not prove that a normal managed HTTP request exposes the same write. The public version can suppress that route or deny its operation, and a long-lived read only role can lack the SQL grant independently. A SQL transaction applies to its connection. Starting it in the SQL client would not bracket a separate form submission made through a web app and its own database connection. Keep HTTP side effects only in their own local exercise and verify them separately.

Lab three. Prove the app consumes the intended data

Pick Python or Node for the core JSON exercise. Use the Flask source and template with its approved runtime and driver, or the Express source and its locked project packages. Keep the MySQL replica of the practice data running on its known private endpoint. Give the app the settings from the chosen lesson. Run it read-only for this stage. Flask's managed example uses a WSGI server. Express uses its Node process with its normal startup mode. If both are running, use distinct ports and write down which corresponds to which package.

Save this script as check_students.py in your private workspace. It allows the learner to enter the exact approved local port. The script hardcodes IPv4 loopback for this exercise. It reads a bounded response and checks both the returned type and known fictional data. Keep the dataset at its seed state, including the expected first and third records. This does not assert a fixed global row count, so stable records can still be verified if the prior local lab intentionally retained another authorized synthetic row. The no-body and transport cases have distinct diagnostic outcomes.

from argparse import ArgumentParser
from http.client import HTTPConnection, HTTPException
import json

parser = ArgumentParser()
parser.add_argument("port", type=int)
args = parser.parse_args()
if not 1024 <= args.port <= 65535:
    parser.error("Use the assigned unprivileged local port.")

def fetch(route):
    connection = HTTPConnection("127.0.0.1", args.port, timeout=4)
    try:
        connection.request("GET", route)
        response = connection.getresponse()
        status = response.status
        media = response.getheader("Content-Type", "").split(";", 1)[0]
        body = response.read(200_001)
        if len(body) > 200_000:
            raise SystemExit(f"{route}: unexpected large practice response")
        return status, media, body
    except (OSError, HTTPException):
        raise SystemExit(f"{route}: local HTTP exchange did not complete.")
    finally:
        connection.close()

for route in ("/health", "/ready", "/api/students"):
    status, media, body = fetch(route)
    if status != 200:
        raise SystemExit(f"{route}: HTTP {status}; expected 200.")
    if media != "application/json":
        raise SystemExit(f"{route}: expected JSON content type.")
    try:
        decoded = json.loads(body)
    except (json.JSONDecodeError, UnicodeError):
        raise SystemExit(f"{route}: invalid JSON response.")
    if route == "/api/students":
        expected = {(1, "Practice Student A", "Pune"),
                    (3, "Practice Student C", "Nashik")}
        if not isinstance(decoded, list) or any(not isinstance(x, dict) for x in decoded):
            raise SystemExit(f"{route}: expected a list of records.")
        if not all(type(x.get("id")) is int and isinstance(x.get("name"), str)
                   and isinstance(x.get("city"), str) for x in decoded):
            raise SystemExit(f"{route}: wrong record field types.")
        records = {(x.get("id"), x.get("name"), x.get("city")) for x in decoded}
        if not expected.issubset(records):
            raise SystemExit(f"{route}: seeded data markers missing.")
        print(f"{route}: 200, JSON record contract, seeded evidence passed.")
    else:
        if not isinstance(decoded, dict) or not isinstance(decoded.get("status"), str):
            raise SystemExit(f"{route}: expected a JSON status value.")
        print(f"{route}: 200, JSON status fields passed.")
# Choose one active training app and its actual private port:
python3 check_students.py 18805  # Flask managed exercise, if started
python3 check_students.py 18806  # Express managed exercise, if started

The script does not start a service, offer access to a public address or modify the database. Read its first failure. For an incomplete HTTP exchange, verify the intended process, address, port and operation. For 503 on readiness, look at application access to its expected dependency. For a missing seed marker with 200, compare the selected schema and role with the setup worksheet. For the wrong media type, check whether a different service or route has answered. Passing all three checks provides a small selection of functional evidence. An exercise that needs additional cases can check the authorization boundary and public routing separately.

PHP is an alternate app exercise. In the assigned deployment from the PHP lesson, verify the selected front and PHP route with curl and its normal HTML media type. Use the visible expected seed markers rather than guessing a JSON endpoint on this sample. If a source file is served as plain text, stop that practice and correct the route with the appropriate FPM handler before exposing any real code. The scoped local form is explicitly optional and belongs to an isolated write-enabled practice, not the normal hosted read-only route. Record the contrast with Flask or Node in your evidence worksheet.

Lab four. Combine a course home and application route under one name

Leave one working Flask or Express normal read-only process from the previous stage running. Add a private Nginx front with a distinct port. Choose the correct target port for the app you actually started. The practice host has a course marker it serves directly and a separate application prefix. If you end up testing the wrong service, both parts might respond individually, so test their methods and the data expected from this environment. This stage practices a front configuration close to the deployment diagram without any real DNS or cloud billing.

In a separate local workspace, prepare a logs subfolder and save the next example as nginx.conf. It assumes the prior working Express listener on port 18806. To use Flask, change the target to the active assigned Flask port instead. Keep the config and process isolated from any installed service. The name workshop.example.test exists for the exercise. A catch-all server for the same local listener returns 404, making accidental use of the IP address visible. The requested application prefix is deliberately replaced by a root slash upstream.

worker_processes 1;
pid nginx.pid;
error_log logs/error.log info;
events { worker_connections 64; }

http {
    log_format exercise '$server_name $request_method $uri status=$status '
                        'upstream=$upstream_status target=$upstream_addr';
    access_log logs/access.log exercise;

    server {
        listen 127.0.0.1:18969 default_server;
        server_name default.example.test;
        return 404;
    }
    server {
        listen 127.0.0.1:18969;
        server_name workshop.example.test;

        location = /course-info {
            default_type text/plain;
            return 200 "Weekend workshop syllabus\n";
        }

        location /workshop-api/ {
            proxy_pass http://127.0.0.1:18806/;
            proxy_set_header Host workshop.example.test;
        }

        location / {
            return 404;
        }
    }
}
mkdir -p logs
nginx -e stderr -p "$PWD/" -c "$PWD/nginx.conf" -t
nginx -e stderr -p "$PWD/" -c "$PWD/nginx.conf" -g 'daemon off;'

Run from the owner-controlled workspace with the approved executable. If the syntax check fails, read the message before trying to start the private worker. If the listener is in use, choose another lab port consistently. The initial browser test stands in for a named client with curl's local mapping. No certificate is used in this loopback exercise. A real deployed host needs independent verification of its DNS and HTTPS setting under the intended client name. The practice uses HTTP to isolate route selection and application handling.

curl --noproxy '*' --max-time 5 --include --write-out '\n' \
  --resolve 'workshop.example.test:18969:127.0.0.1' \
  'http://workshop.example.test:18969/course-info'
curl --noproxy '*' --max-time 5 --include --write-out '\n' \
  --resolve 'workshop.example.test:18969:127.0.0.1' \
  'http://workshop.example.test:18969/workshop-api/api/students'
curl --noproxy '*' --max-time 5 --include --write-out '\n' \
  'http://127.0.0.1:18969/workshop-api/api/students'

Expect the syllabus to return a 200 in plain text and the data route a 200 with the intended JSON seeded records. The IP-only request should hit the isolated catch-all and return 404. Inspect the access log. The success for the syllabus has no target because it was generated by the front. The application target appears for the named report request. The app should see /api/students. The original path is the prefixed one handled by the front. Record which route and representation can establish the site's intended read. Raw counts of 200s leave out the comparison.

For the authorized outage simulation, stop only the owned Flask or Express practice process in its own terminal. Leave the isolated Nginx host and SQL fixture in place. The app-direct request should now have no HTTP response due to a refused local connection. The named front's report should return a gateway error, while the named syllabus still returns the exact text. Read the error log in that private front folder. Restart the same app with the original complete practice settings and repeat the three named and direct checks. Successful restoration requires the actual synthetic data. The default virtual host test should continue returning 404 after restoring the application.

Think through the separate connection paths when explaining the results. The app's port refused a TCP connection as long as its process was gone. The front continued accepting requests on its own port. The front's available syllabus was no evidence about the app. Its failure of the report did not mean the SQL service had stopped. A local check after restart proves the app can use its startup dependencies. The named front request after restart verifies both front route and app result for the restored deployment. No database cleanup is needed for this stage because the app runs read-only.

Exercise five. Fill in an evidence table before choosing remedies

Use the table first as predictions, then fill in whichever rows the private exercise can demonstrate. A prediction should mention the conditions under which it follows. For example, Nginx producing a 502 after the backend stops assumes it is still configured to use that one unavailable app listener. If a different healthy pool member serves the request, the result can differ. Write the effective target and status or client error rather than treating a status as a portable diagnosis.

Controlled caseUseful expected observationNext question
Use the IP address in the named frontend exerciseThe catch-all produces its own 404 and no target.Did the client use the expected authority?
Stop only the owned private app listenerThe front can still serve the course marker. The app-specific route fails.Can the front open an upstream connection to the address and port it reports?
Start the earlier fixture with a partial schemaHealth and narrow readiness pass, real data query fails.What exactly does the check query and what does the report require?
Use an appropriate read-only role for an insertThe SQL server denies the unauthorized operation.Which matched identity and table grants did the session actually use?
Managed Express receives a local practice POSTIt denies the write before attempting it.Does the known read and its data evidence still pass?
Request the correct path, but use a wrong public prefix mappingApp may return 404 with a path different from its intended route.What URL path reached what component?

Now take a row to a classmate. Choose two observations that could both have occurred, then ask what separate cause explains the combination. For example, the syllabus still succeeds but the report's direct HTTP call cannot connect. Those are consistent with the web front running and its target unavailable. A client's accepted 200 course marker is evidence of one web path. It does not establish other components. Add one remedial action within the lab's authorized scope and an expected successful recovery check.

Try a row with genuinely incomplete evidence. The real reports now show no new student, but the site is fast and healthy. The browser's JSON response could be stale, a different database could be selected or the prior operation may not have happened. Write the expected participant record ID, exact route, time filter and role. Observe the application-specific result and the authorized database target. Do not rerun a non-idempotent update to resolve uncertain data state. A safe verification step can narrow the explanation without changing the system.

Exercise six. Review the managed configuration with someone else

Choose one managed example from the chapter and describe its owner and runtime settings. For Flask, identify the absolute Gunicorn binary, project directory, dedicated account, configured loopback port, database setting inputs and projected credential where applicable. For Express, identify the entry file and Node runtime, plus whether a direct unit or a PM2-managed process owns it. A direct systemd unit and an independent PM2 command should not both start the same listener. For PHP, identify the front's matching FastCGI location and its actual pool's socket or private address. Print only non-sensitive configuration fields in your worksheet.

In the review, agree on success for three lifecycle events. For a fresh startup, confirm that the process gains only its intended scope and answers the real read. For a planned service restart, verify it uses the same required configuration and returns to the expected listener. For clean stop, confirm that it stops accepting requests, its temporary resources are cleared and a separate service remains unaffected. A test of local startup followed by terminating the process cannot prove automatic startup after a whole host boot. If boot verification is assigned, document the setting and suitable isolated host procedure before conducting it.

In a managed architecture, settings belong to different layers. An enable operation registers the service's boot relationship. A reload can update a daemon's preferences without tearing down everything, when supported and implemented. A restart replaces the running service and may terminate existing requests. A deployment replacing one app process on a live service also needs an appropriate plan for work in flight. When revising a private host, retain the previous owned settings and define the exact intended confirmation. Our local labs compare directed behavior and do not require whole-machine restarts.

Write one question about secrets that your peer can answer without revealing the secret. “Which authorized identity reads the assigned credential, and how did you verify a fresh successful connection?” is useful. “Send the environment contents” is inappropriate. Write a similar question about grants, such as which table and operations the service needs to perform. If you chose the SQL read-only role as your design answer, identify which lab steps must stay simulated or be performed under a separate training role. Know where to return temporary credentials when finished.

Submit a concise runbook and complete the teardown

Put together a one-page runbook with the diagram, runtime and exact test evidence. Include the correct expected hostname and representative GET, then note the approved startup or private process invocation, expected output and how the failure can be diagnosed. Record which evidence was observed on your own machine and which design answers were based on reasoning. You can earn full credit on the optional AWS design without creating a public endpoint. An accurate account of what you did is more valuable than a screenshot of a resource that no longer has a clear owner.

If you simulated missing or partial dataset behavior, record the exact failure phase. State whether the site-facing failure was a gateway response or one generated by the app. Report how you restored the working state, the final status and a meaningful recognizable data result. Include an unaffected neighboring path for the combined front. Avoid writing private values in the log or worksheet. If no real writes were used, record that boundary. If you used the authorized SQL rollback test, include the before and after counts and independent marker comparison.

Teardown goes in dependency order. Stop the private Nginx worker through its own running terminal when done. Stop the owned practice app, verify its local listener is closed, and only then retire a dedicated database sandbox if it belongs solely to this exercise. If a database is shared among other learners, keep that service running and follow its approved retention procedure for your synthetic rows. Do not remove a shared log, config or file to clean your copy. Remove or archive only the local deployment settings, synthetic artifacts and temporary credentials you created. Preserve the non-sensitive report that serves as coursework evidence.

For a paper runbook on a hypothetical AWS system, add the resources and dependencies an authorized owner would record. A load balancer, target group, private application listeners, database storage, snapshots and logging can have different lifetimes. Removing an application does not necessarily remove all its retained data or billing resources. Record explicit ownership and what must remain. The local lab uses none of these cloud resources. If later assigned a cloud execution, check the selected account and region, plan charges, and follow that environment's allocation and teardown procedure.

Capstone. Grade three proposed workshop deployments

Proposal A. A requirement is satisfied by a different route

The deployment note says, “The host answers 200 and the student report is therefore ready.” It gives only the IP and course information URL. Use the combined front exercise to produce the evidence that contradicts the claim. Submit the status and body marker of the actual named syllabus, the real data route and the IP-only default. Then describe an end-to-end check for the real hosted system using its own approved hostname and certificate. Your corrected note should identify which one is an isolated local check and which would verify delivery of the real hostname. Avoid guessing about the app or storage if all you tested was a file route.

A useful grading answer names the different handlers and statuses you observed. The example front can deliver its own syllabus when its private target is stopped. A test for the report's representative JSON fields and expected synthetic IDs covers the intended user's need. A recurring check should keep the method and credentials in approved scope. The data route may return a different response for other users or formats. Record the identity and report context you actually verified. A good chapter exercise shows what evidence would support a broader deployment decision.

Proposal B. A shared database account is easier to support

The proposal says to use one database administrator role for the site, report tool and occasional schema updates. Redraw its intended operations. The site reads names and cities from one synthetic table. The training form inserts under its temporary role. The separate schema installation creates and alters the practice database and is approved by its data owner. Give each identity only the appropriate scope and write down the intended procedure for revoking the temporary role. The how-to should display recognizable role names and data actions, never password values. The evidence row needs a check under the actual assigned identity.

A strongest answer includes an operation that must be denied and proves the expected operation remains permitted. In practice, choose a harmless read with the managed runtime role. An authorized disposable exercise can also show a denied operation without making any change to real data. The interview lab demonstrates the application's HTTP gate independently of SQL permission. The database lab demonstrates the allowed synthetic SQL transaction separately. A full design can require both controls. The proposal becomes independently testable when each failure or success is tied to the layer that governs it.

Proposal C. Restore the earlier front and consider the incident done

The old front config points to a previously approved port. The candidate unexpectedly failed after its underlying report requirements changed. Propose when a narrow route restore could responsibly recover the readers' operation. Check both the previous target's availability and its compatibility with the actual data. Record an expected table or response marker. Restore only the assigned private config when conducting the rehearsal and test its syntax before activation. Keep the process ownership and state associated with each release in view. Reusing an old filename gives no conclusion about the app it will target.

Show the instructor how you know the restore was successful. A stable default route is a separate guard. The real report should return the intended content through its named path. In a production scenario, recovery of a write operation may also need reconciliation of partially processed requests. Make this exercise read-only unless it is the explicitly authorized disposable SQL stage. A narrow restore of traffic can give the team time to fix the candidate while maintaining a known working path. Describe whether you solved the candidate or only restored service from the earlier release.

Optional comparison. Run the same evidence checks with a second runtime

Choose a second supported stack when your machine already meets its prerequisites. Keep its listener separate and use equivalent synthetic inputs. For Flask and Express, run the same JSON checker against each assigned private port and compare both output and how the process reaches storage. For PHP, ask the assigned front route to render the expected seed markers and use the relevant FPM logs if it fails. Do not demand the same endpoint shape where the sample deliberately exposes a different representation. The comparison can stay on one operating system. The runtime, protocol and serving boundary give the exercise plenty to learn.

Write one real difference observed. For example, PHP's web front must select the proper script handler, while both assigned JSON apps listen for HTTP independently of the front. Flask is instantiated by the managed WSGI server selected for the exercise. Express handles routes in its Node process. Their dependency connection and database permissions still deserve equivalent tests. You can then generalize the process of diagnosis without pretending the startup commands are interchangeable across operating systems. Clearly report any part of your comparison you were able to reason through without executing.

Check your work against a grading example

Suppose Riya submits a worksheet with a screenshot of a 200 response, an account named appuser and a reliable listener start. To receive full credit, she has to establish what each one covers. The status came from the unnamed course front, so it does not establish the chosen application's read. The account name does not prove the correct host match or expected rights. The startup screenshot shows the process was running during the setup, but not that it responds at the configured upstream. Have Riya add an exact named route, a returned marker and a focused database result using the runtime identity. Those checks produce observation rather than just showing tools were installed.

Now read a different worksheet. Vinay used the combined front and exact report checker, but wrote that the browser could connect publicly because a local curl with --resolve passed. That local check bypassed ordinary DNS and stayed on the loopback interface. Give credit for private named virtual host selection and the expected app response. Ask him to mark public DNS, TLS and deployed source reachability as planning items unless he has deliberately verified them in an authorized hosted environment. The same distinction applies to a fully reproducible local restart. It proves the private process returned with its explicit settings, while a managed boot test has a distinct set of startup dependencies.

Use those two examples to score your own work. Award one point each for a clear diagram, role-specific data evidence, app response with the expected type and fields, front host and route evidence, and a teardown note that identifies affected resources. Add a recovery point if you showed one controlled practice failure and a verified restoration. If you completed only the local lab, label the hypothetical multi-host plan accordingly. If permission, prerequisites or time limited an optional portion, record the exact observed portion and the next possible check. That makes the exercise useful for a learner starting from your results.

Explain and defend your submitted results

Why does a rolled-back SQL exercise validate a permission without saving the row?

The account needs INSERT to execute the allowed statement, and the transaction on that same connection keeps the effect pending until a decision. The session can read the inserted row before rollback. Once it rolls back, the same synthetic table no longer contains that row. An auto-increment value can be skipped. A final count and marker comparison prove more than expecting the sequence to have no gaps. If you submitted an HTTP form separately, its app acquired a different SQL connection and your CLI rollback could not undo it.

What does the report checker prove about the listening process?

It proves the loopback port answered the checks with 200, an appropriate JSON media type and the selected expected data. Its result can help confirm the intended app configuration, especially when tied to your launch note. It does not independently identify a public name, its certificate, users' access or every query. To test the front, issue the named request and compare the configured path and returned expected data.

How does the one-host exercise distinguish app and data failure?

When the app stops, the direct IP and port do not send an HTTP reply. The front can still serve its own route while saying its upstream call failed. If the same running app replies 503 for its report, read the status and corresponding operator evidence. A failing data operation can occur while the app is listening. The partial schema exercise adds a specific example where narrow readiness passes and the actual report query fails. These evidence patterns require different next steps.

What makes a lab safe to repeat with the next class?

It has known synthetic inputs, its own workspaces and process identities, explicit prerequisites and a documented success condition. When it writes data, it defines the owning scope and cleanup. It leaves no needed side effects on shared hosts, other sites or live databases. The next student can recreate the intended state and compare known markers. Fixed example ports are only defaults when assigned and free. Repeatability includes how to resolve a collision without touching other services.

How would you grade a solution assembled across operating systems?

Compare observable roles and results. Package names, runtime paths and process tools can vary. In each environment verify the installed supported dependency, exact listener, properly selected front route and known report data. Verify authorized writes only inside their disposable scope. Use per-platform verification and specify which differences were actually observed. Three installations with no expected content evidence are weaker than one complete and carefully demonstrated deployment.

Check the expected results before running the labs

  1. Where does the workshop frontend send its named /workshop-api/api/students path?

    Show answer

    To the selected private app's /api/students. The configured target URI replaces the front's matching prefix in this simple Nginx rule.

  2. What should the tentative row look like after the lab's rollback?

    Show answer

    It should be absent from the table, while the original count and markers remain. The allocated ID may still be skipped in a later insert.

  3. Why can the JSON checker succeed while a reader reaches the wrong website?

    Show answer

    It tests an assigned application port on localhost. Public name, TLS and front route selection are separate and must be verified using the intended name.

  4. The front's syllabus succeeds when its report fails. Which test identifies a stopped private app?

    Show answer

    Check the configured private listener and make the relevant app-direct GET. Compare the connection result and actual front log with the syllabus's independent result.

  5. When is it appropriate to reboot to test managed startup?

    Show answer

    Only for an explicitly assigned disposable system or approved planned boot test. An ordinary local hosting exercise can prove selected operations without rebooting unrelated services.

Revision cards

Route diagram
Name every directed connection, protocol, listener, owner and tested route. Include the independent app and database boundaries.
Known seed evidence
Check real synthetic record IDs and fields as well as status. A matching count alone does not identify a dataset.
Transactional practice
Use the assigned disposable InnoDB table and the same SQL session for insert, observation and rollback. Verify the remaining records.
Private front check
Test the intended hostname, front-owned marker, prefixed report route and expected default behavior independently.
Boundary diagnosis
Compare listener, route and data evidence before selecting a narrow remedy. A gateway response and an app response tell different stories.
Scoped teardown
Stop only the owned processes and retire only the authorized temporary state. Keep useful non-sensitive evidence that supports the runbook.

Official references