@aopslabs/aops 0.3.2 → 0.3.4

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/README.md CHANGED
@@ -196,7 +196,9 @@ Opening the TUI does not by itself start or stop either service. Use the TUI's
196
196
  explicit actions or the CLI command families. The convenience
197
197
  `aops cockpit` command may start safely stopped services before opening the
198
198
  browser; the explicit server and Cockpit lifecycle commands never stop or
199
- start the other service.
199
+ start the other service. For setup path 2, an ordinary `aops server stop`
200
+ leaves the managed PostgreSQL container running; only the explicit destructive
201
+ installation reset removes its verified container and volume.
200
202
 
201
203
  The npm package includes `launchers/aops-server.sh` and
202
204
  `launchers/aops-server.ps1` for running the installed server in the current
@@ -8,7 +8,7 @@ import { parseEnv } from 'node:util';
8
8
  import { COMMUNITY_NATIVE_CHILD_PROTOCOL, COMMUNITY_NATIVE_CONTROL_PROTOCOL, } from './community-native-child.js';
9
9
  import { resolveCommunityInstallPaths } from './community-lifecycle.js';
10
10
  import { buildCommunityInstanceContract, } from './community-instance-contract.js';
11
- import { COMMUNITY_NATIVE_POSTGRES_CONTRACT_PATH, assertCommunityNativePostgresInstanceState, assertCommunityNativePostgresState, buildCommunityNativePostgresUrl, setupCommunityNativePostgres, startCommunityNativePostgres, stopCommunityNativePostgres, } from './community-native-postgres.js';
11
+ import { COMMUNITY_NATIVE_POSTGRES_CONTRACT_PATH, assertCommunityNativePostgresInstanceState, assertCommunityNativePostgresState, buildCommunityNativePostgresUrl, setupCommunityNativePostgres, startCommunityNativePostgres, } from './community-native-postgres.js';
12
12
  import { COMMUNITY_NATIVE_MIGRATION_POLICY_PATH, assertCommunityNativeMigrationReceiptV1, planCommunityNativeMigration, runCommunityNativeMigration, } from './community-native-migration.js';
13
13
  import { createCommunityExternalSnapshotAttestationV1, writeCommunityExternalSnapshotAttestationV1, } from './community-migration-snapshot.js';
14
14
  import { createCommunityNativeApplicationReferenceV1, readCommunityNativeApplicationUpdate, sameCommunityNativeApplicationContent, writeCommunityNativeApplicationRollbackOutcome, writeCommunityNativeApplicationRollbackPrepared, writeCommunityNativeApplicationUpdateOutcome, writeCommunityNativeApplicationUpdatePrepared, } from './community-native-application-recovery.js';
@@ -1636,15 +1636,6 @@ export async function stopCommunityNativeInstall(params = {}) {
1636
1636
  now,
1637
1637
  });
1638
1638
  if (observed.runtimeState === 'stopped' || observed.runtimeState === 'crashed') {
1639
- if (inspection.state.postgres.mode === 'container') {
1640
- await stopCommunityNativePostgres({
1641
- state: inspection.state.postgres,
1642
- instanceName: inspection.state.instanceName,
1643
- instanceRoot: inspection.paths.instanceRoot,
1644
- runtime: params.postgresRuntime,
1645
- signal: params.signal,
1646
- });
1647
- }
1648
1639
  return { status: 'already-stopped', state: inspection.state, process: observed.process };
1649
1640
  }
1650
1641
  if (!observed.process || !observed.identity || !observed.supervisorAlive ||
@@ -1670,15 +1661,6 @@ export async function stopCommunityNativeInstall(params = {}) {
1670
1661
  };
1671
1662
  delete stopped.failure;
1672
1663
  writeProcess(inspection.paths, stopped);
1673
- if (inspection.state.postgres.mode === 'container') {
1674
- await stopCommunityNativePostgres({
1675
- state: inspection.state.postgres,
1676
- instanceName: inspection.state.instanceName,
1677
- instanceRoot: inspection.paths.instanceRoot,
1678
- runtime: params.postgresRuntime,
1679
- signal: params.signal,
1680
- });
1681
- }
1682
1664
  return { status: 'stopped', state: inspection.state, process: stopped };
1683
1665
  }
1684
1666
  await runtime.sleep(READY_POLL_MS, params.signal);
@@ -302,8 +302,11 @@ async function verifyContainer(runtime, state, instanceName, signal, verifyPersi
302
302
  (hostPort !== null && (!Number.isSafeInteger(hostPort) || hostPort < 1 || hostPort > 65_535)) ||
303
303
  (verifyPersistedPort && hostPort !== null && hostPort !== state.port))
304
304
  throw new Error('community_native_postgres_container_port_binding_drift');
305
- if (verifyPersistedPort && await mappedPort(runtime, state, signal) !== state.port) {
306
- throw new Error('community_native_postgres_container_port_binding_drift');
305
+ if (verifyPersistedPort) {
306
+ const observed = await containerState(runtime, state.containerName, signal);
307
+ if (observed.status === 'running' && await mappedPort(runtime, state, signal) !== state.port) {
308
+ throw new Error('community_native_postgres_container_port_binding_drift');
309
+ }
307
310
  }
308
311
  const restartPolicy = await inspectContainerJson(runtime, state.containerName, '{{json .HostConfig.RestartPolicy}}', 'container_restart_policy_inspect', signal);
309
312
  if (!restartPolicy || typeof restartPolicy !== 'object' || Array.isArray(restartPolicy) ||
@@ -476,19 +479,6 @@ export async function startCommunityNativePostgres(params) {
476
479
  if (port !== state.port)
477
480
  throw new Error('community_native_postgres_port_mapping_drift:run_server_setup_--apply');
478
481
  }
479
- export async function stopCommunityNativePostgres(params) {
480
- throwIfCommunityCommandAborted(params.signal);
481
- const state = assertCommunityNativePostgresInstanceState(params);
482
- const runtime = params.runtime ?? communityNativePostgresRuntime;
483
- if (!await verifyContainer(runtime, state, params.instanceName, params.signal)) {
484
- throw new Error('community_native_postgres_container_missing');
485
- }
486
- const observed = await containerState(runtime, state.containerName, params.signal);
487
- if (observed.status === 'exited' || observed.status === 'created')
488
- return 'already-stopped';
489
- await runDocker(runtime, ['container', 'stop', '--time', '15', state.containerName], 'container_stop', params.signal);
490
- return 'stopped';
491
- }
492
482
  export async function removeCommunityNativePostgresContainer(params) {
493
483
  throwIfCommunityCommandAborted(params.signal);
494
484
  const state = assertCommunityNativePostgresInstanceState(params);
Binary file
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aopslabs/aops",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "description": "AOPS CLI and terminal setup application.",
6
- "aopsDockerServerVersion": "0.2.4",
6
+ "aopsDockerServerVersion": "0.2.6",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "repository": {
9
9
  "type": "git",
@@ -46,7 +46,7 @@
46
46
  "test:target-transport": "node --test test/target-transport.test.mjs",
47
47
  "test:r6-cutover-baseline": "node scripts/verify-r6-cutover-baseline.mjs",
48
48
  "test:r6-auth-cutover": "node --test test/r6-auth-cutover.test.mjs",
49
- "test:container-runtime": "node --test test/container-runtime.test.mjs",
49
+ "test:container-runtime": "node --test test/container-runtime.test.mjs test/community-native-postgres.test.mjs",
50
50
  "test:kernel-alignment": "node --test test/kernel-alignment.test.mjs",
51
51
  "test:home": "node --test test/home-menu.test.mjs",
52
52
  "test:launchers": "node --test test/terminal-launchers.test.mjs",
@@ -55,11 +55,11 @@
55
55
  "start": "node dist/main.js"
56
56
  },
57
57
  "dependencies": {
58
- "@aopslabs/aops-server": "0.2.4",
58
+ "@aopslabs/aops-server": "0.2.6",
59
59
  "@aopslabs/artifact-trust-contracts": "0.3.0",
60
60
  "@aopslabs/cli-kit": "0.1.0",
61
61
  "@aopslabs/aops-host-registration": "0.2.0",
62
- "@aopslabs/aops-pg-bootstrap": "0.2.0",
62
+ "@aopslabs/aops-pg-bootstrap": "0.2.1",
63
63
  "@aopslabs/aops-runtime-config": "0.2.0",
64
64
  "@sigstore/bundle": "4.0.0",
65
65
  "@sigstore/protobuf-specs": "0.5.1",