From 64542485fd31622977db21407efe9d1e4ae7a997 Mon Sep 17 00:00:00 2001 From: Adrian Mroz Date: Mon, 14 Nov 2022 16:39:21 +0100 Subject: [PATCH 1/6] more documentation --- README.md | 20 ++++++++++---------- src/server/cli.ts | 18 ++++++++++++------ src/server/cli/options.ts | 33 +++++++++++++++++++++++++++------ 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 873359eb5..154088147 100644 --- a/README.md +++ b/README.md @@ -72,18 +72,18 @@ Install Turnilo distribution using [npm](https://www.npmjs.com/). npm install -g turnilo ``` -Start off by running an example with Covid-19 and Wikipedia datasets +Start off by running turnilo with example datasets and open [http://localhost:9090/](http://localhost:9090/). ``` -turnilo --examples +turnilo run-examples ``` -Or connect to the existing Druid broker using `--druid` command line option. +Or connect to the existing Druid broker using `connect-druid` command. Turnilo will automatically introspect your Druid broker and figure out available datasets. ``` -turnilo --druid http[s]://druid-broker-hostname[:port] +turnilo connect-druid http[s]://druid-broker-hostname[:port] ``` ## Documentation @@ -107,7 +107,7 @@ npm run build ### Run project -Run Covid-19 and Wikipedia examples. +Run example datasets. ``` npm run start:examples @@ -116,20 +116,20 @@ npm run start:examples Connect to the existing Druid broker. ``` -npm run start -- --druid http[s]://druid-broker-hostname[:port] +npm run start -- connect-druid http[s]://druid-broker-hostname[:port] ``` Connect to the existing Druid broker using your config file. ``` -npm run start -- --config path/to/config.yml +npm run start -- run-config path/to/config.yml ``` ### Run project in developer mode Every change in frontend code would recompile project and reload page. -Run Covid-19 and Wikipedia examples. +Run example datasets. ``` npm run start:dev:examples @@ -138,13 +138,13 @@ npm run start:dev:examples Connect to the existing Druid broker. ``` -npm run start:dev -- --druid http[s]://druid-broker-hostname[:port] +npm run start:dev -- connect-druid http[s]://druid-broker-hostname[:port] ``` Connect to the existing Druid broker using your config file. ``` -npm run start:dev -- --config path/to/config.yml +npm run start:dev -- run-config path/to/config.yml ``` diff --git a/src/server/cli.ts b/src/server/cli.ts index 1e64f8691..09c578658 100644 --- a/src/server/cli.ts +++ b/src/server/cli.ts @@ -45,7 +45,8 @@ program program .command("run-config") - .argument("", "path of config file") + .description("Runs Turnilo using config file") + .argument("", "Path to config file") .addOption(portOption) .addOption(serverRootOption) .addOption(serverHostOption) @@ -74,6 +75,7 @@ program program .command("run-examples") + .description("Runs Turnilo with example datasets") .addOption(portOption) .addOption(serverRootOption) .addOption(serverHostOption) @@ -95,7 +97,8 @@ program program .command("connect-druid") - .argument("", "druid url") + .description("Runs turnilo that connects to Druid cluster and introspects it for datasets") + .argument("", "Url of Druid cluster") .addOption(portOption) .addOption(serverRootOption) .addOption(serverHostOption) @@ -116,8 +119,9 @@ program program .command("load-file") - .argument("", "json file") - .requiredOption("-t, --time-attribute ", "time attribute") + .description("Runs turnilo and loads json file as a dataset") + .argument("", "Path to json file with data") + .requiredOption("-t, --time-attribute ", "JSON field name with time column") .addOption(portOption) .addOption(serverRootOption) .addOption(serverHostOption) @@ -140,7 +144,8 @@ program program .command("verify-config") - .argument("", "path to config file") + .description("Runs verification of provided config file") + .argument("", "Path to config file to verify") .addOption(verboseOption) .action((file, { verbose }) => { try { @@ -153,7 +158,8 @@ program program .command("introspect-druid") - .argument("", "druid url") + .description("Connects to Druid cluster and prints introspected data in config file format") + .argument("", "Url of Druid cluster") .addOption(verboseOption) .addOption(usernameOption) .addOption(passwordOption) diff --git a/src/server/cli/options.ts b/src/server/cli/options.ts index 51f9c1f68..392311f80 100644 --- a/src/server/cli/options.ts +++ b/src/server/cli/options.ts @@ -15,11 +15,32 @@ */ import { Option } from "commander"; +import { DEFAULT_PORT } from "../models/server-settings/server-settings"; import { parseInteger } from "./utils"; -export const portOption = new Option("-p, --port ", "port number").argParser(parseInteger); -export const serverRootOption = new Option("--server-root ", "server root"); -export const serverHostOption = new Option("--server-host ", "server host"); -export const verboseOption = new Option("--verbose", "verbose mode"); -export const usernameOption = new Option("--username ", "username"); -export const passwordOption = new Option("--password ", "password"); +export const portOption = new Option( + "-p, --port ", + `Port number to start server on. Default: ${DEFAULT_PORT}` +).argParser(parseInteger); + +export const serverRootOption = new Option( + "--server-root ", + "Custom path to act as turnilo root" +); +export const serverHostOption = new Option( + "--server-host ", + "Hast that server will bind to" +); +export const verboseOption = new Option( + "--verbose", + "Verbose mode" +); + +export const usernameOption = new Option( + "--username ", + "Username that will be used in HTTP Basic authentication to Druid cluster" +); +export const passwordOption = new Option( + "--password ", + "Password that will be used in HTTP Basic authentication to Druid cluster" +); From e475401471cd9d23e0e76a0250cf074fe953e713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Mr=C3=B3=C5=BA?= <78143552+adrianmroz-allegro@users.noreply.github.com> Date: Tue, 15 Nov 2022 09:24:10 +0100 Subject: [PATCH 2/6] Update src/server/cli/options.ts Co-authored-by: Marcin Kuthan --- src/server/cli/options.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/cli/options.ts b/src/server/cli/options.ts index 392311f80..8f1cb0a78 100644 --- a/src/server/cli/options.ts +++ b/src/server/cli/options.ts @@ -29,7 +29,7 @@ export const serverRootOption = new Option( ); export const serverHostOption = new Option( "--server-host ", - "Hast that server will bind to" + "Host that server will bind to" ); export const verboseOption = new Option( "--verbose", From 58052afda80045bc88fd0c6f33bf380077d57081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Mr=C3=B3=C5=BA?= <78143552+adrianmroz-allegro@users.noreply.github.com> Date: Tue, 15 Nov 2022 09:24:19 +0100 Subject: [PATCH 3/6] Update src/server/cli.ts Co-authored-by: Marcin Kuthan --- src/server/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/cli.ts b/src/server/cli.ts index 09c578658..debd9a73b 100644 --- a/src/server/cli.ts +++ b/src/server/cli.ts @@ -119,7 +119,7 @@ program program .command("load-file") - .description("Runs turnilo and loads json file as a dataset") + .description("Runs Turnilo and loads json file as a dataset") .argument("", "Path to json file with data") .requiredOption("-t, --time-attribute ", "JSON field name with time column") .addOption(portOption) From 298889f232044b2d09581910dd07c4ef66a9cb19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Mr=C3=B3=C5=BA?= <78143552+adrianmroz-allegro@users.noreply.github.com> Date: Tue, 15 Nov 2022 09:24:37 +0100 Subject: [PATCH 4/6] Update README.md Co-authored-by: Marcin Kuthan --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 154088147..16c5e375c 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Install Turnilo distribution using [npm](https://www.npmjs.com/). npm install -g turnilo ``` -Start off by running turnilo with example datasets +Start off by running Turnilo with example datasets and open [http://localhost:9090/](http://localhost:9090/). ``` From 906e654b449d85080a6542e9ee17fdc6b35983ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Mr=C3=B3=C5=BA?= <78143552+adrianmroz-allegro@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:36:07 +0100 Subject: [PATCH 5/6] Update README.md Co-authored-by: Piotr Szczepanik --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16c5e375c..1d5cd7e54 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ and open [http://localhost:9090/](http://localhost:9090/). turnilo run-examples ``` -Or connect to the existing Druid broker using `connect-druid` command. +Use `connect-druid` command to connect to the existing Druid broker. Turnilo will automatically introspect your Druid broker and figure out available datasets. ``` From fa877588a9bed69674ccded74656bd2623c63c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Mr=C3=B3=C5=BA?= <78143552+adrianmroz-allegro@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:39:37 +0100 Subject: [PATCH 6/6] update more docs --- docs/configuration-cluster.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/configuration-cluster.md b/docs/configuration-cluster.md index 03cadd2c5..d1b58c64b 100644 --- a/docs/configuration-cluster.md +++ b/docs/configuration-cluster.md @@ -6,7 +6,7 @@ layout: page ## Overview -It is easy to start using Turnilo with Druid by pointing it at your Druid cluster: `turnilo --druid broker_host:broker_port` +It is easy to start using Turnilo with Druid by pointing it at your Druid cluster: `turnilo connect-druid broker_host:broker_port` Turnilo will automatically introspect your Druid cluster and figure out available datasets. Turnilo can be configured with a *config* YAML file. While you could write one from scratch it is recommended to let @@ -15,13 +15,13 @@ Turnilo give you a head start by using it to generate a config file for you usin Run: ```bash -turnilo --druid broker_host:broker_port --print-config --with-comments > config.yaml +turnilo introspect-druid broker_host:broker_port --verbose > config.yaml ``` This will cause Turnilo to go through its normal startup and introspection routine and then dump the internally generated config (complete with comments) into the provided file. -You can now run `turnilo --config config.yaml` to run Turnilo with your config. +You can now run `turnilo run-config config.yaml` to run Turnilo with your config. The next step is to open the generated config file in your favourite text editor and configure Turnilo to your liking. Below we will go through a typical configuration flow. At any point you can save the config and re-launch Turnilo to load