Wasmer Edge runs the same Node.js server as Docker. The test app for this repository is mockhttp.wasmer.app.
This deploy does not publish the Cloudflare Worker. mockhttp.org stays on Cloudflare.
Table of Contents
- App configuration
- Build with Anybuild
- Deploy from the CLI
- Deploy from GitHub Actions
- Runtime behavior
App configuration
app.yaml describes the Edge app:
kind: wasmer.io/App.v0
name: mockhttp
owner: jaredwray
package: .
env:
HOST: "0.0.0.0"
LOGGING: "false"
AUTO_DETECT_PORT: "false"
package: . deploys the repository directory. HOST binds the server on all interfaces. Logging is off. Wasmer injects PORT. AUTO_DETECT_PORT=false keeps that port instead of scanning for another one.
Change name and owner before you deploy your own app. The environment variables are the same ones the Docker image reads (PORT, HOST, LOGGING, HTTP2, and AUTO_DETECT_PORT). See Docker for what each one does.
Build with Anybuild
Anybuild tells Wasmer how to build the package on a remote builder:
- Node.js 24 and pnpm
12.4.1 - Build command:
pnpm run build && pnpm website:build - Start command:
node dist/index.mjs
The build command produces dist/ and site/dist/ while Docula is still installed. Wasmer then prunes dev dependencies. The docs site has to exist before that prune, because Docula is a dev dependency.
Deploy from the CLI
Install the Wasmer CLI and log in, then from the repository root:
wasmer deploy --build-remote
--build-remote uploads the source and runs the Anybuild file on Wasmer's builders. When the deploy finishes, the CLI prints the app URL.
Deploy from GitHub Actions
.github/workflows/deploy-wasmer.yaml runs on the released event (a published release, not a prerelease) and when the workflow is started by hand. The wasmer environment provides WASMER_TOKEN. The deploy step runs:
wasmer deploy --non-interactive --build-remote
Runtime behavior
Bins use the default in-memory store, so a bin exists only on the instance that created it. Taps are a library API (mock.taps.inject) and have no HTTP routes, so a deployed app cannot inject one.
@fastify/rate-limit is on at 1000 requests per minute. It keys on the address that connects to the process. The server does not trust proxy headers, and the allow list is only 127.0.0.1 and ::1. On the test app, /ip reports 127.0.0.100, which is the edge proxy rather than the caller, and the response includes x-ratelimit-limit: 1000. Clients that share that proxy address share one limit on that instance. This is not the Cloudflare limiter used by mockhttp.org.
The process listens with HTTP. Wasmer terminates TLS for the *.wasmer.app hostname.