Skip to content

Commit

Permalink
Merge branch 'master' into fix/url-rewrites-in-dist-styles
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Mar 2, 2020
2 parents a1fc03b + 2998ec0 commit cee81e4
Show file tree
Hide file tree
Showing 118 changed files with 2,020 additions and 5,346 deletions.
5 changes: 5 additions & 0 deletions docs/redirects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ This page has moved. Please see <<reporting-getting-started>>.

This page has moved. Please see <<reporting-getting-started>>.

[role="exclude",id="add-sample-data"]
== Add sample data

This page has moved. Please see <<get-data-in>>.

[role="exclude",id="tilemap"]
== Coordinate map

Expand Down
70 changes: 40 additions & 30 deletions docs/user/getting-started.asciidoc
Original file line number Diff line number Diff line change
@@ -1,54 +1,65 @@
[[getting-started]]
= Getting Started
= Get started

[partintro]
--

You’re new to Kibana and want to give it a try. {kib} has sample data sets and
tutorials to help you get started.
Ready to try out {kib} and see what it can do? To quickest way to get started with {kib} is to set up on Cloud, then add a sample data set that helps you get a handle on the full range of {kib} features.

[float]
=== Sample data
[[cloud-set-up]]
== Set up on Cloud

You can use the <<add-sample-data, sample data
sets>> to take {kib} for a test ride without having
to go through the process of loading data yourself. With one click,
you can install a sample data set and start interacting with
{kib} visualizations in seconds. You can access the sample data
from the {kib} home page.
To access {kib} in a single click, run our hosted Elasticsearch Service on Elastic Cloud.

[float]
. Log into the link:https://cloud.elastic.co/[Elasticsearch Service Console].
If you need an account, register for a link:https://www.elastic.co/cloud/elasticsearch-service/signup[free 14-day trial].

. Click *Create deployment*, then give your deployment a name.

=== Add data tutorials
{kib} has built-in *Add Data* tutorials to help you set up
data flows in the Elastic Stack. These tutorials are available
from the Kibana home page. In *Add Data to Kibana*, find the data type
you’re interested in, and click its button to view a list of available tutorials.
. To use the default options, click *Create deployment*. You can modify the other deployment options, but the default options are great to get started.

Be sure to copy down the password for the `elastic` user and Cloud ID information. You'll need that later.

[float]
=== Hands-on experience
[[get-data-in]]
== Get data into {kib}

The easiest way to get data into {kib} is to add a sample data set.

{kib} has several sample data sets that you can use before loading your own data:

* *Sample eCommerce orders* includes visualizations for tracking product-related information,
such as cost, revenue, and price.

* *Sample flight data* includes visualizations for monitoring flight routes.

The following tutorials walk you through searching, analyzing,
and visualizing data.
* *Sample web logs* includes visualizations for monitoring website traffic.

* <<tutorial-sample-data, Explore Kibana using sample data>>. You'll
learn to filter and query data, edit visualizations, and interact with dashboards.
To use the sample data sets:

* <<tutorial-build-dashboard, Build your own dashboard>>. You'll manually load a data set and build
your own visualizations and dashboard.
. Go to the {kib} home page.

. Click *Load a data set and a {kib} dashboard*.

. Click *View data* and view the prepackaged dashboards, maps, and more.

[role="screenshot"]
image::images/add-sample-data.png[]

NOTE: The timestamps in the sample data sets are relative to when they are installed.
If you uninstall and reinstall a data set, the timestamps change to reflect the most recent installation.

[float]
=== Before you begin
[[getting-started-next-steps]]
== Next steps

Make sure you've <<install, installed Kibana>> and established
a <<connect-to-elasticsearch, connection to Elasticsearch>>.
* To get a hands-on experience creating visualizations, follow the <<tutorial-sample-data, add sample data>> tutorial.

If you are running our hosted Elasticsearch Service on Elastic Cloud, you access Kibana with a single click. (You can {ess-trial}[sign up for a free trial] and start exploring data in minutes.)
* If you're ready to load an actual data set and build a dashboard, follow the <<tutorial-build-dashboard, build your own dashboard>> tutorial.

--

include::{kib-repo-dir}/getting-started/add-sample-data.asciidoc[]

include::{kib-repo-dir}/getting-started/tutorial-sample-data.asciidoc[]

include::{kib-repo-dir}/getting-started/tutorial-full-experience.asciidoc[]
Expand All @@ -60,4 +71,3 @@ include::{kib-repo-dir}/getting-started/tutorial-discovering.asciidoc[]
include::{kib-repo-dir}/getting-started/tutorial-visualizing.asciidoc[]

include::{kib-repo-dir}/getting-started/tutorial-dashboard.asciidoc[]

4 changes: 2 additions & 2 deletions docs/user/index.asciidoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include::introduction.asciidoc[]

include::getting-started.asciidoc[]

include::setup.asciidoc[]

include::monitoring/configuring-monitoring.asciidoc[]

include::security/securing-kibana.asciidoc[]

include::getting-started.asciidoc[]

include::discover.asciidoc[]

include::visualize.asciidoc[]
Expand Down
22 changes: 0 additions & 22 deletions src/cli/dev_ssl.js

This file was deleted.

12 changes: 5 additions & 7 deletions src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import { getConfigPath } from '../../core/server/path';
import { bootstrap } from '../../core/server';
import { readKeystore } from './read_keystore';

import { DEV_SSL_CERT_PATH, DEV_SSL_KEY_PATH } from '../dev_ssl';

function canRequire(path) {
try {
require.resolve(path);
Expand Down Expand Up @@ -90,7 +88,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {

if (opts.ssl) {
// @kbn/dev-utils is part of devDependencies
const { CA_CERT_PATH } = require('@kbn/dev-utils');
const { CA_CERT_PATH, KBN_KEY_PATH, KBN_CERT_PATH } = require('@kbn/dev-utils');
const customElasticsearchHosts = opts.elasticsearch
? opts.elasticsearch.split(',')
: [].concat(get('elasticsearch.hosts') || []);
Expand All @@ -104,6 +102,7 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
ensureNotDefined('server.ssl.key');
ensureNotDefined('server.ssl.keystore.path');
ensureNotDefined('server.ssl.truststore.path');
ensureNotDefined('server.ssl.certificateAuthorities');
ensureNotDefined('elasticsearch.ssl.certificateAuthorities');

const elasticsearchHosts = (
Expand All @@ -121,10 +120,9 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
});

set('server.ssl.enabled', true);
// TODO: change this cert/key to KBN_CERT_PATH and KBN_KEY_PATH from '@kbn/dev-utils'; will require some work to avoid breaking
// functional tests. Once that is done, the existing test cert/key at DEV_SSL_CERT_PATH and DEV_SSL_KEY_PATH can be deleted.
set('server.ssl.certificate', DEV_SSL_CERT_PATH);
set('server.ssl.key', DEV_SSL_KEY_PATH);
set('server.ssl.certificate', KBN_CERT_PATH);
set('server.ssl.key', KBN_KEY_PATH);
set('server.ssl.certificateAuthorities', CA_CERT_PATH);
set('elasticsearch.hosts', elasticsearchHosts);
set('elasticsearch.ssl.certificateAuthorities', CA_CERT_PATH);
}
Expand Down
133 changes: 99 additions & 34 deletions src/core/server/elasticsearch/elasticsearch_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import { ElasticsearchService } from './elasticsearch_service';
import { elasticsearchServiceMock } from './elasticsearch_service.mock';
import { duration } from 'moment';

const delay = async (durationMs: number) =>
await new Promise(resolve => setTimeout(resolve, durationMs));

let elasticsearchService: ElasticsearchService;
const configService = configServiceMock.create();
const deps = {
Expand All @@ -42,7 +45,7 @@ configService.atPath.mockReturnValue(
new BehaviorSubject({
hosts: ['http://1.2.3.4'],
healthCheck: {
delay: duration(2000),
delay: duration(10),
},
ssl: {
verificationMode: 'none',
Expand Down Expand Up @@ -125,21 +128,21 @@ describe('#setup', () => {

const config = MockClusterClient.mock.calls[0][0];
expect(config).toMatchInlineSnapshot(`
Object {
"healthCheckDelay": "PT2S",
"hosts": Array [
"http://8.8.8.8",
],
"logQueries": true,
"requestHeadersWhitelist": Array [
undefined,
],
"ssl": Object {
"certificate": "certificate-value",
"verificationMode": "none",
},
}
`);
Object {
"healthCheckDelay": "PT0.01S",
"hosts": Array [
"http://8.8.8.8",
],
"logQueries": true,
"requestHeadersWhitelist": Array [
undefined,
],
"ssl": Object {
"certificate": "certificate-value",
"verificationMode": "none",
},
}
`);
});
it('falls back to elasticsearch config if custom config not passed', async () => {
const setupContract = await elasticsearchService.setup(deps);
Expand All @@ -150,24 +153,24 @@ Object {

const config = MockClusterClient.mock.calls[0][0];
expect(config).toMatchInlineSnapshot(`
Object {
"healthCheckDelay": "PT2S",
"hosts": Array [
"http://1.2.3.4",
],
"requestHeadersWhitelist": Array [
undefined,
],
"ssl": Object {
"alwaysPresentCertificate": undefined,
"certificate": undefined,
"certificateAuthorities": undefined,
"key": undefined,
"keyPassphrase": undefined,
"verificationMode": "none",
},
}
`);
Object {
"healthCheckDelay": "PT0.01S",
"hosts": Array [
"http://1.2.3.4",
],
"requestHeadersWhitelist": Array [
undefined,
],
"ssl": Object {
"alwaysPresentCertificate": undefined,
"certificate": undefined,
"certificateAuthorities": undefined,
"key": undefined,
"keyPassphrase": undefined,
"verificationMode": "none",
},
}
`);
});

it('does not merge elasticsearch hosts if custom config overrides', async () => {
Expand Down Expand Up @@ -213,6 +216,45 @@ Object {
`);
});
});

it('esNodeVersionCompatibility$ only starts polling when subscribed to', async done => {
const mockAdminClusterClientInstance = elasticsearchServiceMock.createClusterClient();
const mockDataClusterClientInstance = elasticsearchServiceMock.createClusterClient();
MockClusterClient.mockImplementationOnce(
() => mockAdminClusterClientInstance
).mockImplementationOnce(() => mockDataClusterClientInstance);

mockAdminClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error());

const setupContract = await elasticsearchService.setup(deps);
await delay(10);

expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(0);
setupContract.esNodesCompatibility$.subscribe(() => {
expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1);
done();
});
});

it('esNodeVersionCompatibility$ stops polling when unsubscribed from', async done => {
const mockAdminClusterClientInstance = elasticsearchServiceMock.createClusterClient();
const mockDataClusterClientInstance = elasticsearchServiceMock.createClusterClient();
MockClusterClient.mockImplementationOnce(
() => mockAdminClusterClientInstance
).mockImplementationOnce(() => mockDataClusterClientInstance);

mockAdminClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error());

const setupContract = await elasticsearchService.setup(deps);

expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(0);
const sub = setupContract.esNodesCompatibility$.subscribe(async () => {
sub.unsubscribe();
await delay(100);
expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1);
done();
});
});
});

describe('#stop', () => {
Expand All @@ -229,4 +271,27 @@ describe('#stop', () => {
expect(mockAdminClusterClientInstance.close).toHaveBeenCalledTimes(1);
expect(mockDataClusterClientInstance.close).toHaveBeenCalledTimes(1);
});

it('stops pollEsNodeVersions even if there are active subscriptions', async done => {
expect.assertions(2);
const mockAdminClusterClientInstance = elasticsearchServiceMock.createCustomClusterClient();
const mockDataClusterClientInstance = elasticsearchServiceMock.createCustomClusterClient();

MockClusterClient.mockImplementationOnce(
() => mockAdminClusterClientInstance
).mockImplementationOnce(() => mockDataClusterClientInstance);

mockAdminClusterClientInstance.callAsInternalUser.mockRejectedValue(new Error());

const setupContract = await elasticsearchService.setup(deps);

setupContract.esNodesCompatibility$.subscribe(async () => {
expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1);

await elasticsearchService.stop();
await delay(100);
expect(mockAdminClusterClientInstance.callAsInternalUser).toHaveBeenCalledTimes(1);
done();
});
});
});
Loading

0 comments on commit cee81e4

Please sign in to comment.