fix(archectl): write flow scheduler mode and run the flow daemon - #497
Closed
albertoperdomo2 wants to merge 5 commits into
Closed
albertoperdomo2 wants to merge 5 commits into
albertoperdomo2 wants to merge 5 commits into
Conversation
archectl-generated deployments never set ARCHE_FLOW_SCHEDULER_MODE, and the web app requires it in production (getFlowSchedulerMode throws when missing), so one-click servers failed at web startup. The Ansible remote path already sets it to daemon. Set ARCHE_FLOW_SCHEDULER_MODE=daemon in renderEnvFile, the bootstrap env heredoc, and the update script (idempotent set_env, so existing deployments converge on next update). Because daemon mode expects a dedicated runner, the generated compose also gains a flows service running the web image's flow-daemon entrypoint — mirroring the Ansible remote template — and the update script brings flows up alongside web.
This was referenced Aug 31, 2026
6 tasks
Contributor
Author
|
Superseded by #478, which absorbs this fix ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes one-click deployments failing at web startup: archectl never wrote
ARCHE_FLOW_SCHEDULER_MODE, andgetFlowSchedulerMode()(apps/web/src/lib/flows/scheduler.ts) throws in production when the variable is missing — so every archectl-generated.envproduced a web container that could not boot. The Ansible deploy path sets the variable correctly (infra/deploy/ansible/roles/app/templates/.env.j2:74); only the archectl path was broken.Changes in
infra/one-click/main.go:renderEnvFileand therenderBootstrapScriptenv heredoc writeARCHE_FLOW_SCHEDULER_MODE=daemon— the correct value for the one-click topology, which is remote-equivalent (same as the Ansibledeploy_mode == 'remote'branch).renderUpdateScriptsets the variable via the existing idempotentset_envhelper, so existing deployments converge on their next update.renderComposegains aflowsservice, and the update script bringsflowsup alongsideweb.Why the compose service is part of the fix
Writing
daemonalone would not be enough:startFlowDaemon()exits unless the mode isdaemon, and indaemonmode the web process does not tick flows — a dedicated runner is expected. The newflowsservice mirrors the Ansible remote template exactly (same${ARCHE_WEB_IMAGE}running./node_modules/.bin/tsx src/flow-daemon.ts, same env file, networks, host mounts, health-gateddepends_on, healthcheck disabled). The production image already shipssrc/+node_modules/, so the entrypoint runs unchanged.OpenSpec
Adds
archectl-flow-scheduler-modechange with a newarchectl-deploymentcapability spec (openspec/changes/archectl-flow-scheduler-mode/): generated env files must satisfy every production-required setting, the compose stack must run a runner consistent with the scheduler mode, and updates must converge existing deployments. Validated withopenspec validate --strict.Test plan
go vet/gofmtclean;go test ./...— 16 passed (4 new: env template, bootstrap heredoc, update script set_env +up -d web flows, composeflowsservice)[docker-socket-proxy, flows, postgres, traefik, web]; env line andset_envpresent in rendered outputopenspec validate archectl-flow-scheduler-mode --strict— validarchectl updateagainst an existing one-click deployment and confirm theflowscontainer starts and the web boots without the scheduler-mode errorNotes / follow-up
reaperservice (Ansible remote runs one); pre-existing parity gap, deliberately left out of this fix to keep it scoped — happy to do it as a follow-up.Known failing check
Verify Web Coverage Badgesis red due to a shared-maintest bug, not this change:sessions-panel.test.tsx > groups sessions by date bucketsis calendar-dependent and fails on the 31st (see the root cause in #498). Merge #498 first, then this branch rebases green.