(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
This commit is contained in:
Paul Fitzpatrick 2020-07-23 16:04:40 -04:00
parent b7b4b0229b
commit 9b02d16bff
5 changed files with 17 additions and 28 deletions

View File

@ -1,5 +1,9 @@
{ {
"extends": "../../buildtools/tsconfig-base.json", "extends": "../../buildtools/tsconfig-base.json",
"include": [
"**/*",
"../../stubs/app/common/**/*"
],
"references": [ "references": [
{ "path": "../plugin" } { "path": "../plugin" }
] ]

View File

@ -1,3 +0,0 @@
export const version = "1.0.2-dev";
export const channel = "devtest";
export const gitcommit = "e33c4e5aeM";

View File

@ -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";

View File

@ -3,7 +3,10 @@ import { ActiveDoc } from 'app/server/lib/ActiveDoc';
import { DocManager } from 'app/server/lib/DocManager'; import { DocManager } from 'app/server/lib/DocManager';
import { ICreate } from 'app/server/lib/ICreate'; import { ICreate } from 'app/server/lib/ICreate';
import { LoginSession } from 'app/server/lib/LoginSession'; 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 = { export const create: ICreate = {
LoginSession() { LoginSession() {
@ -33,30 +36,7 @@ export const create: ICreate = {
return new DocManager(storageManager, pluginManager, homeDBManager, gristServer); return new DocManager(storageManager, pluginManager, homeDBManager, gristServer);
}, },
NSandbox(options) { NSandbox(options) {
const args = [options.entryPoint || 'grist/main.pyc']; return sandboxCreator.create(options);
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,
});
}, },
sessionSecret() { sessionSecret() {
return process.env.GRIST_SESSION_SECRET || return process.env.GRIST_SESSION_SECRET ||

View File

@ -1,3 +1,7 @@
/**
* Main entrypoint for grist-core server.
*/
import {updateDb} from 'app/server/lib/dbUtils'; import {updateDb} from 'app/server/lib/dbUtils';
import {main as mergedServerMain} from 'app/server/mergedServerMain'; import {main as mergedServerMain} from 'app/server/mergedServerMain';
import * as fse from 'fs-extra'; import * as fse from 'fs-extra';