Skip to content

fix(demo): use curl instead of PHP file_get_contents for PrestaShop healthcheck - #1393

Merged
piotrswierzy merged 1 commit into
mainfrom
1392-prestashop-healthcheck-curl
Jul 7, 2026
Merged

fix(demo): use curl instead of PHP file_get_contents for PrestaShop healthcheck#1393
piotrswierzy merged 1 commit into
mainfrom
1392-prestashop-healthcheck-curl

Conversation

@norbert-kulus-blockydevs

Copy link
Copy Markdown
Collaborator

Summary

  • The prestashop service healthcheck reported unhealthy even when Apache/PrestaShop was serving fine, because PS_DOMAIN redirects / to the host-mapped port (localhost:8080), and PHP's file_get_contents() follows that redirect by default and fails with Connection refused from inside the container.
  • Replaced with curl -fsS -o /dev/null http://localhost:80 (no -L), which accepts the 302 as proof the server is up, plus a comment explaining why -L must stay off.

Test plan

  • Confirmed root cause live on a running openlinker-prestashop container (curl -L reproduces Failed to connect to localhost port 8080, file_get_contents returns the same Connection refused)
  • Verified the new healthcheck command exits 0 against the live container
  • pnpm dev:stack:up (or docker compose up -d prestashop) reaches healthy status on a fresh container recreate

Closes #1392

…ealthcheck

PS_DOMAIN makes PrestaShop redirect "/" to the host-mapped port
(localhost:8080), which isn't reachable from inside the container.
file_get_contents() follows that redirect by default and fails with
"Connection refused", marking the container unhealthy even though
Apache/PrestaShop is serving fine. curl without -L accepts the 302 as
proof the server is up.

Closes #1392

Signed-off-by: norbert-kulus-blockydevs <norbert.kulus@blockydevs.com>

@piotrswierzy piotrswierzy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/pr-review — fix(demo): use curl for PrestaShop healthcheck

Summary

One-line healthcheck fix: PS_DOMAIN redirects / to http://localhost:8080 (the host-mapped port, unreachable from inside the container), and file_get_contents() follows that redirect and fails Connection refused — so PrestaShop was reported unhealthy while serving fine. Swaps to curl -fsS without -L, which treats the 302 as proof Apache is up. Approve.

Verified

  • Root cause + fix are correct — accepting the 302 (no -L) is exactly right for a domain-redirect situation; following it (-L or file_get_contents's default) is the bug. The comment explains why -L must stay off, which will save the next reader from "fixing" it back. ✅
  • curl is present in the PrestaShop image (author verified the new command exits 0 against the live container) — note this differs from the WooCommerce image in #1397, where curl is absent; the two healthchecks correctly use different tools for different images. ✅
  • -fsS = fail-on-HTTP-error + silent + show-errors — the right flag set for a healthcheck probe.

Verdict

Approve — minimal, correct, well-commented. The one unchecked box (fresh-recreate reaching healthy) is worth confirming on a clean dev:stack:up, but the live-container verification already proves the command semantics.

@piotrswierzy
piotrswierzy merged commit a964d8b into main Jul 7, 2026
8 checks passed
norbert-kulus-blockydevs added a commit that referenced this pull request Jul 22, 2026
…ealthcheck (#1393)

PS_DOMAIN makes PrestaShop redirect "/" to the host-mapped port
(localhost:8080), which isn't reachable from inside the container.
file_get_contents() follows that redirect by default and fails with
"Connection refused", marking the container unhealthy even though
Apache/PrestaShop is serving fine. curl without -L accepts the 302 as
proof the server is up.

Closes #1392

Signed-off-by: norbert-kulus-blockydevs <norbert.kulus@blockydevs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Infrastructure — PrestaShop docker-compose healthcheck reports unhealthy via PHP redirect-follow bug

2 participants