(core) give instructions on using Grist with docker

Summary: cleans up docker build and instructions.

Test Plan: docker image and instructions tested manually

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2648
This commit is contained in:
Paul Fitzpatrick
2020-10-28 13:37:36 -04:00
parent d7802bc7db
commit 9287439e5a
6 changed files with 87 additions and 33 deletions

View File

@@ -4,6 +4,16 @@
* By default, starts up on port 8484.
*/
// Set log levels before importing anything.
if (!process.env.DEBUG) {
// Be a lot less noisy by default.
setDefaultEnv('GRIST_LOG_LEVEL', 'error');
setDefaultEnv('GRIST_LOG_SKIP_HTTP', 'true');
}
// Use a distinct cookie.
setDefaultEnv('GRIST_SESSION_COOKIE', 'grist_core');
import {updateDb} from 'app/server/lib/dbUtils';
import {main as mergedServerMain} from 'app/server/mergedServerMain';
import * as fse from 'fs-extra';
@@ -19,13 +29,18 @@ function setDefaultEnv(name: string, value: string) {
}
}
// tslint:disable:no-console
export async function main() {
// Use a distinct cookie.
setDefaultEnv('GRIST_SESSION_COOKIE', 'grist_core');
console.log('Welcome to Grist.');
if (!process.env.DEBUG) {
console.log(`In quiet mode, see http://localhost:${G.port} to use.`);
console.log('For full logs, re-run with DEBUG=1');
}
// There's no login system released yet, so set a default email address.
setDefaultEnv('GRIST_DEFAULT_EMAIL', 'support@getgrist.com');
setDefaultEnv('GRIST_DEFAULT_EMAIL', 'you@example.com');
// Set directory for uploaded documents.
setDefaultEnv('GRIST_DATA_DIR', 'data');
setDefaultEnv('GRIST_DATA_DIR', 'docs');
await fse.mkdirp(process.env.GRIST_DATA_DIR!);
// Make a blank db if needed.
await updateDb();
@@ -34,6 +49,5 @@ export async function main() {
}
if (require.main === module) {
// tslint:disable-next-line:no-console
main().catch((err) => console.error(err));
}