Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Size Fly core for sustained worker load (#1200)

Joshua France0a9624e4babb
diff --git a/cli/templates/deployment/references/fly.md b/cli/templates/deployment/references/fly.md
index a21b030d6..4de415356 100644
--- a/cli/templates/deployment/references/fly.md
+++ b/cli/templates/deployment/references/fly.md
@@ -44,7 +44,8 @@ npm exec qm -- check --live
`secrets push` ownership-marks service apps before delivering secrets. When
storage credentials or `DATABASE_URL` are absent, deployment creates or reuses
-private Tigris and Managed Postgres.
+private Tigris and Managed Postgres. The core defaults to a
+2-CPU performance VM with 4 GB of memory for its 16 workers.
`check --live` proves service health and durable object storage.
After the first successful deployment, rerun `npm exec qm -- up` and confirm it
diff --git a/cli/templates/fly/core.toml b/cli/templates/fly/core.toml
index f662cc7a7..d4039d642 100644
--- a/cli/templates/fly/core.toml
+++ b/cli/templates/fly/core.toml
@@ -22,9 +22,12 @@ primary_region = "sjc"
[deploy]
strategy = "bluegreen"
+[[restart]]
+ policy = "always"
+
[[vm]]
- size = "shared-cpu-1x"
- memory = "2gb"
+ size = "performance-2x"
+ memory = "4gb"
kill_signal = "SIGTERM"
kill_timeout = "300s"
diff --git a/cli/test/fly-derive.test.ts b/cli/test/fly-derive.test.ts
index 76ee0c3dc..7ddee76e6 100644
--- a/cli/test/fly-derive.test.ts
+++ b/cli/test/fly-derive.test.ts
@@ -18,6 +18,13 @@ test("acme fly config derives the checked-in deploy/<svc>/fly.toml byte-for-byte
}
});
+test("Fly core defaults can sustain the 16-worker baseline", () => {
+ const { config } = loadConfigAt(join(repoRoot, "deploy", "stacks", "acme", "qm.config.jsonc"));
+ const core = derivedTomlFor(config, "core", repoRoot);
+ assert.match(core, /\[\[restart\]\]\n\s*policy = "always"/);
+ assert.match(core, /\[\[vm\]\]\n\s*size = "performance-2x"\n\s*memory = "4gb"/);
+});
+
test("web-ui serves at the root in both shapes — publicUrl IS the web-ui URL (no /web-ui suffix)", () => {
const url = "https://acme-web-ui.fly.dev";
assert.equal(orgEnv("core", "acme", url, false).WEB_UI_PUBLIC_URL, url);
diff --git a/cli/test/package.test.ts b/cli/test/package.test.ts
index 25ae92f6f..782d99396 100644
--- a/cli/test/package.test.ts
+++ b/cli/test/package.test.ts
@@ -185,7 +185,10 @@ test(
assert.doesNotMatch(flyPlan, /source checkout|deploy\/core\/Dockerfile/);
const generatedCore = join(deployment, ".generated", "fly", "acme", "core.fly.toml");
assert.ok(existsSync(generatedCore));
- assert.doesNotMatch(readFileSync(generatedCore, "utf8"), /^\s*PI_(?:MODEL|DETECT_MODEL)\s*=/m);
+ const generatedCoreToml = readFileSync(generatedCore, "utf8");
+ assert.doesNotMatch(generatedCoreToml, /^\s*PI_(?:MODEL|DETECT_MODEL)\s*=/m);
+ assert.match(generatedCoreToml, /\[\[restart\]\]\n\s*policy = "always"/);
+ assert.match(generatedCoreToml, /\[\[vm\]\]\n\s*size = "performance-2x"\n\s*memory = "4gb"/);
assert.match(
execFileSync(bin, ["sandbox", "build", "--dry-run"], { cwd: deployment, encoding: "utf8", env }),
/qm-sandbox-base@sha256:a{64}/,
diff --git a/deploy/core/fly.toml b/deploy/core/fly.toml
index 91a137137..e8838147f 100644
--- a/deploy/core/fly.toml
+++ b/deploy/core/fly.toml
@@ -24,9 +24,12 @@ primary_region = "sjc"
[deploy]
strategy = "bluegreen"
+[[restart]]
+ policy = "always"
+
[[vm]]
- size = "shared-cpu-1x"
- memory = "2gb"
+ size = "performance-2x"
+ memory = "4gb"
kill_signal = "SIGTERM"
kill_timeout = "300s"
diff --git a/test/config.test.ts b/test/config.test.ts
index aadb10398..94e6ba4c4 100644
--- a/test/config.test.ts
+++ b/test/config.test.ts
@@ -296,6 +296,7 @@ test("production refuses missing, placeholder, or weak signing keys", () => {
test("defaults come from CONFIG_DEFAULTS, set exactly once", () => {
const def = loadConfig({});
+ assert.equal(CONFIG_DEFAULTS.workers, 16);
assert.equal(def.workers, CONFIG_DEFAULTS.workers);
assert.equal(def.rateLimitPerWindow, CONFIG_DEFAULTS.rateLimitPerWindow);
assert.equal(def.rateLimitWindowMs, CONFIG_DEFAULTS.rateLimitWindowMs);