Skip to content

feat: add the smocker HTTP mock preset - #51

Merged
geodro merged 3 commits into
lerd-env:mainfrom
ExeQue:add-smocker
Oct 23, 2026
Merged

geodro merged 3 commits into
lerd-env:mainfrom
ExeQue:add-smocker

Conversation

@ExeQue

@ExeQue ExeQue commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Adds Smocker, an HTTP mock server for testing webhooks and other outgoing requests, as a preset.

How it runs

  • No published host ports: apps reach the mock server over the lerd network as http://lerd-smocker:8080. The admin API and UI (mocks, history, reset) are served on the service domain, so nothing is bound on the host and the preset cannot clash with whatever else runs there.
  • Domain: domain: smocker with domain_port: 8081, so the domain lands on the admin API and UI rather than the mock server. As with mosparo, lerd only adopts a preset's domain for the built-in defaults today, so it has to be set by hand with lerd service domain smocker smocker.test. The field is kept so it applies once store presets are adopted too.
  • Env: lerd env writes SMOCKER_URL=http://lerd-smocker:8080 and SMOCKER_ADMIN_URL=https://smocker.test. env_detect triggers on SMOCKER_URL.
  • Image: pinned to ghcr.io/smocker-dev/smocker:1.0.0. The listen ports are set explicitly through SMOCKER_MOCK_SERVER_LISTEN_PORT and SMOCKER_CONFIG_LISTEN_PORT.
  • Category: testing, next to stripe-mock.
  • Label: Smocker, set explicitly since some places show the label verbatim rather than capitalizing the name.
  • Logo: Smocker's grill, traced to a single-colour mark. The original is licensed CC BY 4.0 by the Smocker authors. Colour #b31729 is the grill's red.

Checks

  • test_render_schema.py, render_schema.py and readme_logos.py were run, and their output is committed.
  • schema_guard.py passes against main.
  • Tested on a lerd 1.37 dev build (WSL2), installing through lerd service preset smocker with LERD_SERVICES_BASE_URL pointed at this branch:
    • The service starts with no host ports published.
    • After lerd service domain smocker smocker.test, https://smocker.test serves the UI from the host and answers the admin API from inside a PHP container.
    • A mock posted to /mocks with a Lua dynamic_response answers on http://lerd-smocker:8080 from a PHP container with the scripted status and a 1s delay, and the call shows up in /history.

@ExeQue
ExeQue requested a review from a team as a code owner October 23, 2026 21:44
…ntainer

With no host port, the dashboard only existed once someone set the domain by hand, and setting it made lerd env point SMOCKER_URL at the domain, which serves the admin API, so an app's outgoing calls answered 405 and never reached the mock. Smocker is reached server to server, so it needs no domain: the admin UI is published for the dashboard, and both URLs stay on the container name, which works the same on every lerd.
@geodro
geodro merged commit ed6f445 into lerd-env:main Oct 23, 2026
2 checks passed
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.

2 participants