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

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

AWS Cloud

10.7 Troubleshooting dynamic sites

Friends, a dynamic request can fail before the front server, inside the app or at its database. Start with the exact failing request and choose the next check from what it actually shows.

Symptom Initial clue Next check
502 Bad Gateway The gateway reports an upstream interaction failure. Compare the exact direct request, configured target and front error log. Check scoped host policy only if its evidence points there.
504 Gateway Timeout The gateway did not receive a timely upstream response. Find which clock expired and correlate with app and database timing. A locally successful slow request can exceed a front limit.
Access denied for user 'appuser' The server rejected the attempted login or specified access. Compare the matched role and host, secret, auth plugin, protocol and approved permissions. Check the needed operation under that identity.
ECONNREFUSED ::​1:​3306 (Node) The connection attempt addressed IPv6 loopback and was refused. Compare the actual dependency listener, address family and port. Use IPv4 loopback only when that is the intended IPv4 listener.
Can't connect to MySQL server The client could not connect to the selected TCP or socket endpoint. Check the intended host, port or local socket and the server’s listener or service evidence. Restart only the owned service when indicated.
cryptography package is required (Python) The configured PyMySQL authentication method needs its RSA dependency. Confirm the client version, auth method and active service environment. Add the documented PyMySQL[rsa] dependency to the reviewed deployment lock and retest.
PHP shown as text / downloaded The web front may be serving PHP as a file. Follow the assigned incident procedure for exposed source. Verify the active script route and appropriate FastCGI handler in an isolated copy.
Blank page / 500 in PHP The request encountered an application or runtime error. Use the front and FPM log for the actual virtual host, scope and request time. Keep detailed errors out of user responses.
systemd service status=203/EXEC The configured process could not be executed. Inspect ExecStart, executable/interpreter presence, permissions and service execution context, then read the scoped journal.

Ravindra Bagale's Tip

For an error, record the exact path, method and response. Then match the front, app or dependency log to that request. Use the timestamp and a request identifier when one is available.

Lab

Use the disposable datasets in the local diagnostics lab. Compare health, readiness and report statuses and correlate each failed read with its private phase log.

A simple order for checking

  1. Reproduce the expected operation at the requested hostname and route.
  2. Match its response or connection error to front, app and dependency evidence.
  3. When the front reports a failed upstream attempt, compare an appropriate local request and the active configuration.
  4. When the app reports a data error, check transport, identity and the precise authorized read separately.
  5. Verify the original operation after the narrow change or restore.

The same checks for other stacks

If your team uses a different language, these are the equivalents.

Java / Spring Boot

Use the Actuator health endpoint if it is configured and authorized. Only registered indicators report dependency health, and display of component details is separately configured.

curl -s 127.0.0.1:8080/actuator/health

What you see:

{"status":"UP","components":{"db":{"status":"UP"}}}
.NET / ASP.NET Core

Register the required health checks and map an authorized endpoint. A basic endpoint without a database health check cannot prove query readiness.

curl -s 127.0.0.1:5000/health

What you see:

Healthy
Python / Django

Run the deploy settings checks for the intended settings. Use the assigned database shell for a separate scoped connection and query check.

python manage.py check --deploy && python manage.py dbshell

What you see:

System check identified no issues
Go

A simple /healthz handler that pings the database.

curl -s 127.0.0.1:8080/healthz

What you see:

ok
PostgreSQL

This checks the PostgreSQL server’s connection status. Establish the application role and useful query separately.

pg_isready -h 127.0.0.1

What you see:

127.0.0.1:5432 - accepting connections
MongoDB

Ping an assigned MongoDB process with the approved client options. The command checks whether the server responds.

mongosh --eval "db.runCommand({ping:1})"

What you see:

{ ok: 1 }
Redis

Use an assigned Redis target and a masked credential prompt when required. PING shows that the reached service responds to that operation.

redis-cli --askpass PING

What you see:

PONG

Summary

StackHealth check
Spring Boot/actuator/health
ASP.NET Core/health
Djangocheck --deploy
Go/healthz
PostgreSQLpg_isready
MongoDBping
RedisPING

Workshop incident example

A sample workshop app showed 502 after a deployment. The proxy logged a refused connection to its assigned port. The app supervisor logged a startup error because a required database host setting was missing. Restoring the expected setting and then verifying a real report confirmed the repair.

Recap

  • Follow the failed operation and compare its front, app and data evidence.
  • Identify exactly which process and dependencies the configured check observes.

Start from a precise report and narrow the failing boundary

At 10:15, the workshop instructor says, “The site is down.” Ask which task they were trying to do. The course information opens, and the report page shows its heading, but the expected student list fails to load. A learner's screenshot may show these observations without telling you which request failed. Find the exact URL, approximate time and time zone, expected result and how the user knew it was wrong. Use a harmless synthetic record or an approved read to reproduce it. Test the smallest operation demonstrating the same failure. Never repeat an action that updates real records just to obtain another screenshot.

Dynamic sites depend on several separate operations. The browser resolves a hostname and connects to the web front. The front selects a site and route. It may serve a file or pass a request to a separately running app. The app may acquire a database connection and run a query under its own identity. Finally it renders HTML or builds data for the browser to display. A failed step can look like the same generic page error to the reader. Even a page returning 200 can show wrong or stale data. Confirm the part users actually need before calling the application healthy.

Draw the delivery path as a row of evidence. For one hosted site the row might read browser, DNS, TLS listener, front route, upstream listener, application handler, SQL connection, table query, rendered result. Use only the boundaries that actually exist. A local PHP page may pass via FastCGI to a PHP worker. That connection does not have the same protocol as an HTTP request sent to Flask or Express. A browser running a script can request a second URL after initial HTML is delivered. Test the data URL if the script's output is the first part that failed.

A beginner can reduce a messy issue by changing the question one time. Start with the failing public request. If that completed with an application-specific dependency error, look at the corresponding app and database evidence. If a known proxy returned a 502, compare the exact direct app call with the proxied one. If the browser reports no HTTP response, check name resolution, address, port and the TLS handshake before following an SQL hint. The order of checks depends on what the current observation establishes. Follow each result to the next boundary it can help distinguish.

Keep a short record. Write the tested method, route and host. Note the relevant status or client error, the expected app marker and which log supplied a matching event. Separate observations from explanations. “The route returned 503 and the app log wrote query unavailable at that time” is an observation. “Someone changed the password” is a hypothesis until the corresponding evidence supports it. Record which environments are affected and which test still works. A small, reliable observation often avoids a large speculative change on a shared server.

Distinguish a response from an attempt that never got one

Start with the request that matters. If the user's report action uses GET, issue a GET with the correct hostname and route. Curl can show the response headers and body, a user-defined summary of timing, its own exit result, or any combination you choose. The call below uses the local exercise listener. In a managed environment use the assigned site name with ordinary certificate verification and approved read credentials. Use a timeout that is long enough to observe the expected normal response. A timeout chosen for local diagnosis is a bound on the client test, not a change to the server's policy.

curl --noproxy '*' --connect-timeout 2 --max-time 6 --include \
  'http://127.0.0.1:18964/api/registrations'

curl --noproxy '*' --connect-timeout 2 --max-time 6 --silent --show-error \
  --output /dev/null \
  --write-out 'http=%{response_code} connect=%{time_connect} first_byte=%{time_starttransfer} total=%{time_total}\n' \
  'http://127.0.0.1:18964/api/registrations'

The first command observes what answered. The second discards the body and reports a timing row. The sample timings are cumulative elapsed times counted from curl's start. Time to first byte includes the connection phase and the wait until response data begins. On HTTPS, the available TLS timing field can help show whether that phase completed. Compare like methods and routes under the same testing conditions. A 200 in the timing row is valuable but incomplete. The first command still checks the expected body or synthetic marker. Command exit and HTTP response status are different observations. Curl without a fail option can complete its transfer successfully after receiving an HTTP error.

If curl cannot connect and shows no HTTP status, record the resolver, peer address and listening port it was meant to target. An actively refused loopback connection in a strict lab usually means the expected process is absent at that address or port. A long wait can have a range of reasons, including routing, reachability or a time budget exceeded while a component remains silent. A certificate name failure occurs at the TLS boundary before the browser trusts the HTTP connection. Preserve actual certificate checks to diagnose it. Compare the name used, the endpoint that resolved and its certificate configured on the intended listener.

ObservationInitial distinctionEvidence to seek
Curl never receives an HTTP responseSomething prevented the observed HTTP exchange from finishing.Use the actual client error and the DNS, TCP or TLS phase that failed.
404 with a front-specific markerThe intended handler might never have been selected.Compare the hostname and route with effective proxy settings and logs.
404 with an app-specific markerAn application handler has replied.Confirm the received request path, resource ID and handler's semantics.
403 with an expected access responseThe route was understood and access was refused.Use the authorized identity and route-specific policy, with no global permission change.
502 or 504 generated by the frontThe front reports failure interacting with a target.Verify the selected target, then compare connection and response evidence.
503 after an app's dependent queryThe app answered but currently cannot supply that operation.Read the scoped app event and check required resource access.
200 with a wrong totalThe HTTP transport completed for a route, and the business outcome is still wrong.Confirm environment, query parameters, actual data and cached response meaning.

These rows are questions to ask. Operators can use the same status for different expected states. A 404 may mean an absent row or unknown URL. A 503 may come from the application, a frontend rejecting requests or an AWS load balancer unable to forward to an available target. The original response does not always announce the sending layer. Correlate logs and known body markers with the precise request. Save error headers or bodies only with the necessary approval and remove real identifiers or tokens from anything others will read.

Match the request to the service, listener and release

After a failed rollout, a process manager showing active may refer to the right unit with a wrong port or an unexpected working directory. A service listing tells you its process state, which is a useful but limited fact. Compare it with the listener evidence and a direct request from the approved host or namespace. If the application responds directly on an address other than the configured upstream, a reload of the front may be needed after reviewing the correct target. If a different owner uses the expected port, do not stop it. Restore the appropriate app config or assign a properly scoped listener to the deployment you own.

# Examples for the assigned Linux service and listener:
systemctl status workshop-report.service
journalctl -u workshop-report.service --since '15 minutes ago' --no-pager
ss -ltn 'sport = :18964'

# Meaningful local GET once its process is running:
curl --noproxy '*' --max-time 6 --include \
  http://127.0.0.1:18964/api/registrations

journalctl -u limits the query to an assigned unit, and the example time filter reduces unrelated history. In PM2, inspect the exact process name and limited log window instead of restarting every app. For Apache and Nginx, refer to the actual access or error log configured for that site, including its timestamp interpretation. Distributed services can emit local or UTC times. When two requests look the same and overlap, an approved request identifier or high-resolution timestamp helps match the entries. Keep probe data harmless and approved. Avoid logging credentials, cookies, full request bodies or user data just to get a more detailed incident trace.

When a proxy receives a response code, it often logs the result to the client separately from the upstream status. An AWS Application Load Balancer access log also distinguishes load balancer and target evidence. A site with a CDN and a reverse proxy can produce several such entries, and a cache hit may result in no upstream request at all. Work from the known request time, method and path. If logs lack direct correlation, keep the conclusion tentative. Multiple proxy tries or an upstream retry can mean more than one target attempt for one reader request. Compare a known request that works so the learner can see what an ordinary log row looks like.

On a PHP site, the front may connect to a PHP-FPM Unix socket. A socket path is an operating system endpoint used by communicating processes. A shell curl cannot simply send HTTP to a FastCGI-only socket and pronounce FPM broken. Use a supported probe for the actual architecture, such as the assigned HTTP PHP route through the front, its FastCGI error evidence and the FPM unit or socket permissions. Verify the owning service identity, the specific socket path in effective config and the PHP worker's owner or group. Do not make a shared socket publicly writable. A PHP source file accidentally served as text should be handled as a configuration problem with appropriate operator response.

Look at the exact database check the app needs

Separate connecting, authenticating, selecting a schema and running the required statement. A socket refusal happens before a MySQL server has authenticated the role. A server response such as access denied verifies a server participated but leaves questions about the matched user and host, secret, authentication plugin and connection policy. An account can connect and still fail to select a database or query a table. A successful administrator shell is weak evidence about a restricted app role. Reproduce the same connection type and allowed read with the intended credentials and no application data mutation.

# Set DB_PORT to the assigned practice TCP port before running:
mysql --protocol=TCP --host=127.0.0.1 --port="$DB_PORT" \
  --user=appuser --password --database=appdb \
  --execute='SELECT CURRENT_USER(); SELECT id, name, city FROM students ORDER BY id LIMIT 3;'

--password with no value prompts interactively. The provided secret should come from the authorized practice scope. This example deliberately matches the database setup chapter's scope. On an actual deployment, use approved connectivity and TLS settings for the assigned location, and a narrow query that proves the intended role can perform its work. A tool opening a Unix socket as an operating system admin exercises a different path from the Node app to a TCP listener. Explicit connection parameters in a safe practice copy avoid assuming a console session and app are identical. Observe the effective current user if the server accepts the connection.

Different database failures call for different questions. An unknown database can mean the app is pointed at an earlier test environment or a migration was not applied. An unknown column can mean the application expects a revision not yet installed. A permission error specific to the required table can mean a grant did not include that operation under the matched identity. An app failing after an upgrade can be using an incompatible client or TLS setup. Read the exact error category in appropriate operator logs and compare deploy history before considering any change. Keep the repair narrow. Do not turn a restricted role into a database administrator to make an early test pass.

A healthy database server can still serve the wrong result. If the report's total says one item but a teammate expects two, first confirm the app's configured environment and the intended dataset, date or filter. The query may legitimately select an unusual range. Cached API data may have originated from a valid but earlier request. Record a known synthetic marker and exact result scope. Compare both app output and the authorized narrow database read. A row count alone can match by coincidence even when two environments have different data, so identify the expected row or changed field as well.

Give health, readiness and a user check separate meanings

Imagine the workshop service is installed correctly but the practice data was left in a different folder. A lightweight health endpoint can still answer because the process reads no dataset for it. A readiness check attempts a narrow operation needed to serve traffic. A user-result check retrieves the report and verifies genuine synthetic evidence. If the narrow readiness operation checks only a column named ID and the report needs a second column, a partial schema can make readiness pass while the report fails. That difference is useful evidence about the check's coverage. Update meaningful checks with the app when the operation's requirements change.

Restart rules and routing decisions can use different probes. A process that has become unresponsive might merit restarting. A healthy process with an unavailable shared database usually needs the dependency fixed. Restarting every application process together may create extra load without improving that dependency. A readiness response can tell a load balancer whether to route to a particular instance, depending on how the deployment configures the checks. If all instances use the same dependency and lose it together, the user workflow still needs a planned degraded response. Do not assume the routing tier will magically turn read failures into successful business results.

Health indicators differ across frameworks. Spring Boot can expose an actuator health endpoint if configured, but component indicators and detail visibility vary. ASP.NET Core can expose a basic readiness response and can register specific dependency checks. A probe that only completed an endpoint without a dependency check has no evidence about a table. Django's deployment checks examine project settings using its system-check framework. A successful run does not demonstrate that the intended request queries the correct dataset. A database utility such as pg_isready assesses server connection status, while an app query verifies its own identity, schema and logic. Treat each result as scoped evidence.

Lab one. Prepare a known-good and partially compatible dataset

Use an empty local workspace. You need Python 3 with the standard SQLite module and curl, plus a test port assigned for your copy. This exercise uses two small local data files. It does not require an AWS account, a server credential, or changing any installed database. SQLite opens a file directly from the app. A real MySQL service instead exchanges network or socket messages and authenticates the role. We are using local files here to demonstrate how a running app can give several distinct readiness and query outcomes without disrupting a shared dependency.

Run the seed command within the empty workspace. It creates two named files only if neither one already exists. The complete file has a table whose rows contain both ID and title. The partial file has a table with the same name and an ID but has no title column. Put the files in this workspace along with the diagnostic app. In a real incident a different schema can arrive when an application deployment and migration get out of order, or when a process points to an unexpected environment. This fixture reproduces only the resulting data contract difference with synthetic rows.

python3 - <<'PY'
from contextlib import closing
from pathlib import Path
import sqlite3

complete = Path("complete-lab.sqlite3")
partial = Path("partial-lab.sqlite3")
if complete.exists() or partial.exists():
    raise SystemExit("Use a new empty exercise folder.")

with closing(sqlite3.connect(complete)) as db, db:
    db.execute("CREATE TABLE registrations (id INTEGER PRIMARY KEY, title TEXT NOT NULL)")
    db.executemany("INSERT INTO registrations (title) VALUES (?)",
                   [("Morning practice",), ("Afternoon practice",)])
with closing(sqlite3.connect(partial)) as db, db:
    db.execute("CREATE TABLE registrations (id INTEGER PRIMARY KEY)")
    db.execute("INSERT INTO registrations (id) VALUES (1)")
print("Created complete-lab and partial-lab datasets.")
PY

Use the program's file creation message as evidence of what was prepared. No missing-lab.sqlite3 file should exist. Later the application opens only the file it receives with the approved arguments. It doesn't create missing files, because its read-only connection specifies SQLite's mode=ro option. That local choice prevents a mistyped file location from silently initializing an unrelated empty database.

Save this as diagnose_app.py. The fixture accepts only a local IPv4 HTTP connection. It returns a simple request identifier header on each exercise GET response. The restricted terminal log records the operation phase for expected failures, plus that request identifier. The reader sees a short service message with no filesystem path or raw SQL error. It returns status 503 to illustrate a temporarily unavailable operation. The actual status policy in your app depends on how its users and operators should interpret the failure.

import argparse
from contextlib import closing
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from urllib.parse import urlsplit
from uuid import uuid4
import json
import sqlite3

parser = argparse.ArgumentParser()
parser.add_argument("--dataset", required=True, type=Path)
parser.add_argument("--port", default=18964, type=int)
args = parser.parse_args()
if not 1024 <= args.port <= 65535:
    parser.error("Choose an assigned unprivileged port")
database_uri = args.dataset.resolve().as_uri() + "?mode=ro"

class Workshop(BaseHTTPRequestHandler):
    def handle_one_request(self):
        self.request_id = uuid4().hex[:12]
        super().handle_one_request()

    def respond(self, status, value):
        payload = json.dumps(value).encode("utf-8")
        self.send_response(status)
        self.send_header("Content-Type", "application/json")
        self.send_header("X-Practice-Request", self.request_id)
        self.send_header("Cache-Control", "no-store")
        self.send_header("Content-Length", str(len(payload)))
        self.end_headers()
        self.wfile.write(payload)

    def log_request(self, code="-", size="-"):
        method = getattr(self, "command", None) or "-"
        path = getattr(self, "path", "").partition("?")[0]
        print(f"request={self.request_id} method={method} "
              f"route={path!r} status={code}", flush=True)

    def read_rows(self, statement):
        phase = "open_dataset"
        try:
            with closing(sqlite3.connect(database_uri, uri=True)) as db:
                phase = "query_registrations"
                return db.execute(statement).fetchall()
        except sqlite3.Error as error:
            kind = getattr(error, "sqlite_errorname", type(error).__name__)
            print(f"request={self.request_id} phase={phase} category={kind}", flush=True)
            return None

    def do_GET(self):
        path = urlsplit(self.path).path
        if path == "/health":
            return self.respond(200, {"status": "alive"})
        if path == "/ready":
            rows = self.read_rows("SELECT id FROM registrations LIMIT 1")
            if rows is not None:
                return self.respond(200, {"status": "ready"})
        elif path == "/api/registrations":
            rows = self.read_rows("SELECT id, title FROM registrations ORDER BY id")
            if rows is not None:
                return self.respond(200, {"registrations": rows, "count": len(rows)})
        else:
            return self.respond(404, {"error": "Unknown practice route"})
        return self.respond(503, {"error": "Registration information unavailable"})

with ThreadingHTTPServer(("127.0.0.1", args.port), Workshop) as server:
    print(f"Started the workshop app on local port {args.port}", flush=True)
    server.serve_forever()

If the startup Python modules cannot read or write the seed files, stop the lab and select a fresh folder owned by your training account. Do not alter another user's permissions to run an exercise. The fixture logs only the known local request path and small generated IDs. Keep the fixture private. The status route checks the process and HTTP boundary. Readiness queries the ID column. Data asks for both columns and accounts for every returned synthetic row.

Lab two. Collect evidence for three distinct outcomes

From the private workspace, start the complete app in a foreground terminal. Use a separate terminal for curl. If port 18964 is already occupied, select an assigned free replacement and change each curl URL. Record the three statuses and one related request identifier. All three should be 200, and the data body should contain both Morning practice and Afternoon practice and a count of two. Start with the good case so later differences have a known comparison.

python3 diagnose_app.py --dataset complete-lab.sqlite3 --port 18964
for route in /health /ready /api/registrations; do
  curl --noproxy '*' --max-time 6 --include "http://127.0.0.1:18964$route"
  printf '\n'
done

Stop the complete app with Control-C in its own terminal. Start a fresh instance against a filename that you know does not exist. No configuration of the good file has changed. Repeat the curl loop. The health request still answers and gives a new identifier. Both other requests fail because the process cannot open the dataset. Match the identifier on the 503 response to its specific open_dataset event. Check that the missing file was not created. In a longer incident, first verify how the service received its file path and under which identity it tried to open it.

python3 diagnose_app.py --dataset missing-lab.sqlite3 --port 18964
# Stop that specific foreground process, then start the next case:
python3 diagnose_app.py --dataset partial-lab.sqlite3 --port 18964

Repeat the loop for the partial file. Health and readiness should now pass, while the data API returns 503. The request identifier joins that response to its query_registrations event. The file could be opened and the ID-only query could run. The body read uses a title column the partial schema lacks. A conclusion that the app cannot open the file would fit the earlier run but contradict this one. Restore the complete dataset argument and verify all three responses again. Revise the readiness probe design on paper if the critical route must only receive traffic when both required fields are present.

Selected data pathHealthReadinessUser data and operator evidence
Complete file200200200 and two named synthetic rows.
Missing file200503503 with a matching open-dataset event.
Partial file200200503 with a matching query event.
Restored complete file200200200 and the same two expected rows again.

Compare the last case with a different failure from the reverse proxy exercise. There the front responded 502 and a direct upstream TCP connection was refused. This lesson's application replies on its own listener, the status route is alive, and the log shows the exact depth where the data operation broke. A security group change could not add the missing title column in the local data contract. End each exercise by stopping only the owned foreground processes. Keep the recorded evidence and remove only the mock files you created if you no longer need them. After a restart, a copied error line without its timestamp or request identifier is insufficient evidence about the restored case.

Separate cloud configuration evidence from a live application result

On an approved AWS training environment, capture the public route, its listener and selected target group. An Application Load Balancer health check runs its configured path, protocol, port and status criteria. Read that configured check before concluding why the target is healthy. If a target group has only unhealthy registered targets, AWS documents an ALB fail-open behavior that can still route requests to those targets. An all-unhealthy event can therefore still have application traffic and requires checking both the target-health reasons and actual response. If it simply checks a front static page, it may not verify the app's database call. Check target health reasons and compare the results from the intended public hostname and the appropriate internal route. Load balancer and application access logs can show whether the target or load balancer generated an error. Keep the handling specific to the assigned target group and scope.

AWS Reachability Analyzer analyzes supported VPC resource configuration for a path. Its evidence can help identify routing, security group or ACL issues. A configuration path being reachable gives no proof that a process is listening, TLS is valid or a query is authorized. A healthy private GET can also coexist with a wrong public rule, different path or invalid certificate. State your result in terms of what the test actually covers. If enabled operator logs are aggregated, use the approved time range and relevant log groups. A narrow query saves irrelevant review and can reduce log analysis costs.

Consider one concrete case. A front connects an application port across two EC2 instances and the application connects to a managed database. The policy should describe each flow individually. App host health check from an approved front subnet is one flow. The restricted DB client from the application is another. Public clients reach only the designated public entry. If the database error returns through the app, widening the front client rules does not explain it. If the client never reaches the private target, resetting the database's app credential cannot finish the front request. Use the match between failed step and available evidence to keep changes small.

Write a short diagnosis another operator can reproduce

Suppose the front serves an HTML page with an empty study report immediately after the Tuesday release. A student recorded a failed request for data at 10:15. The public route and the private app both return the same data error. The app's health and narrow readiness checks pass. The operator log shows the app can open its dataset but fails to query the expected column. Write a report that records the actual time, scope, last known working version, evidence from each boundary and the next reversible check. The person joining after you can repeat the relevant read rather than opening the deployment and guessing at the entire configuration.

Next list alternative explanations and how to distinguish them. The raw schema query might report a missing column, but checking only one database may miss a role pointing to a different default schema. Compare the configured environment label, assigned database and actual target read for the affected process. The current app release may require a schema change that was delayed, or the service may have launched with the wrong environment settings. These are different repairs. A migration requires a planned data change with compatibility and rollback considerations. Restoring a correct environment reference requires verifying which live database was intended. The practice lab proves only that an insufficient schema can cause this pattern.

For a time-based fault, collect several comparable healthy and failed observations under approved conditions. Compare the distribution of response times for the same route and representative scope. One slow request can reflect a warm-up, a contested dependency or an unusual amount of time waiting on a worker. A repeated failure at one consistent configured interval is evidence that a timer may be expiring. Record which component observed it and whether the corresponding request ever crossed the next boundary. If a new query is slower for large cohorts, measure time and returned rows with ordinary authorized data tools before widening a front timeout. Fixing the workload and allowing sufficient time solve different problems.

Once a repair is chosen, change one part you can reverse. Use an already approved previous app revision only if it still understands the database schema. If the restore needs both an old app and an old config, verify the pair. Re-probe the original failing user view, the narrow ready check and a known general route. Select one nearby function that could have been affected by your change. Keep a record of observed times and expected markers. A clean JSON error disappearing is progress. The fix is complete for the documented task only when the learner can see the intended report and surrounding checks agree.

Sometimes the diagnosis is still uncertain when another owner needs to take over. A useful handoff records precise facts and one next discriminating read, such as, “front API fails before returning rows, direct data and ready return 200, front log uses leftover target port 18963, desired listener 18964 is proven from the expected host.” Our exercise uses made-up ports. For a real hostname follow the organization's policies for handling logs and resource identifiers. Keep real secrets or unrestricted data out of the handoff. Do not fill in unknown information with a confident answer just because two error codes look similar.

Follow a successful response with the wrong environment

A quieter incident happens when the reader gets a normal JSON object whose count is two, the same count as the previous day. The workshop instructor expects Morning practice, but the report lists Sample welcome instead. Two environments can both satisfy the schema and return good status codes. In your release record include a stable synthetic marker that exists only in the intended dataset. Don't put a live account ID, full database hostname or credentials in an externally visible response. You can record the approved environment label in internal deployment evidence and check the synthetic marker with an authorized read.

Work from the public request inward. Compare the named site with the name expected in the deployment plan. If testing a planned change that bypasses ordinary DNS temporarily, curl's --resolve lets an authorized tester supply the chosen address for an exact host and port. Keep using the intended URL name so TLS validation still applies. A connection override confirms the chosen endpoint's behavior and intentionally gives no evidence about public DNS at that moment. Preserve that distinction in the test note. A legitimate learner test through real DNS afterwards proves the public name resolves and gives the intended result.

If the name is right but the content is wrong, compare the public result and a direct app request. A correct direct result suggests the front selected another target, or a separate front cache served an earlier representation under its policy. Review the effective route and any relevant response age or cache evidence. If both displays match the wrong result, compare the release identity and app's actual storage target. Confirm the entity IDs with a permitted narrow query. Layer-by-layer reasoning prevents calls to purge every cache or repoint a database before the specific discrepancy is observed.

Now imagine two unrelated problems at once. The public report still routes only to the old host, and the new host is healthy but uses the partial schema from the lab. Fixing DNS or a proxy rule could move readers to a route that returns a new failure. Before shifting traffic, test the candidate destination's real report using its own intended routing and authorization, as well as its lightweight probes. After shifting, repeat the original public request. The two observations answer separate questions about candidate readiness and actual user delivery.

Apply the diagnostic order to three workshop tickets

  1. Course home works, data request returns a front 404. Record the reported URL and the successful home route. Predict both response markers from the reverse proxy lab, then check the expected public prefix and the direct app route. Your success criterion is a justified choice of the configuration or app handler that should change, with evidence of which layer emitted the 404.

  2. Readiness works and the report fails after a release. Use the partial dataset from this lesson. Write a reasoning chain that distinguishes a database opening failure from a missing field in a table. Design a small new readiness query on paper that verifies both needed columns without reading the entire report. Its purpose is to show whether the route's required data shape is available to the app.

  3. The site reports a successful status while a known row is absent. Plan a comparison using the named synthetic record, exact filter and site environment. Distinguish a legitimate filter, a cached result and a surprising dataset. Pick evidence for each, such as the specific observed query, configured expected environment, safe direct data read, or known issuance time. Passing the task requires one report of the actual user result after any revision.

Write down the first command you choose for each ticket and what it will change about your next decision. If it cannot distinguish two explanations, select a tighter observation. For a managed deployment, add which role or team is allowed to take the next action. A learner can finish all three tickets on paper after the safe local exercise without requiring privileges on the actual training website. Preserve the evidence table even when no code change is needed.

Interview questions with evidence-based answers

Why can a 200 health route and a 503 report coexist?

A narrow health route may avoid the database entirely. It shows that the HTTP process can answer its check. The real data route can need file access, connection authentication, table permissions or the expected fields. Probe the real read and inspect its app evidence, using the relevant authority and synthetic data. A 503 provides a clue about availability without identifying the exact failing step.

How do you know that the proxy received a request the app never processed?

Match the request to both layers. Check the front's route and reported upstream target. A known front marker with no target evidence, or a recorded refusal before sending any HTTP request, supports a specific explanation. Absence of an app log alone is weaker because logs can be missing or rotated. Combine it with the front error, direct probe and service evidence.

What is the advantage of a SQL query as the app's actual identity?

The app role has its own authentication, connection scope and grants. A privileged administrator can succeed from a different socket or schema even when the app fails. A targeted read made with the required identity and connection settings can separate authentication from schema and operation permission. Preserve the restricted role's intended access rather than broadening it to make a check pass.

When does a 504 prove the application stopped?

By itself it does not establish that the app stopped. It reports a gateway timed out waiting for the interaction. In the reverse proxy exercise the same slow application responds directly when the client waits long enough. Use the exact upstream timing and app logs to discover whether the process was waiting, still working or already gone.

What proves a change repaired the reader's problem?

Replay the same safe operation using the expected site and identity and check its business outcome. A new status response is only one part. Capture the expected marker or result, verify the nearby operation that might be affected and check relevant logs. This should all be done under a narrow change with a known way back.

Check which explanation each observation supports

  1. Curl fails connection setup and receives no HTTP status. What should you check before changing the schema?

    Show answer

    Check the address, relevant DNS or TLS evidence, elapsed times and approved socket scope. The client has no HTTP reply establishing an application or data failure.

  2. In the local exercise, health and readiness pass but the report's log says query registrations. What caused the partial-file result?

    Show answer

    The app opens the file and reads the ID, but the full report also selects the omitted title. The failure happens during the query phase.

  3. An administrator can read the table but the service cannot. Which probe is more discriminating?

    Show answer

    A permitted narrow query using the assigned app identity, required connection type and intended schema. Administrator access proves only what that separate identity can do.

  4. The front returns 200 to every request, including a wrong static page. Is the intended site healthy?

    Show answer

    The known result has not been demonstrated. Confirm the exact hostname, route and expected identity or data marker to detect a default page or a wrong environment.

  5. A cloud configuration analyzer confirms the planned network path. Which checks remain for the report?

    Show answer

    Verify the actual listener, protocol and correct hostname, then the app's route and real data. Network configuration alone cannot establish those live behaviors.

Revision cards

Exact reproduction
Capture method, host, path, time and expected marker for the user's actual operation. Repeat an approved harmless operation.
Client exit versus HTTP status
A curl exit describes its transfer outcome. An HTTP code is evidence from a component that answered.
Process versus outcome
Match manager identity and listener before using health, readiness and meaningful user-result probes.
Authentication versus statement
A database account's ability to connect differs from its ability to select the actual schema and run the required query.
Correlated events
Use a scoped request ID, time and route to connect the reader's response to a matching operator log without leaking private values.
Rollback evidence
Restore the owned compatible revision and redo the original failing operation with its expected result. Verify related routes after the change.

Official references