run-spaceapp 1.0.31 → 1.0.35

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "run-spaceapp",
3
- "version": "1.0.31",
4
- "spaceappRuntimeVersion": "1.0.31",
3
+ "version": "1.0.35",
4
+ "spaceappRuntimeVersion": "1.0.35",
5
5
  "spaceappHostRootRuntimeCompatible": true,
6
6
  "description": "Cross-platform Docker launcher for the SpaceApp self-hosted agent workspace",
7
7
  "license": "Apache-2.0",
@@ -52,5 +52,5 @@
52
52
  "access": "public",
53
53
  "provenance": true
54
54
  },
55
- "gitHead": "2769d82e1077c9316c6452f40c4996e0290ce083"
55
+ "gitHead": "6010f556f9f782fe545e08d1465d3b98745de9d8"
56
56
  }
package/src/cli.mjs CHANGED
@@ -1319,7 +1319,7 @@ async function performUpdate({
1319
1319
  const stagedRoot = await mkdtemp(join(tmpdir(), "spaceapp-update-"));
1320
1320
  let checkpoint = null;
1321
1321
  try {
1322
- await writeRuntimeFiles(stagedRoot, updated);
1322
+ await commitInstallation(stagedRoot, updated);
1323
1323
  const stagedCommand = (action) => composeCommand(action, root, {...updated, stateRoot: stagedRoot});
1324
1324
  const pullCode = await withHeadlessDockerConfig(
1325
1325
  platform, stagedCommand("pull"),
@@ -1331,7 +1331,7 @@ async function performUpdate({
1331
1331
  }
1332
1332
  if (await verifyStorage({ root, config: updated, existingConfig: config, operation: "upgrade", inspectResources, execute, stdout, stderr }) !== 0) return 1;
1333
1333
  checkpoint = await createQuiescedCheckpoint(root, config, {stdin, stdout, stderr, execute, platform});
1334
- await writeRuntimeFiles(root, updated);
1334
+ await commitInstallation(root, updated, { persistConfig: false });
1335
1335
  const upCode = await execute(
1336
1336
  composeCommand("up", root, { profile: updated.profile, companionsEnabled: updated.companionsEnabled }),
1337
1337
  { stdin, stdout, stderr }
@@ -1410,6 +1410,9 @@ async function collectFiles(directory, logicalDirectory) {
1410
1410
  async function createQuiescedCheckpoint(root, config, io) {
1411
1411
  io.stdout.write("Pausing SpaceApp writers before the database checkpoint...\n");
1412
1412
  try {
1413
+ io.stdout.write("Ensuring the existing PostgreSQL database is ready for the checkpoint...\n");
1414
+ const databaseCode = await io.execute(composeCommand("ensureCheckpointDatabase", root, config), io);
1415
+ if (databaseCode !== 0) throw new Error(`The existing PostgreSQL database did not become ready (exit ${databaseCode}). The upgrade was not applied.`);
1413
1416
  const code = await io.execute(composeCommand("stopForRestore", root, config), io);
1414
1417
  if (code !== 0) throw new Error(`Could not pause SpaceApp writers (exit ${code}).`);
1415
1418
  return await createCheckpoint(root, config, io);
package/src/index.mjs CHANGED
@@ -677,6 +677,7 @@ export function composeCommand(action, root, options = {}) {
677
677
  storageFree: ["exec", "-T", "spaceapp-core", "node", "-e", "const fs=require('node:fs');const s=fs.statfsSync('/var/lib/spaceapp');console.log(Number(s.bavail)*Number(s.bsize))"],
678
678
  purge: ["down", "--volumes", "--remove-orphans"],
679
679
  repair: ["up", "-d", "--remove-orphans", "--force-recreate"],
680
+ ensureCheckpointDatabase: ["up", "-d", "--no-deps", "--wait", "--wait-timeout", "120", "postgres"],
680
681
  checkpointDump: ["exec", "-T", "postgres", "pg_dump", "-c", "--if-exists", "-U", "spaceapp", "-d", "spaceapp"],
681
682
  checkpointRestore: ["exec", "-T", "postgres", "psql", "-v", "ON_ERROR_STOP=1", "-U", "spaceapp", "-d", "spaceapp"]
682
683
  };
@@ -848,7 +849,8 @@ export async function prepareInstallation(root, {
848
849
  }
849
850
 
850
851
  export async function commitInstallation(root, config, {
851
- templateDir = defaultTemplateDir()
852
+ templateDir = defaultTemplateDir(),
853
+ persistConfig = true
852
854
  } = {}) {
853
855
  validateHome(root);
854
856
  validateConfig(config);
@@ -856,7 +858,7 @@ export async function commitInstallation(root, config, {
856
858
  await mkdir(root, { recursive: true, mode: 0o700 });
857
859
  await atomicWrite(join(root, "compose.yml"), composeTemplate);
858
860
  await writeRuntimeFiles(root, config);
859
- await saveConfig(root, config);
861
+ if (persistConfig) await saveConfig(root, config);
860
862
  }
861
863
 
862
864
  export async function initializeInstallation(root, options) {
@@ -3,12 +3,6 @@ services:
3
3
  image: ghcr.io/oll4com/spaceapp-core:${SPACEAPP_IMAGE_TAG}
4
4
  restart: unless-stopped
5
5
  init: true
6
- entrypoint:
7
- - /bin/sh
8
- - -ec
9
- - |
10
- sed -i 's/agentToolsWriterCommand: env.SPACE_AGENT_TOOLS_WRITER || [^,]*/agentToolsWriterCommand: null/g' /app/apps/api/dist/config.js 2>/dev/null || true
11
- exec /app/deploy/docker/core-entrypoint.sh
12
6
  security_opt:
13
7
  - no-new-privileges:true
14
8
  mem_limit: "${SPACEAPP_CORE_MEMORY_LIMIT}"