From 9b02d16bff93e18060c7676ddd7832409484ea76 Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Thu, 23 Jul 2020 16:04:40 -0400 Subject: [PATCH] (core) more grist-core cleanup Summary: * Remove duplicate schema file * Move version file to a stub in grist-core * Simplify sandbox creation in grist-core (although not functional until sandbox code moved) * Add a minimal test for buildability Test Plan: added test Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2560 --- app/common/tsconfig.json | 4 ++++ app/common/version.ts | 3 --- stubs/app/common/version.ts | 4 ++++ stubs/app/server/lib/create.ts | 30 +++++------------------------- stubs/app/server/server.ts | 4 ++++ 5 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 app/common/version.ts create mode 100644 stubs/app/common/version.ts diff --git a/app/common/tsconfig.json b/app/common/tsconfig.json index 44b48ccb..03f3b5a3 100644 --- a/app/common/tsconfig.json +++ b/app/common/tsconfig.json @@ -1,5 +1,9 @@ { "extends": "../../buildtools/tsconfig-base.json", + "include": [ + "**/*", + "../../stubs/app/common/**/*" + ], "references": [ { "path": "../plugin" } ] diff --git a/app/common/version.ts b/app/common/version.ts deleted file mode 100644 index bfc7a98b..00000000 --- a/app/common/version.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const version = "1.0.2-dev"; -export const channel = "devtest"; -export const gitcommit = "e33c4e5aeM"; diff --git a/stubs/app/common/version.ts b/stubs/app/common/version.ts new file mode 100644 index 00000000..fb726540 --- /dev/null +++ b/stubs/app/common/version.ts @@ -0,0 +1,4 @@ +// version tracking not set up in grist-core yet +export const version = "0.1.1"; +export const channel = "core"; +export const gitcommit = "unknown"; diff --git a/stubs/app/server/lib/create.ts b/stubs/app/server/lib/create.ts index d98cc6c4..91b6d588 100644 --- a/stubs/app/server/lib/create.ts +++ b/stubs/app/server/lib/create.ts @@ -3,7 +3,10 @@ import { ActiveDoc } from 'app/server/lib/ActiveDoc'; import { DocManager } from 'app/server/lib/DocManager'; import { ICreate } from 'app/server/lib/ICreate'; import { LoginSession } from 'app/server/lib/LoginSession'; -import { NSandbox } from 'app/server/lib/NSandbox'; +import { NSandboxCreator } from 'app/server/lib/NSandbox'; + +// Use raw python - update when pynbox or other solution is set up for core. +const sandboxCreator = new NSandboxCreator('unsandboxed'); export const create: ICreate = { LoginSession() { @@ -33,30 +36,7 @@ export const create: ICreate = { return new DocManager(storageManager, pluginManager, homeDBManager, gristServer); }, NSandbox(options) { - const args = [options.entryPoint || 'grist/main.pyc']; - if (!options.entryPoint && options.comment) { - // Note that docName isn't used by main.py, but it makes it possible to tell in `ps` output - // which sandbox process is for which document. - args.push(options.comment); - } - const selLdrArgs: string[] = []; - if (options.sandboxMount) { - selLdrArgs.push( - // TODO: Only modules that we share with plugins should be mounted. They could be gathered in - // a "$APPROOT/sandbox/plugin" folder, only which get mounted. - '-E', 'PYTHONPATH=grist:thirdparty', - '-m', `${options.sandboxMount}:/sandbox:ro`); - } - if (options.importMount) { - selLdrArgs.push('-m', `${options.importMount}:/importdir:ro`); - } - return new NSandbox({ - args, - logCalls: options.logCalls, - logMeta: options.logMeta, - logTimes: options.logTimes, - selLdrArgs, - }); + return sandboxCreator.create(options); }, sessionSecret() { return process.env.GRIST_SESSION_SECRET || diff --git a/stubs/app/server/server.ts b/stubs/app/server/server.ts index 94c11511..7faa8e43 100644 --- a/stubs/app/server/server.ts +++ b/stubs/app/server/server.ts @@ -1,3 +1,7 @@ +/** + * Main entrypoint for grist-core server. + */ + import {updateDb} from 'app/server/lib/dbUtils'; import {main as mergedServerMain} from 'app/server/mergedServerMain'; import * as fse from 'fs-extra';