Skip to content

Commit 0a516cf

Browse files
Improvements to our developer guide (#67764)
* contributing guide -> asciidoc * Update docs/developer/contributing/index.asciidoc Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com> * Update CONTRIBUTING.md Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com> * Update docs/developer/best-practices/stability.asciidoc Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com> * Update docs/developer/contributing/index.asciidoc Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com> * address code review comments * Update docs/developer/contributing/development-documentation.asciidoc Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com> * review comment updates * fix bad ref Co-authored-by: Peter Schretlen <peter.schretlen@gmail.com>
1 parent ddd3a9d commit 0a516cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1629
-1285
lines changed

CONTRIBUTING.md

+2-736
Large diffs are not rendered by default.

docs/developer/add-data-guide.asciidoc

-38
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[[development-basepath]]
2+
=== Considerations for basepath
3+
4+
In dev mode, {kib} by default runs behind a proxy which adds a random path component to its URL.
5+
6+
You can set this explicitly using `server.basePath` in <<settings>>.
7+
8+
Use the server.rewriteBasePath setting to tell {kib} if it should remove the basePath from requests it receives, and to prevent a deprecation warning at startup. This setting cannot end in a slash (/).
9+
10+
If you want to turn off the basepath when in development mode, start {kib} with the `--no-basepath` flag
11+
12+
[source,bash]
13+
----
14+
yarn start --no-basepath
15+
----
16+
17+
18+

docs/developer/core/development-es-snapshots.asciidoc docs/developer/advanced/development-es-snapshots.asciidoc

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
[[development-es-snapshots]]
22
=== Daily Elasticsearch Snapshots
33

4-
For local development and CI, Kibana, by default, uses Elasticsearch snapshots that are built daily when running tasks that require Elasticsearch (e.g. functional tests).
4+
For local development and CI, {kib}, by default, uses Elasticsearch snapshots that are built daily when running tasks that require Elasticsearch (e.g. functional tests).
55

66
A snapshot is just a group of tarballs, one for each supported distribution/architecture/os of Elasticsearch, and a JSON-based manifest file containing metadata about the distributions.
77

88
https://ci.kibana.dev/es-snapshots[A dashboard] is available that shows the current status and compatibility of the latest Elasticsearch snapshots.
99

1010
==== Process Overview
1111

12-
1. Elasticsearch snapshots are built for each current tracked branch of Kibana.
12+
1. Elasticsearch snapshots are built for each current tracked branch of {kib}.
1313
2. Each snapshot is uploaded to a public Google Cloud Storage bucket, `kibana-ci-es-snapshots-daily`.
1414
** At this point, the snapshot is not automatically used in CI or local development. It needs to be tested/verified first.
15-
3. Each snapshot is tested with the latest commit of the corresponding Kibana branch, using the full CI suite.
15+
3. Each snapshot is tested with the latest commit of the corresponding {kib} branch, using the full CI suite.
1616
4. After CI
1717
** If the snapshot passes, it is promoted and automatically used in CI and local development.
18-
** If the snapshot fails, the issue must be investigated and resolved. A new incompatibility may exist between Elasticsearch and Kibana.
18+
** If the snapshot fails, the issue must be investigated and resolved. A new incompatibility may exist between Elasticsearch and {kib}.
1919

2020
==== Using the latest snapshot
2121

@@ -39,7 +39,7 @@ KBN_ES_SNAPSHOT_USE_UNVERIFIED=true node scripts/functional_tests_server
3939

4040
Currently, there is not a way to run your pull request with the latest unverified snapshot without a code change. You can, however, do it with a small code change.
4141

42-
1. Edit `Jenkinsfile` in the root of the Kibana repo
42+
1. Edit `Jenkinsfile` in the root of the {kib} repo
4343
2. Add `env.KBN_ES_SNAPSHOT_USE_UNVERIFIED = 'true'` at the top of the file.
4444
3. Commit the change
4545

@@ -75,13 +75,13 @@ The file structure for this bucket looks like this:
7575

7676
==== How snapshots are built, tested, and promoted
7777

78-
Each day, a https://kibana-ci.elastic.co/job/elasticsearch+snapshots+trigger/[Jenkins job] runs that triggers Elasticsearch builds for each currently tracked branch/version. This job is automatically updated with the correct branches whenever we release new versions of Kibana.
78+
Each day, a https://kibana-ci.elastic.co/job/elasticsearch+snapshots+trigger/[Jenkins job] runs that triggers Elasticsearch builds for each currently tracked branch/version. This job is automatically updated with the correct branches whenever we release new versions of {kib}.
7979

8080
===== Build
8181

8282
https://kibana-ci.elastic.co/job/elasticsearch+snapshots+build/[This Jenkins job] builds the Elasticsearch snapshots and uploads them to GCS.
8383

84-
The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/master/.ci/es-snapshots/Jenkinsfile_build_es[in the kibana repo].
84+
The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/master/.ci/es-snapshots/Jenkinsfile_build_es[in the {kib} repo].
8585

8686
1. Checkout Elasticsearch repo for the given branch/version.
8787
2. Run `./gradlew -p distribution/archives assemble --parallel` to create all of the Elasticsearch distributions.
@@ -91,15 +91,15 @@ The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/ma
9191
** e.g. `<version>/archives/<unique id>`
9292
6. Replace `<version>/manifest-latest.json` in GCS with this newest manifest.
9393
** This allows the `KBN_ES_SNAPSHOT_USE_UNVERIFIED` flag to work.
94-
7. Trigger the verification job, to run the full Kibana CI test suite with this snapshot.
94+
7. Trigger the verification job, to run the full {kib} CI test suite with this snapshot.
9595

9696
===== Verification and Promotion
9797

98-
https://kibana-ci.elastic.co/job/elasticsearch+snapshots+verify/[This Jenkins job] tests the latest Elasticsearch snapshot with the full Kibana CI pipeline, and promotes if it there are no test failures.
98+
https://kibana-ci.elastic.co/job/elasticsearch+snapshots+verify/[This Jenkins job] tests the latest Elasticsearch snapshot with the full {kib} CI pipeline, and promotes if it there are no test failures.
9999

100-
The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/master/.ci/es-snapshots/Jenkinsfile_verify_es[in the kibana repo].
100+
The Jenkins job pipeline definition is https://github.com/elastic/kibana/blob/master/.ci/es-snapshots/Jenkinsfile_verify_es[in the {kib} repo].
101101

102-
1. Checkout Kibana and set up CI environment as normal.
102+
1. Checkout {kib} and set up CI environment as normal.
103103
2. Set the `ES_SNAPSHOT_MANIFEST` env var to point to the latest snapshot manifest.
104104
3. Run CI (functional tests, integration tests, etc).
105105
4. After CI
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[[advanced]]
2+
== Advanced
3+
4+
* <<running-elasticsearch>>
5+
* <<development-es-snapshots>>
6+
* <<development-basepath>>
7+
8+
include::development-es-snapshots.asciidoc[]
9+
10+
include::running-elasticsearch.asciidoc[]
11+
12+
include::development-basepath.asciidoc[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
[[running-elasticsearch]]
2+
=== Running elasticsearch during development
3+
4+
There are many ways to run Elasticsearch while you are developing.
5+
6+
[float]
7+
8+
==== By snapshot
9+
10+
This will run a snapshot of elasticsearch that is usually built nightly. Read more about <<development-es-snapshots>>.
11+
12+
[source,bash]
13+
----
14+
yarn es snapshot
15+
----
16+
17+
See all available options, like how to specify a specific license, with the `--help` flag.
18+
19+
[source,bash]
20+
----
21+
yarn es snapshot --help
22+
----
23+
24+
`trial` will give you access to all capabilities.
25+
26+
**Keeping data between snapshots**
27+
28+
If you want to keep the data inside your Elasticsearch between usages of this command, you should use the following command, to keep your data folder outside the downloaded snapshot folder:
29+
30+
[source,bash]
31+
----
32+
yarn es snapshot -E path.data=../data
33+
----
34+
35+
==== By source
36+
37+
If you have the Elasticsearch repo checked out locally and wish to run against that, use `source`. By default, it will reference an elasticsearch checkout which is a sibling to the {kib} directory named elasticsearch. If you wish to use a checkout in another location you can provide that by supplying --source-path
38+
39+
[source,bash]
40+
----
41+
yarn es source
42+
----
43+
44+
==== From an archive
45+
46+
Use this if you already have a distributable. For released versions, one can be obtained on the Elasticsearch downloads page.
47+
48+
[source,bash]
49+
----
50+
yarn es archive <full_path_to_archive>
51+
----
52+
53+
Each of these will run Elasticsearch with a basic license. Additional options are available, pass --help for more information.
54+
55+
==== From a remote host
56+
57+
You can save some system resources, and the effort of generating sample data, if you have a remote Elasticsearch cluster to connect to. (Elasticians: you do! Check with your team about where to find credentials)
58+
59+
You'll need to create a kibana.dev.yml (<<customize-kibana-yml>>) and add the following to it:
60+
61+
[source,bash]
62+
----
63+
elasticsearch.hosts:
64+
- {{ url }}
65+
elasticsearch.username: {{ username }}
66+
elasticsearch.password: {{ password }}
67+
elasticsearch.ssl.verificationMode: none
68+
----
69+
70+
If many other users will be interacting with your remote cluster, you'll want to add the following to avoid causing conflicts:
71+
72+
[source,bash]
73+
----
74+
kibana.index: '.{YourGitHubHandle}-kibana'
75+
xpack.task_manager.index: '.{YourGitHubHandle}-task-manager-kibana'
76+
----
77+
78+
===== Running remote clusters
79+
80+
Setup remote clusters for cross cluster search (CCS) and cross cluster replication (CCR).
81+
82+
Start your primary cluster by running:
83+
84+
[source,bash]
85+
----
86+
yarn es snapshot -E path.data=../data_prod1
87+
----
88+
89+
Start your remote cluster by running:
90+
91+
[source,bash]
92+
----
93+
yarn es snapshot -E transport.port=9500 -E http.port=9201 -E path.data=../data_prod2
94+
----
95+
96+
Once both clusters are running, start {kib}. {kib} will connect to the primary cluster.
97+
98+
Setup the remote cluster in {kib} from either Management -> Elasticsearch -> Remote Clusters UI or by running the following script in Console.
99+
100+
[source,bash]
101+
----
102+
PUT _cluster/settings
103+
{
104+
"persistent": {
105+
"cluster": {
106+
"remote": {
107+
"cluster_one": {
108+
"seeds": [
109+
"localhost:9500"
110+
]
111+
}
112+
}
113+
}
114+
}
115+
}
116+
----
117+
118+
Follow the cross-cluster search instructions for setting up index patterns to search across clusters (<<management-cross-cluster-search>>).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[[add-data-tutorials]]
2+
=== Add data tutorials
3+
4+
`Add Data` in the {kib} Home application contains tutorials for setting up data flows in the Elastic stack.
5+
6+
Each tutorial contains three sets of instructions:
7+
8+
* `On Premise.` Set up a data flow when both {kib} and Elasticsearch are running on premise.
9+
* `On Premise Elastic Cloud.` Set up a data flow when {kib} is running on premise and Elasticsearch is running on Elastic Cloud.
10+
* `Elastic Cloud.` Set up a data flow when both {kib} and Elasticsearch are running on Elastic Cloud.
11+
12+
[float]
13+
==== Creating a new tutorial
14+
1. Create a new directory in the link:https://github.com/elastic/kibana/tree/master/src/plugins/home/server/tutorials[tutorials directory].
15+
2. In the new directory, create a file called `index.ts` that exports a function.
16+
The function must return a function object that conforms to the `TutorialSchema` interface link:{kib-repo}tree/{branch}/src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts[tutorial schema].
17+
3. Register the tutorial in link:{kib-repo}tree/{branch}/src/plugins/home/server/tutorials/register.ts[register.ts] by adding it to the `builtInTutorials`.
18+
// TODO update path once assets are migrated
19+
4. Add image assets to the link:{kib-repo}tree/{branch}/src/legacy/core_plugins/kibana/public/home/tutorial_resources[tutorial_resources directory].
20+
5. Run {kib} locally to preview the tutorial.
21+
6. Create a PR and go through the review process to get the changes approved.
22+
23+
If you are creating a new plugin and the tutorial is only related to that plugin, you can also place the `TutorialSchema` object into your plugin folder. Add `home` to the `requiredPlugins` list in your `kibana.json` file.
24+
Then register the tutorial object by calling `home.tutorials.registerTutorial(tutorialObject)` in the `setup` lifecycle of your server plugin.
25+
26+
[float]
27+
===== Variables
28+
String values can contain variables that are substituted when rendered. Variables are specified by `{}`.
29+
For example: `{config.docs.version}` is rendered as `6.2` when running the tutorial in {kib} 6.2.
30+
31+
link:{kib-repo}tree/{branch}/src/legacy/core_plugins/kibana/public/home/np_ready/components/tutorial/replace_template_strings.js#L23[Provided variables]
32+
33+
[float]
34+
===== Markdown
35+
String values can contain limited Markdown syntax.
36+
37+
link:{kib-repo}tree/{branch}/src/legacy/core_plugins/kibana/public/home/components/tutorial/content.js#L8[Enabled Markdown grammars]
38+

docs/developer/visualize/development-visualize-index.asciidoc docs/developer/architecture/development-visualize-index.asciidoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[[development-visualize-index]]
2-
== Developing Visualizations
2+
=== Developing Visualizations
33

44
[IMPORTANT]
55
==============================================
6-
These pages document internal APIs and are not guaranteed to be supported across future versions of Kibana.
6+
These pages document internal APIs and are not guaranteed to be supported across future versions of {kib}.
77
==============================================
88

99
The internal APIs for creating custom visualizations are in a state of heavy churn as
10-
they are being migrated to the new Kibana platform, and large refactorings have been
10+
they are being migrated to the new {kib} platform, and large refactorings have been
1111
happening across minor releases in the `7.x` series. In particular, in `7.5` and later
1212
we have made significant changes to the legacy APIs as we work to gradually replace them.
1313

@@ -20,7 +20,7 @@ If you would like to keep up with progress on the visualizations plugin in the m
2020
here are a few resources:
2121

2222
* The <<breaking-changes,breaking changes>> documentation, where we try to capture any changes to the APIs as they occur across minors.
23-
* link:https://github.com/elastic/kibana/issues/44121[Meta issue] which is tracking the move of the plugin to the new Kibana platform
23+
* link:https://github.com/elastic/kibana/issues/44121[Meta issue] which is tracking the move of the plugin to the new {kib} platform
2424
* Our link:https://www.elastic.co/blog/join-our-elastic-stack-workspace-on-slack[Elastic Stack workspace on Slack].
2525
* The {kib-repo}blob/{branch}/src/plugins/visualizations[source code], which will continue to be
2626
the most accurate source of information.
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[[kibana-architecture]]
2+
== Architecture
3+
4+
[IMPORTANT]
5+
==============================================
6+
{kib} developer services and apis are in a state of constant development. We cannot provide backwards compatibility at this time due to the high rate of change.
7+
==============================================
8+
9+
Our developer services are changing all the time. One of the best ways to discover and learn about them is to read the available
10+
READMEs from all the plugins inside our {kib-repo}tree/{branch}/src/plugins[open source plugins folder] and our
11+
{kib-repo}/tree/{branch}/x-pack/plugins[commercial plugins folder].
12+
13+
A few services also automatically generate api documentation which can be browsed inside the {kib-repo}tree/{branch}/docs/development[docs/development section of our repo]
14+
15+
A few notable services are called out below.
16+
17+
* <<development-security>>
18+
* <<add-data-tutorials>>
19+
* <<development-visualize-index>>
20+
21+
include::add-data-tutorials.asciidoc[]
22+
23+
include::development-visualize-index.asciidoc[]
24+
25+
include::security/index.asciidoc[]

0 commit comments

Comments
 (0)