Repository navigation
Conversation
`workflow-engine start --runtime-config conf/runtime.toml` builds
Temporal's server configuration from the [engine] and [database]
tables, so nobody writes Temporal's YAML. PostgreSQL maps to
postgres12, MySQL to mysql8 and SQLite to sqlite. The configuration
is passed in memory through temporal.WithConfig, so the database
password never reaches disk; it can come from the environment with
$env{NAME}, and $secret{} is refused until secure-vault support.
Unknown keys in the two tables, duplicate or invalid ports, and
database settings that cannot work fail at start, and the result is
checked with Temporal's own validation. `render-config` prints the
generated configuration with the password hidden. --config-file
still accepts a Temporal YAML used as is; exactly one is required.
The suite runner starts the engine from tests/engine/runtime-<db>.toml instead of a hand-written Temporal YAML, and for PostgreSQL and MySQL creates the databases and schemas with workflow-engine-sql first, through a new Options.Prepare hook that runs before the engine starts. CI runs smoke and full against each database, with PostgreSQL 16 and MySQL 8.4 as service containers.
make test-docker needs nothing but Docker: it runs make check and make sbom, then the smoke and full suites on SQLite, PostgreSQL 16 and MySQL 8.4, the same jobs GitHub Actions runs. The databases share a network namespace with the runner on 15432 and 13306, so the tests/engine runtime files work unchanged. Each run copies the source tree, uncommitted changes included, and starts with empty databases; Go, golangci-lint and Ballerina caches persist in volumes, and a damaged module cache is reported with the command that resets it. The image uses the platform-independent Ballerina zip on a Java 25 JRE, since there is no arm64 package, so it runs natively on Apple Silicon.
With an authorizer on, start refuses a configuration without services.internal-frontend, and a runtime.toml produced none. The generated configuration now always has it (port 7236, membership 6936), so a start from runtime.toml runs it with the default services.
koanf (with its TOML parser, the confmap provider and mapstructure) is what OpenChoreo uses and what WSO2's dependency registry approves for every scope; BurntSushi/toml is not in the registry. Unknown keys in [engine] and [database] are still rejected, now through mapstructure's metadata, and every existing test passes unchanged.
|
Important Review skippedToo many files! This PR contains 139 files, which is 39 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.
|
Dependency validation
|
Dependency validation
|
Dependency validation
|
With [database.tls] enabled, the server's certificate and host name are now verified unless enableHostVerification = false: before, an omitted setting skipped verification (InsecureSkipVerify on MySQL, sslmode=require on PostgreSQL). Half a client certificate pair, and an in-memory SQLite database with more than one connection (each private connection gets its own empty database), are refused at load. The SQLite location rule reports both and neither separately, and database.type is a typed value. The configuration tests move to one txtar fixture per case under testdata/config: the input and the whole rendered Temporal configuration, or the exact error, compared by a parallel harness (-update rewrites them).
The suite runner passes WORKFLOW_TEST_DB_PASSWORD to workflow-engine-sql as SQL_PASSWORD instead of --pw, and treats only "already exists" as success: "database does not exist" and every other failure stop the run.
In a linked worktree .git points to the repository's Git directory outside the checkout. make test-docker now mounts that directory at its host path, and the runner builds self-contained metadata in /work at the checked-out commit instead of copying the pointer. The runner's paths are configurable, so tools/internal/scripts runs it for real (linked worktree, targets, refusals) with fake make and go; tar options are portable.
tools/internal/enginetest starts the real engine binary on free ports and drives it with the Temporal CLI: a new SQLite file gets its schema on the first start, and a namespace and a waiting workflow (same run, still running) survive a restart; the restarted engine then closes the workflow. Runs in the SQLite smoke job; skips without WORKFLOW_ENGINE and the temporal CLI. The CLI, not Temporal's Go SDK, drives the engine because the SDK is not in the WSO2 registry.
Dependency validation
|
Temporal retires a pooled connection after MaxConnLifetime, and an in-memory SQLite database dies with its only connection, so the lifetime is now 0 there. [database.tls] on SQLite is refused because the plugin never reads it. The fixture harness no longer records an unexpected parse error under -update. The schema helper tolerates "already exists" only for create-database and setup-schema; its tests check both databases' arguments and that no password reaches them, and the Docker runner tests check a local edit and an unrequested database.
Dependency validation
|
Dependency validation
|
serverName and enableHostVerification were ignored with database.tls.enabled = false; they now fail like the files. An error fixture whose configuration parses now fails instead of comparing two empty errors.
Dependency validation
|
heshanpadmasiri
left a comment
There was a problem hiding this comment.
Agreed review comments from the incremental PR #7 review. Five outstanding items are posted inline below; the missing-test concern is labeled separately as a HUMAN FLAG.
R3 — addressed in the current head: The original P1 concern was that the no-auth Compose try-out published port 7233 on all host interfaces. distribution/docker/compose.yml now explicitly binds 127.0.0.1:${WORKFLOW_RUNTIME_PORT:-7233}:7233, which addresses the agreed correction. No further change requested for that item.
Validation on the reviewed snapshot: launcher unit/race tests passed; Compose configuration confirmed the original exposure; a standalone reproduction using the pinned Zap version confirmed the invalid-log-sink failure. Full runtime-config tests were download-blocked; actual container and native Windows execution were unavailable. No implementation fixes were made as part of this review.
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| //go:build !windows |
There was a problem hiding this comment.
R1 [P3] Use an accurate Unix build constraint.
!windows is broader than Unix: it also selects js/wasm and wasip1/wasm, where syscall.Exec is unavailable. I confirmed GOOS=js GOARCH=wasm go build ./engine/internal/launcher fails at the call with undefined: syscall.Exec. The _unix.go filename does not itself impose an OS constraint; Go supplies a built-in unix build tag.
Prefer //go:build unix, or an explicit list of the supported Unix operating systems. This is platform-boundary hygiene, not a failure on the currently released Linux/macOS/Windows targets, and does not request WebAssembly support. A non-Unix/non-Windows implementation is needed only if those targets are intentionally supported.
There was a problem hiding this comment.
Fixed in 98aff7f. exec_unix.go is now //go:build unix; the Windows file was already //go:build windows. GOOS=js GOARCH=wasm go build now stops with a plain undefined: execEngine instead of reaching syscall.Exec. No WebAssembly support was added.
| ` | ||
|
|
||
| // launch replaces or runs the engine; tests swap it. | ||
| var launch = execEngine |
There was a problem hiding this comment.
R2 [P2] Inject the engine executor instead of mutating a package global.
run already accepts its executable lookup, environment lookup and output writers as dependencies, but tests must save, replace and restore the shared launch variable. This creates unnecessary shared mutable test configuration and conflicts with AGENTS.md's explicit requirement to inject test replacements through parameters or fields rather than globals.
Pass the executor into the existing run function: Main supplies execEngine, and each test supplies its own fake. No additional exported API or abstraction is necessary. The separate process-wide os.Chdir side effect would still require serial tests.
There was a problem hiding this comment.
Fixed in 98aff7f. run takes the executor as a parameter: Main passes execEngine, each test passes its own fake, and the package variable launch is gone. The tests still use t.Chdir and run serially because of the process-wide os.Chdir.
| // logConfig writes to standard output, or only to logFile when it is set. | ||
| func (e engineSettings) logConfig() log.Config { | ||
| if e.LogFile != "" { | ||
| return log.Config{Level: e.LogLevel, OutputFile: e.LogFile} |
There was a problem hiding this comment.
R4 [P2] Return a contextual error when the log sink cannot be opened.
This unchecked path reaches cli.start -> log.BuildZapLogger. In pinned Temporal v1.32.1, common/log/zap_logger.go:297 discards the error from config.Build(), returning a nil *zap.Logger when the directory is missing or the file is unwritable. NewZapLogger wraps it, and the first log dereferences it. A standalone reproduction with pinned Zap v1.27.1 and logs/engine.log without the logs directory produced the open-sink error followed by a nil-pointer panic. An existing directory unwritable by the non-root service/container has the same issue.
Handle log construction/open failures in our CLI and return an error naming engine.logFile, without patching Temporal. Add missing-directory/unwritable-sink tests; checking only the generated configuration fields cannot detect this failure.
There was a problem hiding this comment.
Fixed in a591008. Before calling Temporal's BuildZapLogger, the CLI creates a missing log directory and opens the file. If it cannot, the error names the key, e.g. engine.logFile logs/engine.log: ... (or log.outputFile for a Temporal YAML file), and a nil logger from Temporal is also turned into an error. Tests: TestStartCreatesTheLogDirectory, and TestStartNamesALogFileItCannotOpen (a parent that is a file, and an unwritable directory, which is skipped as root or on Windows). The reference, the feature page, the monitor page, the sample runtime.toml and a new troubleshoot row describe this.
| [ballerina.workflow] | ||
| mode = "SELF_HOSTED" | ||
| url = "workflow-runtime.example.com:7233" | ||
| namespace = "default" |
There was a problem hiding this comment.
R5 [P2] Bootstrap the namespace before the zip quick-start connects to it.
On a fresh installation the launcher delegates to cli.start, and schema preparation creates SQL databases/tables, not the default Temporal namespace. Following this shipped quick-start therefore reaches an integration configured for a namespace that does not exist. The existing integration guide and suite runner explicitly create the namespace and WorkflowKind; the container guide also includes those steps.
Add the corresponding Temporal CLI bootstrap commands before this example, including TLS/admin-token options for this production setup, or link to complete bootstrap instructions.
There was a problem hiding this comment.
Fixed in a591008. The zip README gets step 5: create default and the WorkflowKind search attribute with the Temporal CLI, using --address, --tls-ca-path and an admin --api-key. This matches connect-an-integration.md. install.md has the same step and links to that section.
| var got launched | ||
| saved := launch | ||
| t.Cleanup(func() { launch = saved }) | ||
| launch = func(engine string, a []string) (int, error) { |
There was a problem hiding this comment.
R6 — HUMAN FLAG [P2]: Native process handoff has no regression test.
These launcher tests replace launch, so they do not execute either platform's execEngine or verify the actual launcher/engine boundary. On the reviewed snapshot the suite passed with race detection and 86.8% statement coverage, while exec_unix.go:execEngine had 0% function coverage. Breaking native argument/environment/stdin forwarding, Unix signal/exit propagation, or Windows child exit handling could leave these tests green.
Add subprocess tests with a small executable fake engine, and run Windows handoff cases on Windows. This is a missing-test scenario for human review, not a claim that the current handoff is broken.
There was a problem hiding this comment.
Added in 98aff7f. Copies of the test binary act as bin/workflow-runtime (running the real Main and execEngine) and as a fake bin/workflow-engine. TestLauncherHandsOverToTheEngineProcess checks that arguments, environment, stdin, the home directory and exit code 7 reach the engine, and TestLauncherReportsAMissingEngine checks the missing-binary error. On Unix, TestLauncherBecomesTheEngineProcess checks that the engine keeps the launcher's PID and that SIGTERM reaches it (exit 42). On Windows the shared tests cover the child-process path, but CI only builds Windows (GOOS=windows go vet passes), so those cases have not run on Windows yet. A Windows runner job is a follow-up; there is no Windows signal test, because Ctrl+C cannot be scripted portably.
There was a problem hiding this comment.
Follow-up: 457da28 adds a windows-latest job, "Launcher tests on Windows", which runs go test ./internal/launcher/... on every pull request. The Windows child-process handoff now runs for real rather than only compiling.
Dependency validation
|
When ballerina/workflow registers WorkflowKind itself and starts a workflow at once, the frontend refuses it until its namespace cache refreshes; creating the attribute with the namespace avoids that (seen with Compose).
With engine.auth.type = "jwt", the engine now refuses to start without [engine.tls], so tokens never cross the network in plain text, and without [engine.tls.internode] when bindAddress is not a loopback address: Temporal gives the internal frontend system access without a token (its internal claim mapper), so it and the other service ports must accept only internode certificates. A rule granting "worker" is refused with "grant write": Temporal's default authorizer needs write for polling, so a worker-only grant refused every call it was for. A start with neither issuer nor audience logs a warning. Runtime.Temporal is held by value, and the server factory receives the services, so a test sees what the profiles and --service choose. The guide drops the worker role, states the TLS and internode requirements with firewall advice and the issuer/audience risk, and the architecture's profile table uses api, the API server's profile. tools/internal/enginetest/security_test.go runs a real engine with TLS, internode mutual TLS and an OpenID Connect provider: an integration token works in its namespace; another namespace, a reader writing, no token, expired, forged, other-issuer and unmatched tokens, and plaintext are refused; the internal frontend refuses callers without an internode certificate and answers one with it. Mapped grants are also checked through Temporal's authorizer (polling).
CLI 1.9 (the CI pin) names the reason, "requires TLS" or "requires client certificate", where 1.6 printed a connection error, so TestSecuredEngine failed on CI only.
jwksUrls, a discovery issuer and a discovered jwks_uri must use https, or plain http to a loopback host: a key set replaced on the way would let anyone sign tokens the engine trusts. Discovery compares the issuer exactly, since tokens are checked against it as written. prometheusAddress needs a numeric port up to 65535. The guide says that issuer alone does not limit tokens to this engine and gives the SQLite historyShards default.
workflow-engine start --runtime-config now prepares Temporal's workflow and visibility databases on PostgreSQL and MySQL before the services start: it creates missing databases, sets up schema versioning in an empty database and applies the schema versions embedded in the binary, through Temporal's own schema tool packages. Nodes started together serialize on a server-wide lock (pg_advisory_lock, GET_LOCK) taken on a single connection to the server's default database; without it, concurrent setups fail with duplicate keys. A user who cannot create databases still works with databases a DBA created. [database] manageSchema = false leaves the schema to the DBA and Temporal's start-up check. With schema management on, database names are restricted to what MySQL's unquoted CREATE DATABASE accepts. Resolves wso2/product-integrator#2911
The suite runner no longer creates the databases and schemas with workflow-engine-sql; the engine does it on start, so the PostgreSQL and MySQL suites now start from empty databases. The smoke job on PostgreSQL also runs the schema test against both service databases, three nodes starting together and then a second start.
Covers the supported databases, the user's rights, Amazon RDS and Aurora with TLS, and installations where a DBA applies schema changes; configure, troubleshoot and the reference follow schema creation on start.
A setup that stopped after creating schema_version but before recording 0.0 is finished on the next start; a version that cannot be read for another reason stops the start instead of being reset to 0.0. The schema lock now lives in the workflow database, and databases are created through the maintenance database only when it can be reached, so a role limited to its two DBA-created databases works. MySQL reserved words are refused as database names when the engine manages the schema: Temporal's schema tool writes them unquoted. The real-database tests now also cover an interrupted setup, databases at schema 1.0 holding a namespace, a workflow and its visibility row (upgraded with the rows kept), and a role limited to its databases.
A depguard rule refuses database drivers, database/sql, sqlx and Temporal's SQL and schema tools outside engine/internal/sqlschema, the DBA tool and tests. Registering Temporal's persistence plugins stays allowed.
balsuite upgrade installs Temporal 1.30.9's schemas (temporal 1.18, visibility 1.13) with its admin-tools image, runs its server in Docker and starts tests/ballerina/upgrade's order workflow there: it runs an activity and waits for a decision. The runner checks the history, stops the old server, starts the engine on the same databases (which upgrades them to 1.19 and 1.14), and the after group sends the decision; the workflow runs its second activity on the engine and completes. 1.30 is the newest release with an older schema: 1.31 already ships the engine's versions. The PostgreSQL and MySQL smoke jobs run it on every pull request.
Name the databases instead of excluding sqlite, so a new matrix entry such as dev mode does not run it.
[engine] logFile writes the log to a file instead of standard output, for virtual machines without systemd. broadcastAddress = "auto" advertises this host's first non-loopback address, which containers know only at start; Temporal's membership needs an IP, so a host name is now refused with a clear message.
Every zip gets bin/workflow-runtime.sh (or .bat), an engine-only conf/runtime.toml, a quick-start README and, for Linux, a systemd unit. The image is assembled from the linux zips, so it ships the released binaries and SBOMs: building it from source would need git metadata the SBOM tool requires and a Docker context lacks. make image builds the zips and the multi-platform image; the release workflow publishes it to ghcr.io/wso2/integration-workflow-runtime and signs it with Sigstore. A Compose file tries it with PostgreSQL.
The user guide now covers installing from the zip and as a systemd service, the container image with Compose, ECS and Kubernetes, and choices on AWS; configure, nodes, monitoring, troubleshooting and the reference use the start script, broadcastAddress = "auto" and logFile. The release publishes the image only once WORKFLOW_RUNTIME_IMAGE names it in WSO2's registry.
bin/workflow-runtime (cmd/workflow-runtime) finds the runtime's home from its own location, works from there, defaults to conf/runtime.toml (WORKFLOW_RUNTIME_CONFIG overrides), and hands start, render-config, version and other commands to workflow-engine: on Linux and macOS it replaces itself with the engine, on Windows it runs the engine as a child. One 2 MB binary per platform instead of .sh and .bat scripts; it is also the image's entry point. Every push to main publishes a test image to ghcr.io; releases still go to WSO2's registry.
Publish the compose port on 127.0.0.1, resolve a relative WORKFLOW_RUNTIME_CONFIG before the launcher changes directory, extract the zip under /opt in the install guide, and name internode TLS on the AWS page.
run takes the executor as a parameter instead of the package variable launch, so tests pass their own fake. exec_unix.go is constrained to unix: !windows also matched js/wasm and wasip1, which have no syscall.Exec. Copies of the test binary act as the launcher and a fake engine: arguments, environment, stdin, working directory and exit code reach the engine, a missing engine is reported, and on unix the engine takes over the launcher's process, so SIGTERM reaches it directly.
Temporal's BuildZapLogger drops the error of a sink it cannot open and returns nil, so a missing directory or an unwritable engine.logFile ended in a nil-pointer panic. The CLI now creates a missing directory, opens the file first and returns an error naming engine.logFile (log.outputFile for a Temporal YAML file). The zip README and the install page create the default namespace and WorkflowKind before integrations connect.
The launcher runs the engine as a child process on Windows, a path the Linux jobs only compiled.
Windows cannot remove a directory that is the working directory or that t.Chdir holds open, and /etc/... is not absolute there; the Windows job found all three. The working directory is restored before the homes are removed, and a missing home is one that never existed.
Dependency validation
|
Purpose
Resolves wso2/product-integrator#2915
Stacked on #4 → #5 → #6. Review the commits after aaa6160.
Customers install the runtime on virtual machines and on container platforms (Docker, Amazon ECS, Kubernetes), without assembling binaries and configuration by hand.
Goals
bin/workflow-runtimelauncher (no shell scripts), an engine-onlyconf/runtime.toml, a quick-start README, and for Linux a systemd unit.runtime.toml.broadcastAddress = "auto"for containers, and[engine] logFilefor virtual machines without systemd.mainpublishes a test image toghcr.io/wso2/integration-workflow-runtime(:nightlyand the nightly version). A release tag publishes to WSO2's registry, signed with Sigstore, once the repository variableWORKFLOW_RUNTIME_IMAGEand the registry secrets are set.Approach
make imagebuilds the zips forIMAGE_PLATFORMS, then the image with buildx (IMAGE_ARGS=--loador--push).cmd/workflow-runtime(2 MB) finds the runtime's home from its own location and works from there, so relative paths inruntime.tomlresolve against it.WORKFLOW_RUNTIME_CONFIGnames another file. On Linux and macOS it replaces itself with the engine (signals and exit code are the engine's); on Windows it runs the engine as a child. It is also the image's entry point.autopicks the host's first non-loopback address, and a host name is refused with a clear message.Release note
The Workflow Runtime ships as zips with a native launcher and a systemd example, and as a signed multi-architecture container image.
Documentation
docs/user-guide/install.md,run-in-containers.mdanddeploy-on-aws.md(new); the other user guide pages now use the launcher,autoandlogFile;docs/features/distribution.md(new),docs/features/runtime-config.md,distribution/README.md,AGENTS.md.Automation tests
autoandlogFileinruntimeconfig.bin/workflow-runtime version,render-config, and a start through a symbolic link from another directory, with relative paths resolved against the runtime's home.WorkflowKind): databases created on a fresh PostgreSQL, the container's IP advertised, and aballerina/workflowintegration ran a workflow.Security checks
Related PRs
#4, #5 and #6 (base).
Test environment
Go 1.26.10, macOS arm64; Docker (Rancher Desktop) with buildx 0.35; Ballerina 2201.14.1 with
ballerina/workflow1.0.2.