@or3/cloud 0.1.55 → 0.1.57

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.
@@ -356,8 +356,8 @@ function updaterEnvironment(installDirectory, job, imageDigest) {
356
356
  NPM_CONFIG_IGNORE_SCRIPTS: 'true',
357
357
  NPM_CONFIG_AUDIT: 'false',
358
358
  NPM_CONFIG_FUND: 'false',
359
- NPM_CONFIG_USERCONFIG: '/dev/null',
360
- NPM_CONFIG_GLOBALCONFIG: '/dev/null',
359
+ NPM_CONFIG_USERCONFIG: join(installDirectory, 'disabled-user.npmrc'),
360
+ NPM_CONFIG_GLOBALCONFIG: join(installDirectory, 'disabled-global.npmrc'),
361
361
  OR3_DASHBOARD_UPDATE_JOB_ID: job.id,
362
362
  ...(imageDigest ? { OR3_EXPECTED_IMAGE_DIGEST: imageDigest } : {}),
363
363
  };
@@ -627,26 +627,63 @@ async function completeOperatorHandoff(jobId, project) {
627
627
  && state
628
628
  && !state.incompleteOperation
629
629
  ) {
630
- await delay(1_000);
631
630
  const environment = await deploymentEnv();
632
631
  if (envValue(environment, 'OR3_DASHBOARD_UPDATES_ENABLED') !== 'true') return;
633
- const restarted = await runProcess('docker', [
634
- 'compose',
635
- '--project-name', project,
636
- '--project-directory', deploymentDirectory,
637
- '--env-file', join(deploymentDirectory, '.env'),
638
- '-f', join(deploymentDirectory, 'compose.yaml'),
639
- '-f', join(deploymentDirectory, 'compose.operator.yaml'),
640
- 'up', '-d', '--no-deps', '--force-recreate', 'or3-operator',
641
- ], {
642
- cwd: deploymentDirectory,
643
- env: process.env,
644
- timeoutMs: 60_000,
645
- });
646
- if (restarted.code !== 0) {
647
- throw new Error(`The dashboard operator handoff could not start its successor: ${restarted.output}`);
632
+ const serviceFilters = [
633
+ '--filter', `label=com.docker.compose.project=${project}`,
634
+ '--filter', 'label=com.docker.compose.service=or3-operator',
635
+ ];
636
+ let lastOutput = '';
637
+ for (let attempt = 0; attempt < 6; attempt += 1) {
638
+ // Old protocol-v1 operators may start their own Compose replacement
639
+ // after writing the terminal job. Removing every container for this
640
+ // one stateless service also kills that in-container Compose child and
641
+ // clears any half-created successor without touching the application.
642
+ for (let sweep = 0; sweep < 2; sweep += 1) {
643
+ const listed = await runProcess('docker', ['ps', '-aq', ...serviceFilters], {
644
+ cwd: deploymentDirectory,
645
+ env: process.env,
646
+ timeoutMs: 30_000,
647
+ });
648
+ lastOutput = listed.output;
649
+ const containerIds = listed.code === 0
650
+ ? listed.output.split(/\s+/).filter((value) => /^[0-9a-f]{12,64}$/i.test(value))
651
+ : [];
652
+ if (containerIds.length > 0) {
653
+ const removed = await runProcess('docker', ['rm', '--force', ...containerIds], {
654
+ cwd: deploymentDirectory,
655
+ env: process.env,
656
+ timeoutMs: 30_000,
657
+ });
658
+ lastOutput = `${lastOutput}\n${removed.output}`.trim();
659
+ }
660
+ await delay(750);
661
+ }
662
+ const compose = [
663
+ 'compose',
664
+ '--project-name', project,
665
+ '--project-directory', deploymentDirectory,
666
+ '--env-file', join(deploymentDirectory, '.env'),
667
+ '-f', join(deploymentDirectory, 'compose.yaml'),
668
+ '-f', join(deploymentDirectory, 'compose.operator.yaml'),
669
+ ];
670
+ const restarted = await runProcess('docker', [...compose, 'up', '-d', '--no-deps', 'or3-operator'], {
671
+ cwd: deploymentDirectory,
672
+ env: process.env,
673
+ timeoutMs: 60_000,
674
+ });
675
+ const running = restarted.code === 0
676
+ ? await runProcess('docker', [...compose, 'ps', '--status', 'running', '-q', 'or3-operator'], {
677
+ cwd: deploymentDirectory,
678
+ env: process.env,
679
+ timeoutMs: 30_000,
680
+ })
681
+ : { code: restarted.code, output: '' };
682
+ lastOutput = `${lastOutput}\n${restarted.output}\n${running.output}`.trim();
683
+ if (restarted.code === 0 && running.code === 0 && /^[0-9a-f]{12,64}$/i.test(running.output.trim())) return;
684
+ await delay(2_000);
648
685
  }
649
- return;
686
+ throw new Error(`The dashboard operator handoff could not start its successor: ${lastOutput}`);
650
687
  }
651
688
  await delay(250);
652
689
  }
package/dist/cli.mjs CHANGED
@@ -30,7 +30,7 @@ import { fileURLToPath } from "node:url";
30
30
  import { createGunzip } from "node:zlib";
31
31
  var execFile = promisify(execFileCallback);
32
32
  var PACKAGE_ROOT = resolve(fileURLToPath(new URL("../", import.meta.url)));
33
- var PACKAGE_VERSION = "0.1.55";
33
+ var PACKAGE_VERSION = "0.1.57";
34
34
  var IMAGE_REPOSITORY = "ghcr.io/saluana/or3-chat";
35
35
  var ASSET_ROOT = resolve(fileURLToPath(new URL("../assets/", import.meta.url)));
36
36
  var STATE_SCHEMA_VERSION = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@or3/cloud",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
4
4
  "description": "Install and operate the OR3 Cloud container distribution",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0",
@@ -18,9 +18,9 @@
18
18
  "or3Cloud": {
19
19
  "dashboardUpdateProtocol": 1,
20
20
  "dashboardUpdateMinimumSourceVersion": "0.1.40",
21
- "imageDigest": "sha256:d92a7a6b8e8a198a59c6506a5385beda6b7c829fc30406bc4653a388b8c5b638",
22
- "operatorImageDigest": "sha256:e8149df09dc59d3184c325de09d5662b4efe8dccba70dfdde453b2fb5365c335",
23
- "sourceRevision": "7a73e723edd4ca01ca7a387aad6902e185a8d16c"
21
+ "imageDigest": "sha256:0f493438a906cec53442991a7b63d77166708cb506a37dac10022a0f15dd57d3",
22
+ "operatorImageDigest": "sha256:8937743e7fa9648bcae7d4565198a515db67899bfe077c092a4affb6fa2bc75b",
23
+ "sourceRevision": "4d3bb9ef8b826a78345a3ceb02ce31157190496d"
24
24
  },
25
25
  "files": [
26
26
  "dist",