Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
--quiet \
--port 9090 \
--cpu 1 --memory 1G --max-instances 1 --concurrency 80 \
--args="--examples"
--args="run-examples"


- name: Get app URL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
--quiet \
--port 9090 \
--cpu 1 --memory 1G --max-instances 1 --concurrency 80 \
--args="--examples"
--args="run-examples"

- name: Delete previous Docker image(s)
run: |
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Use `connect-druid` command to connect to the existing Druid broker.
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
Expand All @@ -107,7 +107,7 @@ npm run build

### Run project

Run Covid-19 and Wikipedia examples.
Run example datasets.

```
npm run start:examples
Expand All @@ -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
Expand All @@ -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
```


Expand Down
2 changes: 1 addition & 1 deletion bin/turnilo
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../build/server/www.js');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../build/server/cli.js');

require(lib);
25 changes: 22 additions & 3 deletions docs/configuration-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -120,6 +120,25 @@ The url address (http[s]://hostname[:port]) of the cluster. If no port, 80 is as

The host (hostname:port) of the cluster, http protocol is assumed. Deprecated, use **url** field

**auth**

The cluster authorization strategy.

* Http Basic authorization

Strategy will add `Authorization` header to each request to cluster and encode passed username and password with base64.

```yaml
auth:
type: "http-basic"
username: Aladdin
password: OpenSesame
```

This would result in all Druid request having added headers

![](assets/images/basic-auth-headers.png)

**version** (string)

The explicit version to use for this cluster.
Expand Down
5 changes: 3 additions & 2 deletions docs/example/request-decoration/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ clusters:
requestDecorator:
path: './druid-request-decorator.js'
options:
username: Aladdin
password: OpenSesame
base: Pancakes
extras:
- Blueberries

18 changes: 5 additions & 13 deletions docs/example/request-decoration/druid-request-decorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ exports.version = 1;
// * options: the options field from the requestDecorator property
// * cluster: Cluster - the cluster object
exports.druidRequestDecoratorFactory = function (logger, params) {
const options = params.options;
const username = options.username; // pretend we store the username and password
const password = options.password; // in the config

if (!username) {
throw new Error("must have username");
}
if (!password) {
throw new Error("must have password");
}
const options = params.options;
const extras = options.extras.join(", ");

logger.log("Decorator init for username: " + username);
const like = `${options.base} with ${extras}`;

const auth = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
logger.log("Decorator created with options:", { options });

// decoratorRequest: DecoratorRequest - is an object that has the following keys:
// * method: string - the method that is used (POST or GET)
Expand All @@ -27,8 +20,7 @@ exports.druidRequestDecoratorFactory = function (logger, params) {
return function (decoratorRequest) {
const decoration = {
headers: {
"Authorization": auth,
"X-I-Like": "Koalas",
"X-I-Like": like,
},
};

Expand Down
19 changes: 8 additions & 11 deletions docs/extending-turnilo.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ to your `druidRequestDecoratorFactory` under `options` key in second parameter.
druidRequestDecorator:
path: './druid-request-decorator.js'
options:
keyA: valueA
keyB:
- firstElement
- secondElement
base: Pancakes
extras:
- maple-syrup
- blueberries
```

The contract is that your module should export a function `druidRequestDecoratorFactory` that has to return a decorator.
Expand All @@ -46,15 +46,14 @@ exports.version = 1;

exports.druidRequestDecoratorFactory = function (logger, params) {
const options = params.options;
const username = options.username;
const password = options.password;
const extras = options.extras.join(", ");

const auth = "Basic " + Buffer.from(`${username}:${password}`).toString("base64");
const like = `${options.base} with ${extras}`;

return function () {
return {
headers: {
"Authorization": auth
"X-I-Like": auth
},
};
};
Expand All @@ -63,9 +62,7 @@ exports.druidRequestDecoratorFactory = function (logger, params) {

You can find this example with additional comments and example config in the [example](example/request-decoration) folder.

This would result in all Druid requests being tagged as:

![decoration example](example/request-decoration/result.png)
Please note that your object will be merged with [Cluster Authorization](configuration-cluster.md) headers.

## Query decorator

Expand Down
Loading