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

AWS Cloud

Chapter 11: Application Hosting — WordPress, Flask and Express

Hello friends! Chapter 10 introduced dynamic applications. Here we connect those ideas to maintainable WordPress, Flask and Express hosting. A fictional college workshop provides the teaching context, and the local release lab demonstrates updates and recovery with synthetic data.

In this chapter

  • WordPress on LAMP or LEMP
  • wp-config.php and salts
  • Permissions and SELinux
  • WordPress hardening
  • Flask with Gunicorn + Nginx
  • Express with pm2 cluster
  • Deploying updates safely

Friends, this chapter explains the operating responsibilities behind a WordPress site, a Python Flask application with Gunicorn and Nginx, and a Node.js Express application with PM2 and Nginx. Follow the individual application lessons for stack-specific details. The expanded overview below includes an isolated Flask release and recovery exercise.

Concepts in this chapter

  1. 11.1WordPress
  2. 11.2Flask application with Gunicorn + Nginx
  3. 11.3Express application with pm2 + Nginx

Review and practice

  1. ★Common Mistakes I See Students Make
  2. ★Interview Questions
  3. ★Practice Questions and Lab Exercises

Change code while keeping the workshop roster

Change code while keeping the workshop rosterRelease oneKnown marker and two namesRelease twoNew marker, shared dataCode rollbackEarlier code, same rosterDependency failureAlive can still mean unavailable
Read all steps
  1. Release one

    Start the first release with an explicit working directory and data path. Confirm the marker, readiness result and fictional roster before changing the selected code.

  2. Release two

    Stop the first process and start the candidate in this interrupted local exercise. Its version marker changes while the same shared roster is read from the configured data path.

  3. Code rollback

    Select the previous release and verify both its marker and the roster. Selecting old code does not restore a database or undo a schema migration.

  4. Dependency failure

    Move the fixture data aside and compare health with readiness. Restore the data and verify recovery. The probes differ because they perform different checks.

1. Turn a working program into a maintainable service

A student finishes a registration program on a laptop. It opens correctly, accepts a name, and displays a confirmation. The student copies its source files to an EC2 instance, closes the terminal, and announces that the website is ready. The next morning the website is unavailable. The files are still present, but the application process ended with the terminal session. This is the gap that application hosting must close: having a program and operating a service are different achievements.

Imagine a college running technical workshops. The publication team needs announcements, photographs and schedules. A registration team needs a custom form, capacity rules and a list of accepted students. WordPress can provide the editorial website. A Flask or Express application can implement the registration workflow. The college might use one of these choices or combine services, depending on its requirements. Learning all three helps you recognize responsibilities; it does not mean every small website should operate three application stacks.

By the end of this chapter, you should be able to describe the files, processes, connections and stored data that make an application work. You should also be able to explain how another administrator could reproduce its environment, identify its running release, update it and recover it. Those explanations matter before selecting a large instance or adding more servers. An expensive machine cannot compensate for missing configuration, an incompatible package or a database that was never backed up.

Think of a deployed application as a set of agreements. The code expects a particular runtime and configuration. The web server expects an upstream listener or a PHP handler. The process expects permission to read code and access required data. Users expect their saved work to remain after an update. A release is successful when these agreements still hold and the intended user operation works. Merely transferring an archive establishes only that some bytes reached a destination.

The exercises below use fictional workshop data and a local listener. They teach release behavior without changing a public website. The later individual lessons develop each application stack further. Read this overview first so that installation commands have a purpose: each command should satisfy a named requirement, and each verification should establish something specific about the resulting service.

2. Choose between a CMS and an application framework

WordPress is a content management system, or CMS. It already provides an administration interface, user roles, content editing, themes and an extension system. A teacher can publish a workshop announcement without writing the entire publishing application. Hosting WordPress therefore includes operating an existing product and maintaining the extensions selected for it. A theme affects presentation; a plugin adds or changes behavior. Both execute code within the installation and deserve deliberate selection and maintenance.

Flask is a Python web framework. It supplies building blocks for request handling, routing, responses and integration with other Python components. It does not automatically provide the college's registration rules or administration workflow. A developer writes those parts. Express serves a similar framework role in the Node.js ecosystem, where JavaScript code handles requests using routes and middleware. Choosing a framework gives flexibility, together with responsibility for application design, validation, authorization and testing.

Consider two requirements. For an announcement saying that a workshop begins at ten o'clock, WordPress's editorial tools may already match the need. For a registration rule that reserves seats by laboratory capacity and checks a prerequisite course, a custom application may be appropriate. The correct decision depends on existing product capabilities, the team's skills and maintenance constraints. Custom code is not inherently more professional, and a CMS is not inherently unsuitable for important work.

Three application choices and the responsibilities behind them
ChoiceUseful starting pointWork that still belongs to the operator
WordPressEditorial workflows, themes and pluginsCompatible PHP and database, permissions, updates, upload protection and recoverable content
FlaskPython routes and response handlingApplication rules, dependencies, a production serving arrangement, supervision and persistence
ExpressNode.js routes and middlewareApplication rules, dependency installation, process management, error handling and persistence

A framework's name does not tell you where records are stored. Flask and Express applications can use different databases or external services. WordPress typically stores posts and configuration in its database while uploaded media is stored as files or through a configured external storage integration. During planning, draw the actual application you intend to operate. Do not invent a database merely because a familiar diagram includes one, and do not forget a real dependency because it is hidden behind a plugin.

A useful project inventory has an owner for each part. The editor owns published announcements. The developer owns registration rules. The administrator owns the serving arrangement and recovery procedure. These roles can belong to the same person in a student project, but separating the responsibilities makes omissions easier to see. If nobody can explain how uploaded posters are recovered, the application has an operational gap even when every page currently loads.

3. Reproduce the runtime and dependencies

A source file is an instruction sheet, not the whole execution environment. Python code needs a compatible Python interpreter and its imported packages. JavaScript server code needs a compatible Node.js runtime and installed dependencies. WordPress needs a supported PHP environment, required extensions and a compatible database. Operating-system libraries may also matter. Copying a developer's folder without identifying these requirements often produces an application that works on one machine and fails on another.

Write down the runtime version, application release, direct dependencies and resolved dependency versions. Direct dependencies are packages the project explicitly asks for. Transitive dependencies are packages required by those packages. Installing only the same top-level package names can produce a different environment later because the dependency resolver may select newer compatible versions. A controlled release records the resolved set and tests that set, while a separate maintenance process evaluates updates.

For Python, a virtual environment provides a separate package installation location for a project. It reduces accidental dependence on system-wide packages. It is not a security sandbox, a virtual machine or a copy of the operating system. The process still runs with its operating-system permissions and can access resources allowed to that identity. Use the virtual environment's interpreter explicitly in service commands so that an interactive shell's activation state is not required for correct startup.

Version pins improve repeatability, and complete dependency pins are stronger than pinning only the application framework. Package hashes and retained installation artifacts can strengthen integrity and availability further. Even a complete Python package list does not record the entire operating system or every native library. Rebuild in a fresh environment and run meaningful checks before claiming that a release is reproducible. Keep security maintenance active; a frozen vulnerable version does not become safe through repeatability.

Node projects commonly include a package manifest and a lockfile. The manifest describes dependencies and scripts; the lockfile records a resolved dependency tree. The npm clean-install command requires an appropriate lockfile and rejects a mismatch with the manifest instead of silently rewriting the lock. It also replaces an existing dependency directory. Run it in the intended release directory, not casually inside a working production release. Review installation scripts and use a controlled build identity because installing dependencies can execute package-provided code.

For WordPress, check the current official requirements and each selected extension's compatibility before planning an upgrade. At this chapter's review, WordPress recommends PHP 8.3 or newer, MariaDB 10.11 or newer or MySQL 8.4 or newer, and HTTPS. These are current recommendations, not a promise that every plugin supports every newer version. Validate the combined stack in staging, including the editing and upload workflows that students and teachers actually use. Check the official requirements.

Record failures precisely. An import error suggests that the selected interpreter cannot import a required module, but the package may be installed under a different interpreter. A database connection error can arise after the runtime starts correctly. A syntax error in application code differs from a web-server configuration error. Identify which component reported the failure and inspect its effective command, working directory and environment before reinstalling unrelated software.

4. Separate configuration, secrets and persistent data

Configuration supplies choices that can change between environments: a listening address, database endpoint, public base URL, logging level or data directory. A secret is a configuration value that grants access or must remain confidential, such as a database password, signing key or API credential. Both need deliberate handling, but they have different exposure consequences. A harmless release label can appear in a diagnostic response; a database password cannot.

Keep secrets out of public document roots, source repositories, screenshots and support logs. Environment variables are one possible delivery mechanism, not a guarantee of secrecy. The processes and administrators permitted to inspect an environment may be able to read them. A protected file or a managed secret service can be appropriate depending on the platform. Whichever mechanism you choose, define who reads the value, how it is supplied at startup and how rotation reaches the running application.

Do not make a production configuration file readable by everyone just to remove an access error. Trace the effective service identity and the specific path it needs. Reading a secret requires read permission; modifying a secret requires a different privilege that the web process usually does not need. On Linux, ordinary permission bits may coexist with SELinux or other controls. A successful permission change at one layer does not prove that the whole access path is correctly designed.

Application code, uploads and database records have different lifetimes. A release directory can be replaced when code changes. A student's registration must survive that replacement. A workshop poster uploaded after the last release also needs to survive. Place persistent data in an explicitly planned location and identify it in backups. A folder named shared is merely a convention; it becomes useful only when the application actually reads and writes the intended storage.

For a simple single-machine application, a dedicated data directory and a database can provide clear boundaries. With multiple application machines, an ordinary local upload directory on one machine is not automatically visible on another. You need an appropriate shared storage or object-storage design and consistent access rules. The same issue applies to sessions stored only in a process's memory. Adding workers or machines exposes assumptions that were invisible during a one-process demonstration.

Separate generated cache from authoritative data. A cache may be reconstructed from another source; the only copy of a student's registration cannot. Temporary files may still contain sensitive information and need access and cleanup controls. Classifying these files helps decide backup frequency, retention and recovery order. Do not place everything into one category simply because it sits below the same parent directory today.

5. Give each process a clear identity and supervisor

A process is a running instance of a program. Its executable, arguments, working directory, environment and identity affect its behavior. Starting an application manually is useful during development because you can see its output directly. A maintained service needs a defined startup procedure that another administrator can inspect. A command hidden in someone's terminal history is not a reliable operating procedure.

Use a dedicated service identity with only the access needed for the application. For example, the registration service can read its release files and access its data store without being allowed to modify unrelated websites. The deployment identity may need permission to create a new release; that does not imply that the request-handling process should also have that permission. Separating these capabilities limits the effects of an application defect or compromised component.

A supervisor can start processes, observe their exit and restart them according to policy. On many Linux servers, systemd provides service management. Gunicorn manages its application workers, while a service manager can supervise the Gunicorn master process. PM2 can manage Node.js applications and has a separate startup integration for restoring selected processes after boot. Saving a process list and arranging startup are distinct steps; neither should be assumed from a successful first launch.

Restart policies need limits and visibility. Repeatedly restarting an application with a missing dependency does not repair the dependency. It can produce a fast failure loop and a large volume of logs. Record the exit reason and distinguish a process that briefly starts from a service that remains ready. An orderly shutdown also matters: the application may need to stop accepting new work and finish or safely abandon ongoing operations before its deadline.

Worker count is a capacity decision, not a magic performance setting. Additional workers consume memory and may create more database connections. A workload waiting on external I/O differs from one performing expensive computation. Measure response latency, throughput, errors, CPU, memory and dependency limits under representative load. Do not copy a worker formula without checking the chosen worker type, machine size and application behavior.

Supervision and availability are related but different. A supervisor can restart a failed process on one machine. It cannot make that machine available during a host failure. A single-instance restart may cause an interruption. Multiple healthy instances, traffic management and a suitable persistence design can support a more resilient arrangement, but they add responsibilities. Describe the failure your design handles instead of claiming that any process manager guarantees continuous availability.

6. Follow the public request to the application

A visitor requests the college's named HTTPS endpoint. Name resolution supplies destination information, the client connects, and TLS protects the connection after the required negotiation and certificate checks. The receiving web server or load balancer then routes the HTTP request. An application process can listen on a local address or a private network address behind that entry point. Each connection has its own listener, routing and access requirements.

With a common Flask arrangement, Nginx receives the visitor's request and forwards an HTTP request to Gunicorn. Gunicorn invokes the Flask application through its Python serving interface and returns the result. With Express, the upstream is commonly a Node.js HTTP server running the application. WordPress with PHP-FPM follows a different handler path: the web server communicates with PHP-FPM using FastCGI. Copying an HTTP proxy directive into a FastCGI configuration does not make the protocols interchangeable.

Correct upstream routing requires the expected address, port or socket and request mapping. A socket permission error differs from a missing process. An application route that returns a deliberate not-found response differs from a proxy that cannot connect upstream. Record both the status and the component that produced it. Correlating the web-server access log with the application log often provides more useful evidence than repeatedly refreshing the home page.

Proxy headers need a trust policy. An application may need to know the original client address or whether the external request used HTTPS. A trusted proxy can supply that information, but a direct untrusted client can also send header names. Configure the application to trust only the intended proxy path. An overly broad trust setting can affect generated redirects, security decisions or request logs. The Flask and Express proxy guides explain their respective mechanisms; their settings are not identical.

TLS termination at a proxy describes one connection boundary. If the proxy sends traffic to another machine, assess the protection and trust of that upstream connection separately. Likewise, HTTPS does not validate business rules or prevent an authenticated user from accessing someone else's record. Transport protection, authentication, authorization and input handling solve different problems. A complete hosting review checks their interaction without treating any single feature as a universal security solution.

For WordPress, verify site URLs, login behavior, static assets and upload delivery through the real named endpoint. For a registration application, verify the form and a test submission with synthetic data. Check the response and the stored result. A page can look correct while its form submits to an old host or wrong path. Testing the visible beginning of a workflow is useful, but the successful final operation is the evidence that students need.

7. Define checks that establish useful facts

A process check answers whether a particular process exists or remains running. A listener check answers whether something is accepting connections at an address. A simple health endpoint might demonstrate that the application can receive a request and generate a small response. A readiness endpoint can check selected dependencies required for useful service. These names are conventions; their actual implementation determines what they prove.

For the workshop roster, a health endpoint can return a release marker without reading the roster. A readiness endpoint can attempt to read and parse the required data. If the file disappears, the first endpoint can still return success while the second fails. Neither is contradictory. They answer different questions. Write this meaning into the operating notes so that an alert based on one probe is not mistaken for evidence about every user operation.

A readiness check should be bounded and appropriate. A check that hangs indefinitely waiting for an unavailable database becomes another resource problem. A check that writes a real registration on every load-balancer probe can fill the database with unwanted records. Prefer lightweight non-destructive checks for routine routing decisions, and use controlled synthetic workflows separately when deeper evidence is needed. Protect any diagnostic details that reveal sensitive configuration.

Release markers make investigations clearer. A response can identify a harmless application version, while detailed internal paths and credentials remain private. During a rollout, compare markers from the intended routes and instances. If a browser still shows an old page, determine whether a cache, a different target or the application itself supplied it. An unchanged screenshot alone cannot establish which version executed the request.

Monitoring continues after release. Watch errors, response times, restarts, resource consumption and the business operation that matters, such as accepted registrations. Establish an expected baseline and a response procedure. Logs should include enough context to correlate a failure while avoiding unnecessary personal information. Useful observability helps you explain what happened; collecting every possible value without a question can create noise and expose data unnecessarily.

8. Lab: switch application versions while preserving shared data

This lab runs Flask through Gunicorn on a loopback address. It uses two release directories and one shared JSON roster containing fictional student names. The file is read-only to the application in this exercise. It is a deliberately small way to observe release selection, readiness and persistence; it is not a multi-user registration database. The previous chapter covers transactional storage. Here, the important observation is that changing code does not require replacing the shared data.

Use a Linux machine, WSL environment or macOS machine with Bash, curl and a compatible Python installed. Gunicorn is intended for Unix-like environments; do not assume the same command runs in native Windows. The tested package pair below is Flask 3.1.3 and Gunicorn 27.0.1, with Python 3.12. The Gunicorn release requires Python 3.10 or newer. Check your interpreter before proceeding. The fixed package versions record this exercise's tested starting point rather than a promise that they should remain pinned forever.

Keep the exercise in a fresh terminal and use an unused local port, here 18891. If that port is occupied, select another unused port and change every corresponding command. Do not stop an unknown process to free the port. No command in this exercise needs administrator privileges, a security-group change, a public DNS record or a system web-server reload. Package installation happens inside the temporary exercise's virtual environment.

Create the release and data directories

Run the following block in terminal A. The temporary-directory command creates a unique location. Quoted variables preserve the path as one argument. The printed directory is the value you will use if you need to inspect the files from another terminal. If creation or dependency installation fails, stop and resolve that error before continuing; later startup failures would otherwise hide the original problem.

release_lab=$(mktemp -d /tmp/workshop-release.XXXXXX) || exit 1
export release_lab
mkdir -p "$release_lab/releases/v1" "$release_lab/releases/v2" "$release_lab/shared"
python3.12 -m venv "$release_lab/venv"
"$release_lab/venv/bin/python" -m pip install Flask==3.1.3 gunicorn==27.0.1
"$release_lab/venv/bin/python" -m pip freeze > "$release_lab/resolved-packages.txt"
printf '{"students":["Asha Demo","Imran Demo"]}\n' > "$release_lab/shared/roster.json"
export WORKSHOP_DATA="$release_lab/shared/roster.json"
printf 'Release lab directory: %s\n' "$release_lab"

The runtime environment belongs to this exercise, and the resolved package list records what the installer selected. The two release directories contain code. The shared directory contains data. This arrangement deliberately uses one runtime environment for two versions of the same tiny program. A real release with different dependencies should have its own tested environment or equivalent isolated build artifact; otherwise changing a shared dependency could affect both the new and old code.

Create the first application release

The application obtains its data path from configuration. Its release marker belongs to code. The health route does not read data, while the readiness route validates the roster's basic structure. The root route returns the actual roster. Missing or invalid data produces a controlled unavailable response, rather than leaking the filesystem path or an exception traceback to a visitor. This is a narrow teaching example, not a complete production error-handling policy.

cat > "$release_lab/releases/v1/app.py" <<'PY'
import json
import os
from pathlib import Path
from flask import Flask, jsonify

app = Flask(__name__)
RELEASE = 'workshop-v1'
DATA_FILE = Path(os.environ['WORKSHOP_DATA'])

def read_roster():
    data = json.loads(DATA_FILE.read_text())
    if not isinstance(data, dict) or not isinstance(data.get('students'), list):
        raise ValueError('invalid roster shape')
    if not all(isinstance(name, str) for name in data['students']):
        raise ValueError('invalid roster name')
    return data

@app.get('/health')
def health():
    return jsonify(status='alive', release=RELEASE)

@app.get('/ready')
def ready():
    try:
        read_roster()
    except (OSError, ValueError):
        return jsonify(status='not-ready', release=RELEASE), 503
    return jsonify(status='ready', release=RELEASE)

@app.get('/')
def roster():
    try:
        data = read_roster()
    except (OSError, ValueError):
        return jsonify(error='roster unavailable', release=RELEASE), 503
    return jsonify(release=RELEASE, students=data['students'])
PY

Observe the distinction between import time and request time. The data-path environment variable must exist when Gunicorn imports the application. The file itself is read during the relevant requests. Therefore an absent environment variable prevents startup, whereas an absent data file allows the health route to respond but makes readiness fail. These two failures lead to different observations and should lead to different diagnostic checks.

Prepare version two without overwriting version one

"$release_lab/venv/bin/python" - <<'PY'
import os
from pathlib import Path
base = Path(os.environ['release_lab'])
source = (base / 'releases/v1/app.py').read_text()
assert source.count("RELEASE = 'workshop-v1'") == 1
(base / 'releases/v2/app.py').write_text(
    source.replace("RELEASE = 'workshop-v1'", "RELEASE = 'workshop-v2'"))
PY

The replacement is deliberately exact and checked once. Version two changes only its marker, making the expected result easy to predict. The old file stays available for recovery, and neither operation writes the shared roster. For a real application, examine a reviewed code difference and run its tests. A changed marker proves version selection; it does not prove that an arbitrary functional change is correct.

Run version one and inspect it from another terminal

"$release_lab/venv/bin/python" -m gunicorn --chdir "$release_lab/releases/v1" --bind 127.0.0.1:18891 --workers 1 --access-logfile - app:app

This command remains in the foreground in terminal A. The explicit working directory selects the release. The final module-and-object expression selects the Flask application object within its source module. One worker makes the demonstration easy to follow. The local binding confines this listener to the machine's loopback interface; it does not create a public endpoint. Keep the process visible so its startup and request messages can be inspected.

curl -i http://127.0.0.1:18891/health
curl -i http://127.0.0.1:18891/ready
curl -i http://127.0.0.1:18891/

Run those three requests in terminal B. Expect successful HTTP responses, the version-one marker, a ready result and both fictional names. Read the bodies, not just the status. A wrong application using the same port could also return success. Compare its marker and roster with your predicted output. If a request fails, inspect terminal A before changing a firewall; loopback failure often has a much closer cause.

Switch to version two, then return to version one

Stop the foreground process with Control-C in terminal A and wait for its shutdown messages and shell prompt. This exercise intentionally has an interruption between versions. It does not demonstrate a zero-downtime rollout. Start the second release with the next command, then run the same three requests from terminal B.

"$release_lab/venv/bin/python" -m gunicorn --chdir "$release_lab/releases/v2" --bind 127.0.0.1:18891 --workers 1 --access-logfile - app:app

The marker should become version two while both names remain. Stop that process and run the earlier version-one startup command again. The marker should return to version one, and the same names should still appear. This is a code rollback demonstration. No backup was restored because the shared data did not need to change. Write down these three observations before moving to the failure exercise.

Make data unavailable and compare the probes

Stop the process again in terminal A. Move the fixture roster aside with the following command, restart version one using its earlier command, and repeat the three requests from terminal B. Moving this synthetic file creates a reversible failure inside the exercise directory. Never use a real application's data file for this experiment.

mv "$release_lab/shared/roster.json" "$release_lab/shared/roster.saved.json"

The health route should still succeed. Readiness and the roster route should return service-unavailable responses. The running worker is alive but cannot perform its intended data operation. Stop the process, restore the fixture file with the next command, start version one and repeat the requests. All three should succeed again. That recovery changes data availability, not the application release.

mv "$release_lab/shared/roster.saved.json" "$release_lab/shared/roster.json"

Finish by stopping the foreground process. Confirm that requests no longer reach this exercise's listener and review the exact temporary path printed at the start. You may remove that exercise directory after saving your observations; keep cleanup limited to that unique directory. Do not remove a parent directory or use a wildcard. The evidence to retain is the selected release, status and roster at each stage, together with the resolved package list.

9. Plan releases, rollback and restore separately

A release procedure begins with a known working state. Record the currently selected code, runtime, configuration and data locations. Prepare the candidate in a separate location, install its tested dependencies and check required configuration without exposing secret values. Run application tests and representative workflows in staging. Only then select the candidate for the intended traffic path. Keep the prior release available until the new behavior and recovery window are understood.

Define the acceptance checks before changing anything. For the college website, those might include viewing an announcement, logging in as a test editor, uploading a synthetic poster and submitting a test registration. Include a rejected input and an unknown route so that error behavior is also checked. A deployment log saying completed reports the automation's outcome; the observed application behavior determines whether the service meets its acceptance criteria.

Code rollback selects an earlier code release. Database restore recovers stored data from a backup or another recovery source. They are not interchangeable. Suppose version two adds a database column but leaves old columns available. Version one might remain compatible, depending on its queries and assumptions. If version two removes a column version one requires, selecting old code can fail. Examine migration compatibility before promising an easy rollback.

A common migration approach separates expansion from removal. Add a compatible structure, deploy code that can work during the transition, move or backfill data with checks, and remove obsolete structures only after the compatibility window closes. The exact method depends on the database and application. Large tables, constraints and locking need specific planning. The principle is to avoid making old and new application versions disagree about a shared data structure during a rollout.

Restoring an old database can discard valid registrations received after the backup. Before recovery, preserve the current state where feasible and identify the affected time range, required recovery point and reconciliation work. Do not restore merely because a deployment failed if selecting compatible old code would solve the problem without replacing data. Recovery should address the actual failed component and preserve legitimate later work where possible.

A WordPress recovery plan normally needs both database content and files, including uploads and required configuration. Keep backups outside the publicly served directory with appropriate access restrictions. Verify restoration in a separate environment and test links, media, login and editing. A successful archive command proves archive creation; a successful restore exercise proves much more. Record how long recovery takes and which recent changes would be missing at the chosen recovery point.

Updates remain necessary after a successful launch. Review WordPress core, themes and plugins; Python and Node dependencies; runtime support; and operating-system updates. Staging reduces surprises but cannot eliminate every production difference. Monitor after release, retain the evidence that identifies the selected version and make the recovery procedure accessible to the responsible operator. A maintainable service includes its next update, not only its first installation.

10. Practical tasks with clear completion evidence

  1. Draw your application's inventory. Choose either the publication site or registration service. List code, runtime, packages, configuration, secrets, uploads, database and temporary files where applicable. For each item, name its location, owner and recovery source. Mark anything unknown instead of filling the diagram with assumptions. Completion means another student can explain where a newly created record would live and how an ordinary code update avoids replacing it.
  2. Compare two release observations. Repeat the local version switch and write a table containing the requested path, status, release marker and roster. Include the rollback and missing-file stages. Completion means your report distinguishes a successful process response from usable data and demonstrates that the restored release still reads the same names.
  3. Review a proposed update. Imagine that a new registration release needs a different Python dependency and a database column. Describe the candidate environment, compatibility test, acceptance checks and recovery choice. Completion means you explain whether old code can still use the resulting schema. Saying keep a backup is insufficient unless you also identify what is backed up and when restoration would be appropriate.
  4. Prepare a recovery rehearsal. For a fictional WordPress site, identify a matching database backup, file backup and configuration record. Describe restoring them into an isolated environment, disabling real outbound notifications and testing synthetic editor actions. This is a planning task, not an instruction to restore a production database. Completion means your proposed evidence covers both content and uploaded media.

11. Interview questions with explained answers

Is WordPress equivalent to Flask or Express?

No. WordPress is a CMS product with existing editorial and administration capabilities. Flask and Express are frameworks used to build application behavior. All need a maintained hosting environment, but the developer's responsibility differs. In an interview, connect the choice to a requirement: an editorial team may benefit from an existing CMS, while unusual registration rules may require custom application work.

The application works over SSH but disappears after logout. What would you inspect?

Inspect how it was started and whether an appropriate supervisor owns its lifecycle. A process attached to an interactive session may not survive session termination. Establish a service command with the correct interpreter, directory, environment and identity. Then verify start, stop, failure handling and the intended boot behavior. Keeping a terminal open hides the lifecycle problem rather than defining a maintained service.

Why can health succeed while readiness fails?

The checks can cover different dependencies. In this lab, health creates a response without reading the roster, while readiness validates the required file. When the file is unavailable, the process still responds but cannot serve its useful data. Explain the implemented check rather than relying on the endpoint's name. A health endpoint that includes a dependency test would have a different meaning.

Does selecting the previous code release undo a database migration?

No. Selecting code changes which program handles requests. It does not automatically reverse schema or record changes made in a separate database. Determine whether the old code remains compatible. A database restore is a separate recovery operation with possible loss of newer valid data. A credible answer describes compatibility planning and the evidence needed to choose recovery safely.

Can a web server forward the same protocol to PHP-FPM and Gunicorn?

In the arrangements discussed here, PHP-FPM receives FastCGI requests, whereas the reverse proxy sends HTTP to Gunicorn. Both ultimately help produce web responses, but their interfaces differ. Select the handler directive, socket or port and request parameters appropriate to that upstream. A matching port number alone cannot make incompatible protocols communicate correctly.

Why is a Python virtual environment useful but insufficient for isolation?

It separates the project's Python package installation from other Python environments. It does not restrict the operating-system user's filesystem or network permissions. Use it for dependency organization and combine it with appropriate process identity and platform controls. Also record the runtime and relevant system dependencies, because a package list alone cannot describe every part of the execution environment.

12. Check your understanding

Quiz 1: Version two displays its new marker and an empty roster. Is the release verified?

No. The marker establishes that the selected code changed, but the missing roster violates the expected data result. Check the configured data path, storage mount and access before accepting the release. A successful HTTP status does not compensate for incorrect content.

Quiz 2: A package is installed somewhere on the server. Must the service be able to import it?

No. The service may use a different interpreter or virtual environment. Inspect its explicit executable and environment. Install the reviewed dependencies into the intended release environment and test with the same interpreter used by the service.

Quiz 3: Does starting PM2 once automatically prove recovery after a server reboot?

No. Current process management and boot integration are separate concerns. Review the startup configuration and saved process list for the intended identity, then verify the intended lifecycle in an appropriate test environment. A current process listing only describes the current state.

Quiz 4: Can a file-only WordPress backup fully recover posts stored in its database?

Normally it cannot. The database and application files are separate recovery components. A database export can be stored as a file in the backup set, but it must actually exist and be restorable. Verify both data and files instead of assuming one directory contains the entire service.

Quiz 5: The reverse proxy supplies forwarding headers. Should the application trust every client-supplied forwarding header?

No. Trust must match the actual proxy arrangement and its header handling. An untrusted client can send those header names too. An unrestricted trust setting can make incorrect client or protocol information appear authoritative to the application.

13. Revision cards

Release

A reviewed code and dependency state selected for execution. Record a marker and the environment needed to reproduce it.

Persistent data

Information that must survive replacement of code or restart of a process. Give it an explicit storage and recovery plan.

Service identity

The operating-system account under which the process acts. Its permissions should match the application's required access.

Supervisor

A component that manages process lifecycle. Restart behavior does not by itself guarantee availability through every failure.

Readiness

A defined check of selected requirements for serving useful requests. Read its implementation to understand its limits.

Recovery

Choose the action that repairs the failed component. Code rollback, data restoration and dependency repair have different effects.

Primary sources

Technical documentation reviewed for this lesson on 22 November 2026. Package versions and requirements are review-time facts; check supported versions before a real installation.

Practice Tasks

Practice checks run in your browser. They check the answer for this exercise; they do not create resources or connect to your AWS account.

About this scenario

Dubai Gold Souk is a jewellery business in Dubai. Fatima Al Mansoori looks after its IT and cloud work. They count money in AED and run their AWS resources in the me-central-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 12

Easy Biggest orders first

Querying the database is daily work after you set up RDS.

Show order id and amount, biggest amount first.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Easy Filter customers by city

Querying the database is daily work after you set up RDS.

List the names of customers in Pune.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Easy Restart a service after a change

For this browser exercise, use the restart command. In a real service, check whether the particular change requires reload, restart or another application-specific action.

Restart the nginx service.

  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Easy Check if a service is running

When a site is down, first check whether the web server process is running.

Show the status of the httpd service.

  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Remove small orders

Querying the database is daily work after you set up RDS.

Delete orders with amount below 200.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Medium Orders with customer names

Querying the database is daily work after you set up RDS.

Show each customer name with each order amount.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Medium Total sales

Querying the database is daily work after you set up RDS.

Show the total of all order amounts as one number.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Medium Fix a city

Querying the database is daily work after you set up RDS.

Customer 5 moved to Rome. Update the record.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Medium Start a service now and at boot

Enabling installs the configured startup relationships; --now also requests an immediate start. Verify both the enabled state and the start result for the intended unit.

Enable the nginx service and start it immediately, in one command.

  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Test the nginx config

A configuration test checks syntax and referenced resources; it does not prove that every website route or application workflow behaves correctly.

Check the nginx configuration files for errors.

  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard Sales per customer

Querying the database is daily work after you set up RDS.

Show customer_id and total amount per customer, only where total is above 1000.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.

Hard Customers with no orders

Querying the database is daily work after you set up RDS.

List names of customers who have never ordered.

Tables: customers(id, name, city) and orders(id, customer_id, amount, odate).

  1. Find the table the task is about (see the table list above the box).
  2. Write the SQL statement step by step: what, from where, which rows.
  3. End the statement with ;
  4. Click Check answer. Your query runs on a practice copy of the table.