INC-2417 · P1 · On-premises · Ubuntu 24.04 · nginx · Node.js · systemd

Step-by-step fix: The MasterLinux store returns “502 Bad Gateway” in the middle of the night

A production incident replayed in a simulated terminal, with its complete resolution: the commands the on-call engineer ran, what they printed, the root cause and the fix. This is exactly the reasoning expected in a DevOps, SRE or Linux administrator job interview.

Try it yourself first in the terminal (free)

The ticket

You are on call for the MasterLinux store, the online store for its courses. Monitoring has just fired an alert: the home page has been returning 502 Bad Gateway since 03:12.

Architecture: nginx receives visitors and forwards requests to the Node.js application (systemd service boutique, port 3000). The database runs on another server and is responding normally.

Your mission: find the root cause, bring the site back online, then explain how to prevent it from happening again.

Step by step: the commands and their output

These are the commands the engineer typed, in order, with what the machine answered.

  1. root@ml-web-01:~# systemctl status nginx
    ● nginx.service - A high performance web server and a reverse proxy server
         Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
         Active: active (running) since Mon 2026-10-12 09:41:07 +01; 6 days ago
       Main PID: 1123 (nginx)
          Tasks: 3 (limit: 9387)
         Memory: 7.9M
  2. root@ml-web-01:~# systemctl status boutique
    × boutique.service - MasterLinux Boutique (Node.js)
         Loaded: loaded (/etc/systemd/system/boutique.service; enabled; preset: enabled)
         Active: failed (Result: exit-code) since Mon 2026-10-19 03:12:40 +01; 11min ago
       Main PID: 48211 (code=exited, status=1/FAILURE)
            CPU: 412ms
    
    oct. 19 03:12:40 ml-web-01 systemd[1]: boutique.service: Start request repeated too quickly.
    oct. 19 03:12:40 ml-web-01 systemd[1]: boutique.service: Failed with result 'exit-code'.
  3. root@ml-web-01:~# journalctl -u boutique -n 20
    oct. 19 03:12:38 ml-web-01 node[48211]: MasterLinux Boutique démarré sur le port 3000
    oct. 19 03:12:39 ml-web-01 node[48211]: node:internal/fs/utils:351
    oct. 19 03:12:39 ml-web-01 node[48211]:     throw err;
    oct. 19 03:12:39 ml-web-01 node[48211]: Error: ENOSPC: no space left on device, write
    oct. 19 03:12:39 ml-web-01 node[48211]:     at Object.writeSync (node:fs:939:3)
    oct. 19 03:12:39 ml-web-01 node[48211]:     at Logger.ecrire (/srv/boutique/lib/journal.js:42:8)
    oct. 19 03:12:40 ml-web-01 systemd[1]: boutique.service: Main process exited, code=exited, status=1/FAILURE
  4. root@ml-web-01:~# df -h
    Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
    /dev/sda1           30G     11G   18G  38% /
    /dev/sdb1           40G     40G     0 100% /var
    tmpfs              3,9G       0  3,9G   0% /dev/shm
  5. root@ml-web-01:~# du -sh /var/log/*
    38G	/var/log/boutique
    1,2G	/var/log/journal
    412M	/var/log/nginx
    18M	/var/log/apt
  6. root@ml-web-01:~# truncate -s 0 /var/log/boutique/debug.log
  7. root@ml-web-01:~# systemctl restart boutique

What the commands revealed

Root cause

The “debug” log level filled up /var: the application can no longer write and shuts down

nginx was healthy: it was only reporting that nothing was listening on port 3000. The boutique service was crashing at startup with ENOSPC, because /var was full. The culprit: LOG_LEVEL=debug left on in production, which produced a 38 GB file.

Analysis and fix

Immediate fix: empty the log (truncate -s 0 /var/log/boutique/debug.log), then restart the service and check with curl.

To keep it from happening again:

  • set LOG_LEVEL=info back in production;
  • add a logrotate rule for /var/log/boutique/*.log (daily rotation, compression, 7 days);
  • monitor disk space (alert at 80%);
  • write a short post-mortem: timeline, cause, actions.

In a job interview

This kind of outage often comes up in technical interviews ("the site returns an error, what do you do?"). What is assessed: start from the symptoms, check each layer with the right command, prove the cause before fixing it, then prevent it from happening again. MasterLinux trains you on 195 incidents like this one, from beginner to expert.

Try it yourself first in the terminal (free)

Unlock every production simulation

AWS, Azure, Google Cloud, on-premise and multi-cloud, from Beginner to Extreme: the real incidents of IT service companies and large IT organisations, available for a year.

Other free walkthroughs