-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
133 changed files
with
6,843 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ selenium | |
ui_framework/doc_site/build | ||
!ui_framework/doc_site/build/index.html | ||
yarn.lock | ||
.vscode/ | ||
ts-tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# New platform | ||
|
||
## Dev setup | ||
|
||
``` | ||
npm run ts:start | ||
``` | ||
|
||
This builds the code into `./ts-tmp/` for now. | ||
|
||
**NB** This will show a couple type errors, e.g. something like: | ||
|
||
``` | ||
platform/server/elasticsearch/Cluster.ts(28,17): error TS2339: Property 'close' does not exist on type 'Client'. | ||
platform/server/elasticsearch/Cluster.ts(29,23): error TS2339: Property 'close' does not exist on type 'Client'. | ||
platform/server/http/SslConfig.ts(28,28): error TS2339: Property 'constants' does not exist on type 'typeof "crypto"'. | ||
``` | ||
|
||
This is expected (for now), and it's related to some third-party types. | ||
|
||
## VSCode | ||
|
||
If you want to see what it looks like with fantastic editor support. | ||
|
||
``` | ||
$ cat ~/.vscode/settings.json | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
"typescript.tsdk": "./node_modules/typescript/lib", | ||
"typescript.referencesCodeLens.enabled": true | ||
} | ||
``` | ||
|
||
## Running code | ||
|
||
(Make sure to build the code first, e.g. `npm run ts:build` or `npm run ts:start`) | ||
|
||
Start the server and plugins: | ||
|
||
``` | ||
node scripts/platform.js | ||
``` | ||
|
||
If you update `config/kibana.yml` to e.g. contain `pid.file: ./kibana.pid` | ||
you'll also see it write the PID file. (You can do this while running and just | ||
send a SIGHUP.) | ||
|
||
With failure: | ||
|
||
``` | ||
node scripts/platform.js -c ./config/kibana.dev.yml --port "test" | ||
``` | ||
|
||
## Running tests | ||
|
||
Run Jest: | ||
|
||
``` | ||
node scripts/jest.js | ||
``` | ||
|
||
(add `--watch` for re-running on change) | ||
|
||
|
||
# TODOs | ||
|
||
- Directory structure (I basically haven't given it any thought, yet) | ||
- Better Typescript dev+build setup, included in Webpack et al | ||
- There are still a couple `require`s in the codebase we need to remove. | ||
Some of them seem to be related to `default export` stuff. | ||
- Use `import()` instead of `require` for plugins? | ||
- Types cleanup | ||
- Move types out of "local files" to prepare for external types. This is | ||
already done for a couple things, but not at a proper scale. | ||
- Logging | ||
- Maybe we should look into having the LoggerAdapter implement the | ||
LoggerFactory interface (+ keep the current context). That way you can | ||
easily get a "deeper logger" from the one you already have. | ||
- Log levels in config instead of `silent` et al. | ||
- For the logging that happens before the `upgrade` we should probably just | ||
stream the logs and just stderr them if upgrading fails. So we could start | ||
with a default "StreamLogger" or something like that. | ||
- Fork something like Winston? It feels like all these logging frameworks | ||
are kinda weird and doesn't _really_ fit us, e.g. by having lots of | ||
"default setup" that doesn't fit etc. | ||
- Elasticsearch.js typings needs tons of improvement | ||
- Make `headers` allowed | ||
- `client.close` doesn't exist in the typings | ||
- I think we should fork the existing one into `./packages` and let it | ||
evolve with the rest of the code base. | ||
- Explore ways of handling requests + Elasticsearch.js client | ||
- See `withRequest` in `platform/server/elasticsearch/Cluster.ts` | ||
- Collect coverage from `platform/plugins` | ||
- Need to do way more work on error handling | ||
- REST endpoints incl validation | ||
- Config errors at startup | ||
- Failure in long-running observables | ||
- Maybe explore having "local readmes" that explain the different parts of the | ||
system? E.g. in `./logger` we have a readme that explains how the logger | ||
works. There is an example for the [plugin system][./server/plugins/README.md]. | ||
- Http server | ||
- Stopping the HTTP server is async, which means we can have request that come | ||
in at a "bad time", between stopping the http server and stopping Kibana. | ||
- Validate headers too? Can't validate _all_, but you only receive the | ||
headers you _have_ validated. | ||
- Only `get` is implemented so far, and it's quite ugly, but it has tests. | ||
I didn't do more here before we've talked more about how we want these | ||
to work. |
Oops, something went wrong.