Skip to content

Commit

Permalink
docs(NA): adds @kbn/es into ops devdocs (#133353)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic authored Jun 3, 2022
1 parent ed82915 commit 71652fb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 32 deletions.
3 changes: 2 additions & 1 deletion dev_docs/operations/operations_landing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ layout: landing
{ pageId: "kibDevDocsOpsAmbientUiTypes" },
{ pageId: "kibDevDocsOpsTestSubjSelector" },
{ pageId: "kibDevDocsOpsBazelRunner" },
{ pageId: "kibDevDocsOpsCliDevMode" }
{ pageId: "kibDevDocsOpsCliDevMode" },
{ pageId: "kibDevDocsOpsEs" },
]}
/>
3 changes: 2 additions & 1 deletion nav-kibana-dev.docnav.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@
{ "id": "kibDevDocsOpsAmbientUiTypes" },
{ "id": "kibDevDocsOpsTestSubjSelector" },
{ "id": "kibDevDocsOpsBazelRunner" },
{ "id": "kibDevDocsOpsCliDevMode" }
{ "id": "kibDevDocsOpsCliDevMode" },
{ "id": "kibDevDocsOpsEs" }
]
}
]
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-es/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ filegroup(

NPM_MODULE_EXTRA_FILES = [
"package.json",
"README.md",
]

RUNTIME_DEPS = [
Expand Down
42 changes: 14 additions & 28 deletions packages/kbn-es/README.md → packages/kbn-es/README.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# @kbn/es
---
id: kibDevDocsOpsEs
slug: /kibana-dev-docs/ops/es
title: "@kbn/es"
description: A cli package for running elasticsearch or building snapshot artifacts
date: 2022-05-24
tags: ['kibana', 'dev', 'contributor', 'operations', 'es']
---

> A command line utility for running elasticsearch from source or archive.
> A command line utility for running elasticsearch from snapshot, source, archive or even building snapshot artifacts.
## Getting started
If running elasticsearch from source, elasticsearch needs to be cloned to a sibling directory of Kibana.
Expand Down Expand Up @@ -71,41 +78,20 @@ To use these steps you'll need to setup the google-cloud-sdk, which can be insta

1. Clone the elasticsearch repo somewhere
2. Checkout the branch you want to build
3. Run the following to delete old distributables
3. Build the new artifacts

```
find distribution/archives -type f \( -name 'elasticsearch-*-*.tar.gz' -o -name 'elasticsearch-*-*.zip' \) -not -path *no-jdk* -exec rm {} \;
node scripts/es build_snapshots --output=~/Downloads/tmp-artifacts --source-path=/path/to/es/repo
```

4. Build the new artifacts
```
./gradlew -p distribution/archives assemble --parallel
```
4. Copy new artifacts to your `~/Downloads/tmp-artifacts`
```
rm -rf ~/Downloads/tmp-artifacts
mkdir ~/Downloads/tmp-artifacts
find distribution/archives -type f \( -name 'elasticsearch-*-*.tar.gz' -o -name 'elasticsearch-*-*.zip' \) -not -path *no-jdk* -exec cp {} ~/Downloads/tmp-artifacts \;
```
5. Calculate shasums of the uploads
```
cd ~/Downloads/tmp-artifacts
find * -exec bash -c "shasum -a 512 {} > {}.sha512" \;
```
6. Check that the files in `~/Downloads/tmp-artifacts` look reasonable
7. Upload the files to GCS
4. Check that the files in `~/Downloads/tmp-artifacts` look reasonable
5. Upload the files to GCS

```
gsutil -m rsync . gs://kibana-ci-tmp-artifacts/
```

8. Once the artifacts are uploaded, modify `packages/kbn-es/src/custom_snapshots.js` in a PR to use a URL formatted like:
6. Once the artifacts are uploaded, modify `packages/kbn-es/src/custom_snapshots.js` in a PR to use a URL formatted like:

```
// force use of manually created snapshots until ReindexPutMappings fix
Expand Down
12 changes: 11 additions & 1 deletion packages/kbn-es/src/cli_commands/build_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

const dedent = require('dedent');
const { resolve, basename } = require('path');
const { createHash } = require('crypto');
const { promisify } = require('util');
Expand All @@ -21,7 +22,16 @@ const pipelineAsync = promisify(pipeline);

exports.description = 'Build and collect ES snapshots';

exports.help = () => ``;
exports.help = () => dedent`
Options:
--output Path to create the built elasticsearch snapshots
--source-path Path where the elasticsearch repository is checked out
Example:
es build_snapshots --source-path=/path/to/es/checked/repo --output=/tmp/es-built-snapshots
`;

exports.run = async (defaults = {}) => {
const argv = process.argv.slice(2);
Expand Down

0 comments on commit 71652fb

Please sign in to comment.