Below is the postmortem for the web stack debugging #0 task—:
A summary of the issues I faced:
- Duration of Issue: July 1, 2024, 12:00 PM - 2:30 PM WAT.
- The Impact: The Apache web server inside the Docker container returned an empty response when querying the root of the server and not the page "Hello Holberton." It affected 75% of users who tried to access the application via the container.
- The Cause: The Apache server was not set up with any
ServerName
directive and that was why it was not serving the content intended.
Here is the timeline -
- 12:00 PM: An issue was detected when running
curl 0:8080
returned "Empty reply from server" instead of the expected "Hello Holberton" message. - 12:10AM: I ran the Docker container and connected to the root of the server and noticed the problem.
- 12:30 AM: I began examining Apache configuration inside the container. I thought there was a mistake in the configuration of the server..
- 12:50 AM: I checked the status of the Apache service and discovered that the reason for the server not running was due to a missing 'ServerName' directive.
- 1:30 AM: I added the line
ServerName localhost
to/etc/apache2.conf
, fixing its configuration. - 2:00 PM: Ran the command for Apache service restart so that the configuration could take effect.
- 2:10 PM: Testing and the result of
curl 0:8080
was "Hello Holberton". - 2:30 PM: The content is rendering the intended content “Hello Holberton”.
The Root Cause and Resolution -
Root Cause: In this case, the
ServerName
directive was missing in the Apache configuration file/etc/apache2.conf
inside a Docker container. When theServerName
directive is not present, Apache would fail to start properly for handling any incoming HTTP requests and will instead return an empty response while accessing the server.Resolution: This was fixed by simply adding
ServerName localhost
to the Apache configuration file. This directive sets the name of the server, allowing Apache to start correctly. And with the configuration updated, the Apache service was restarted, and the server could finally present the "Hello Holberton" page as expected.
The Corrective Action and Preventive Measures -
-
Configuration Review: All necessary directives, such as
ServerName
, should be included in Apache configuration files. This is especially true for isolated environments like containers.- Automation: One can automate the Apache servers configured inside Docker containers to avoid hitting the same issue once more in the future.
- Documentation: Include additional information in the internal documentation about why ServerName is necessary and how to troubleshoot common problems with Apache.
TODO List-:
- Configuration Check Addition: Create a script or process that checks for critical configuration settings like
ServerName
before starting Apache. - Update Docker Image: Change the Docker image used for this project to default to the
ServerName localhost
directive. - Doc Update: Update the documentation of team members with regard to common mistakes in Apache configurations inside containers.
Summary -
The malfunctioning of the Apache server in serving the "Hello Holberton" page was because the 'ServerName' directive was missing. It was fixed by updating Apache's configuration and restarting the service. Config management and automation will help prevent this kind of problem in the future.
Top comments (0)