@ours.network/install 1.2.1-nightly.45 → 1.2.1-nightly.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/release.json +1 -1
- package/assets/sources.json +1 -1
- package/lib/effects.mjs +12 -0
- package/lib/gateway.mjs +1 -0
- package/package.json +1 -1
package/assets/release.json
CHANGED
package/assets/sources.json
CHANGED
package/lib/effects.mjs
CHANGED
|
@@ -690,12 +690,20 @@ export function networkEffects(effects) {
|
|
|
690
690
|
const args = service === 'daemon' ? [...(daemonBinary === 'ours' ? ['daemon'] : []), op, ...(['install-service', 'uninstall-service'].includes(op) ? ['--yes'] : []), '--config', record.configPath, '--state-dir', installationPaths(record).daemon, '--json'] : [op];
|
|
691
691
|
return effects.run(bin(record, name), args, { ...options, env: localEnv(record, service) });
|
|
692
692
|
};
|
|
693
|
+
const statelessGateway = (record, detail) => {
|
|
694
|
+
const labels = detail?.Config?.Labels ?? {};
|
|
695
|
+
return labels['com.docker.compose.project'] === record.project && labels['com.docker.compose.service'] === 'gateway'
|
|
696
|
+
&& detail.HostConfig?.ReadonlyRootfs === true && Array.isArray(detail.Mounts) && detail.Mounts.every(mount => mount.Type === 'tmpfs');
|
|
697
|
+
};
|
|
693
698
|
const requireCleanContainerExit = async (record, selected) => {
|
|
694
699
|
const containers = await compose(record, ['ps', '-aq', ...selected]);
|
|
695
700
|
for (const id of containers.stdout.split(/\s+/).filter(Boolean)) {
|
|
696
701
|
const result = await container(record, ['inspect', '--format', '{{json .State}}', id]);
|
|
697
702
|
const state = JSON.parse(result.stdout);
|
|
698
703
|
if (state.Status !== 'exited' || state.ExitCode !== 0 || state.OOMKilled !== false || state.Dead !== false) {
|
|
704
|
+
// A forced gateway stop cannot damage stored state: accept it only when
|
|
705
|
+
// the container itself proves it has a read-only root and tmpfs mounts.
|
|
706
|
+
if (state.Status === 'exited' && statelessGateway(record, JSON.parse((await container(record, ['inspect', '--format', '{{json .}}', id])).stdout))) continue;
|
|
699
707
|
throw new Error('Selected source container did not stop cleanly; state operation refused');
|
|
700
708
|
}
|
|
701
709
|
}
|
|
@@ -1430,6 +1438,10 @@ export function networkEffects(effects) {
|
|
|
1430
1438
|
}
|
|
1431
1439
|
if (operation === 'stop') {
|
|
1432
1440
|
const consumers = selected.filter(s => s !== 'daemon').reverse();
|
|
1441
|
+
// Gateways created before stop_signal was set still stop with nginx's
|
|
1442
|
+
// SIGQUIT, which waits for open streams beyond the grace period and
|
|
1443
|
+
// ends in SIGKILL. SIGTERM is nginx's fast shutdown; it exits cleanly.
|
|
1444
|
+
if (consumers.includes('gateway')) await compose(record, ['kill', '-s', 'SIGTERM', 'gateway']);
|
|
1433
1445
|
if (consumers.length) await compose(record, ['stop', ...consumers]);
|
|
1434
1446
|
if (selected.includes('daemon')) await compose(record, ['stop', 'daemon']);
|
|
1435
1447
|
if ((await effects.serverLifecycle(record, 'status', selected)).length) throw new Error('Writers did not stop');
|
package/lib/gateway.mjs
CHANGED
|
@@ -57,6 +57,7 @@ export function gatewayCompose(record) {
|
|
|
57
57
|
ports:
|
|
58
58
|
- {target: 8080, published: "${record.port}", host_ip: "127.0.0.1"}
|
|
59
59
|
restart: unless-stopped
|
|
60
|
+
stop_signal: SIGTERM
|
|
60
61
|
stop_grace_period: 10s
|
|
61
62
|
healthcheck:
|
|
62
63
|
test: [CMD, wget, -q, -O, /dev/null, http://127.0.0.1:8080/healthz]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/install",
|
|
3
|
-
"version": "1.2.1-nightly.
|
|
3
|
+
"version": "1.2.1-nightly.46",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The all-in-one ours.network installer: one shared daemon, MCP, cowork, Telegram, Fleet initialization, harness plugins, Human identity, progress UI, and guided next steps.",
|
|
6
6
|
"type": "module",
|