Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ temporal-server: $(ALL_SRC)
@printf $(COLOR) "Build temporal-server with CGO_ENABLED=$(CGO_ENABLED) for $(GOOS)/$(GOARCH)..."
CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_TAG_FLAG) -o temporal-server ./cmd/server

.PHONY: temporal-server-wasi
temporal-server-wasi:
GOOS=wasip1 GOARCH=wasm CGO_ENABLED=0 go build -mod=readonly -tags "$(ALL_BUILD_TAGS),sqlite3_dotlk" -o temporal-server.wasm ./cmd/server

tdbg: $(ALL_SRC)
@printf $(COLOR) "Build tdbg with CGO_ENABLED=$(CGO_ENABLED) for $(GOOS)/$(GOARCH)..."
CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_TAG_FLAG) -o tdbg ./cmd/tools/tdbg
Expand Down
19 changes: 19 additions & 0 deletions docs/development/wasi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Compiling the server for WASI

Use the Go version specified in `go.mod` to compile the server for WASI Preview 1:

```sh
make temporal-server-wasi
```

The target writes `temporal-server.wasm` in the repository root. It sets
`GOOS=wasip1`, `GOARCH=wasm`, and `CGO_ENABLED=0`, and builds with readonly modules.
It preserves the native target's build tags and adds `sqlite3_dotlk` to select
the SQLite driver's portable file locking implementation. MySQL, PostgreSQL,
SQLite, and the existing persistence and archival provider registrations remain
included. SQLite uses the ncruces driver on every platform, including FTS5 for
visibility queries.

This target verifies compilation and linking only. Running the server in a WASI
host, including networking, filesystem access, and persistence behavior, requires
separate runtime qualification.
Loading