Skip to content

Commit

Permalink
Merge branch 'main' into siem-explore-issue-119024
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Dec 6, 2021
2 parents d531c48 + 957c006 commit 5d9e112
Show file tree
Hide file tree
Showing 124 changed files with 9,360 additions and 5,780 deletions.
73 changes: 49 additions & 24 deletions docs/setup/docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ https://github.com/elastic/dockerfiles/tree/{branch}/kibana[GitHub].
These images contain both free and subscription features.
<<managing-licenses,Start a 30-day trial>> to try out all of the features.

[float]
[discrete]
[[run-kibana-on-docker-for-dev]]
=== Run {kib} on Docker for development

. Start an {es} container for development or testing:
+
--
ifeval::["{release-state}"=="unreleased"]

NOTE: No Docker images are currently available for {kib} {version}.
Expand All @@ -26,14 +29,16 @@ endif::[]

ifeval::["{release-state}"!="unreleased"]

. Start an {es} container for development or testing:
+
[source,sh,subs="attributes"]
----
docker network create elastic
docker pull {es-docker-image}
docker run --name es-node01 --net elastic -p 9200:9200 -p 9300:9300 -t {es-docker-image}
----

endif::[]

--
+
When you start {es} for the first time, the following security configuration
occurs automatically:
Expand All @@ -51,30 +56,26 @@ and enrollment token.
. Copy the generated password and enrollment token and save them in a secure
location. These values are shown only when you start {es} for the first time.
You'll use these to enroll {kib} with your {es} cluster and log in.

. In a new terminal session, start {kib} and connect it to your {es} container:
+
[NOTE]
====
If you need to reset the password for the `elastic` user or other
built-in users, run the {ref}/reset-password.html[`elasticsearch-reset-password`]
tool. To generate new enrollment tokens for {kib} or {es} nodes, run the
{ref}/create-enrollment-token.html[`elasticsearch-create-enrollment-token`] tool.
These tools are available in the {es} `bin` directory of the Docker container.
--
ifeval::["{release-state}"=="unreleased"]

For example:
NOTE: No Docker images are currently available for {kib} {version}.

[source,sh]
----
docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
----
====
endif::[]

ifeval::["{release-state}"!="unreleased"]

. In a new terminal session, start {kib} and connect it to your {es} container:
+
[source,sh,subs="attributes"]
----
docker pull {docker-image}
docker run --name kib-01 --net elastic -p 5601:5601 {docker-image}
----

endif::[]
--
+
When you start {kib}, a unique link is output to your terminal.

Expand All @@ -86,7 +87,32 @@ When you start {kib}, a unique link is output to your terminal.
.. Log in to {kib} as the `elastic` user with the password that was generated
when you started {es}.

[float]
[[docker-generate]]
[discrete]
=== Generate passwords and enrollment tokens
If you need to reset the password for the `elastic` user or other
built-in users, run the {ref}/reset-password.html[`elasticsearch-reset-password`]
tool. This tool is available in the {es} `bin` directory of the Docker container.

For example, to reset the password for the `elastic` user:

[source,sh]
----
docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
----

If you need to generate new enrollment tokens for {kib} or {es} nodes, run the
{ref}/create-enrollment-token.html[`elasticsearch-create-enrollment-token`] tool.
This tool is available in the {es} `bin` directory of the Docker container.

For example, to generate a new enrollment token for {kib}:

[source,sh]
----
docker exec -it es-node01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
----

[discrete]
=== Remove Docker containers

To remove the containers and their network, run:
Expand All @@ -98,8 +124,7 @@ docker rm es-node01
docker rm kib-01
----

endif::[]
[float]
[discrete]
[[configuring-kibana-docker]]
=== Configure Kibana on Docker

Expand All @@ -108,7 +133,7 @@ conventional approach is to provide a `kibana.yml` file as described in
{kibana-ref}/settings.html[Configuring Kibana], but it's also possible to use
environment variables to define settings.

[float]
[discrete]
[[bind-mount-config]]
==== Bind-mounted configuration

Expand All @@ -135,7 +160,7 @@ docker run -it --rm -v full_path_to/config:/usr/share/kibana/config -v full_path
docker run -it --rm -v full_path_to/config:/usr/share/kibana/config -v full_path_to/data:/usr/share/kibana/data {docker-image} bin/kibana-keystore add test_keystore_setting
----

[float]
[discrete]
[[environment-variable-config]]
==== Environment variable configuration

Expand Down Expand Up @@ -179,7 +204,7 @@ services:
Since environment variables are translated to CLI arguments, they take
precedence over settings configured in `kibana.yml`.

[float]
[discrete]
[[docker-defaults]]
==== Docker defaults
The following settings have different default values when using the Docker
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"@elastic/apm-rum": "^5.9.1",
"@elastic/apm-rum-react": "^1.3.1",
"@elastic/apm-synthtrace": "link:bazel-bin/packages/elastic-apm-synthtrace",
"@elastic/charts": "40.0.0",
"@elastic/charts": "40.1.0",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.35",
"@elastic/ems-client": "8.0.0",
Expand Down Expand Up @@ -197,7 +197,7 @@
"axios": "^0.21.1",
"base64-js": "^1.3.1",
"brace": "0.11.1",
"broadcast-channel": "^4.5.0",
"broadcast-channel": "^4.7.0",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.10",
"chokidar": "^3.4.3",
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/expression_image/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"server": true,
"ui": true,
"requiredPlugins": ["expressions", "presentationUtil"],
"optionalPlugins": []
"optionalPlugins": [],
"requiredBundles": ["kibanaReact"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Render, waitFor } from '../../../../presentation_util/public/__stories__';
import { imageRenderer } from '../image_renderer';
import { getImageRenderer } from '../image_renderer';
import { getElasticLogo } from '../../../../../../src/plugins/presentation_util/common/lib';
import { ImageMode } from '../../../common';

Expand All @@ -19,7 +19,7 @@ const Renderer = ({ elasticLogo }: { elasticLogo: string }) => {
mode: ImageMode.COVER,
};

return <Render renderer={imageRenderer} config={config} width="500px" height="500px" />;
return <Render renderer={getImageRenderer()} config={config} width="500px" height="500px" />;
};

storiesOf('renderers/image', module).add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { ExpressionRenderDefinition, IInterpreterRenderHandlers } from 'src/plugins/expressions';
import { i18n } from '@kbn/i18n';
import { getElasticLogo, isValidUrl } from '../../../presentation_util/public';
import { Observable } from 'rxjs';
import { CoreTheme } from 'kibana/public';
import { CoreSetup } from '../../../../core/public';
import { KibanaThemeProvider } from '../../../kibana_react/public';
import { getElasticLogo, isValidUrl, defaultTheme$ } from '../../../presentation_util/public';
import { ImageRendererConfig } from '../../common/types';

const strings = {
Expand All @@ -23,31 +27,41 @@ const strings = {
}),
};

export const imageRenderer = (): ExpressionRenderDefinition<ImageRendererConfig> => ({
name: 'image',
displayName: strings.getDisplayName(),
help: strings.getHelpDescription(),
reuseDomNode: true,
render: async (
domNode: HTMLElement,
config: ImageRendererConfig,
handlers: IInterpreterRenderHandlers
) => {
const { elasticLogo } = await getElasticLogo();
const dataurl = isValidUrl(config.dataurl ?? '') ? config.dataurl : elasticLogo;
export const getImageRenderer =
(theme$: Observable<CoreTheme> = defaultTheme$) =>
(): ExpressionRenderDefinition<ImageRendererConfig> => ({
name: 'image',
displayName: strings.getDisplayName(),
help: strings.getHelpDescription(),
reuseDomNode: true,
render: async (
domNode: HTMLElement,
config: ImageRendererConfig,
handlers: IInterpreterRenderHandlers
) => {
const { elasticLogo } = await getElasticLogo();
const dataurl = isValidUrl(config.dataurl ?? '') ? config.dataurl : elasticLogo;

const style = {
height: '100%',
backgroundImage: `url(${dataurl})`,
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center center',
backgroundSize: config.mode as string,
};
const style = {
height: '100%',
backgroundImage: `url(${dataurl})`,
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center center',
backgroundSize: config.mode as string,
};

handlers.onDestroy(() => {
unmountComponentAtNode(domNode);
});
handlers.onDestroy(() => {
unmountComponentAtNode(domNode);
});

render(<div style={style} />, domNode, () => handlers.done());
},
});
render(
<KibanaThemeProvider theme$={theme$}>
<div style={style} />
</KibanaThemeProvider>,
domNode,
() => handlers.done()
);
},
});

export const imageRendererFactory = (core: CoreSetup) => getImageRenderer(core.theme.theme$);
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@
* Side Public License, v 1.
*/

import { imageRenderer } from './image_renderer';

export const renderers = [imageRenderer];

export { imageRenderer };
export { imageRendererFactory, getImageRenderer } from './image_renderer';
5 changes: 1 addition & 4 deletions src/plugins/expression_image/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* Side Public License, v 1.
*/

// TODO: https://github.com/elastic/kibana/issues/110893
/* eslint-disable @kbn/eslint/no_export_all */

import { ExpressionImagePlugin } from './plugin';

export type { ExpressionImagePluginSetup, ExpressionImagePluginStart } from './plugin';
Expand All @@ -17,4 +14,4 @@ export function plugin() {
return new ExpressionImagePlugin();
}

export * from './expression_renderers';
export { imageRendererFactory, getImageRenderer } from './expression_renderers';
4 changes: 2 additions & 2 deletions src/plugins/expression_image/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { CoreSetup, CoreStart, Plugin } from '../../../core/public';
import { ExpressionsStart, ExpressionsSetup } from '../../expressions/public';
import { imageRenderer } from './expression_renderers';
import { imageRendererFactory } from './expression_renderers';
import { imageFunction } from '../common/expression_functions';

interface SetupDeps {
Expand All @@ -27,7 +27,7 @@ export class ExpressionImagePlugin
{
public setup(core: CoreSetup, { expressions }: SetupDeps): ExpressionImagePluginSetup {
expressions.registerFunction(imageFunction);
expressions.registerRenderer(imageRenderer);
expressions.registerRenderer(imageRendererFactory(core));
}

public start(core: CoreStart): ExpressionImagePluginStart {}
Expand Down
29 changes: 25 additions & 4 deletions src/plugins/expression_shape/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,31 @@
* Side Public License, v 1.
*/

// TODO: https://github.com/elastic/kibana/issues/110893
/* eslint-disable @kbn/eslint/no_export_all */
export {
PLUGIN_ID,
PLUGIN_NAME,
SVG,
CSS,
FONT_FAMILY,
FONT_WEIGHT,
BOOLEAN_TRUE,
BOOLEAN_FALSE,
} from './constants';

export * from './constants';
export * from './types';
export type {
Output,
ExpressionShapeFunction,
ProgressArguments,
ProgressOutput,
ExpressionProgressFunction,
OriginString,
ShapeRendererConfig,
NodeDimensions,
ParentNodeParams,
ViewBoxParams,
ProgressRendererConfig,
} from './types';

export { Progress, Shape } from './types';

export { getAvailableShapes, getAvailableProgressShapes } from './lib/available_shapes';
20 changes: 18 additions & 2 deletions src/plugins/expression_shape/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,21 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
export * from './expression_functions';
export * from './expression_renderers';

export type {
Output,
ExpressionShapeFunction,
ProgressArguments,
ProgressOutput,
ExpressionProgressFunction,
} from './expression_functions';
export { Progress, Shape } from './expression_functions';

export type {
OriginString,
ShapeRendererConfig,
NodeDimensions,
ParentNodeParams,
ViewBoxParams,
ProgressRendererConfig,
} from './expression_renderers';
2 changes: 1 addition & 1 deletion src/plugins/expression_shape/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"extraPublicDirs": ["common"],
"requiredPlugins": ["expressions", "presentationUtil"],
"optionalPlugins": [],
"requiredBundles": []
"requiredBundles": ["kibanaReact"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { Render } from '../../../../presentation_util/public/__stories__';
import { progressRenderer } from '../progress_renderer';
import { getProgressRenderer } from '../progress_renderer';
import { Progress } from '../../../common';

storiesOf('renderers/progress', module).add('default', () => {
Expand All @@ -29,5 +29,5 @@ storiesOf('renderers/progress', module).add('default', () => {
valueWeight: 15,
};

return <Render renderer={progressRenderer} config={config} />;
return <Render renderer={getProgressRenderer()} config={config} />;
});
Loading

0 comments on commit 5d9e112

Please sign in to comment.