kibana/packages/kbn-es
Tiago Costa e5d8d49164
chore(NA): assures a single version for the same dependency across the entire project (#78825)
* chore(NA): script to check for multiple version of same dependency

* chore(NA): remove multiple versions for the same dependency

* chore(NA): hook single_version_dependencies script into the CI

* chore(NA): remove grunt from the CI hook integration

* chore(NA): update kbn pm dist

* chore(NA): fix typechecking

* chore(NA): update code to run under last extract-zip version

* fix(NA): multiple versions of the same type dependency

* move validation to bootstrap (#13)

Co-authored-by: spalger <spalger@users.noreply.github.com>

* chore(NA): todo to remove logic to validate single version deps once we move into a single package.json

* chore(NA): remove verify dependency versions jenkins task

* chore(NA): update kbn pm dist file

* chore(NA): remove last mention to verify_dependency_versions.sh fom tasks.groovy

Co-authored-by: Spencer <email@spalger.com>
Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-10-02 00:46:00 +01:00
..
scripts [kbn/es] use a basic build process (#78090) 2020-09-28 11:14:17 -07:00
src Bumps Jest related packages (#78720) 2020-10-01 14:38:51 -07:00
package.json chore(NA): assures a single version for the same dependency across the entire project (#78825) 2020-10-02 00:46:00 +01:00
README.md add simple description of how to pin es snapshot versions (#51225) 2019-11-20 19:11:53 -07:00
tsconfig.json Introduce TS incremental builds & move src/test_utils to TS project (#76082) 2020-09-03 14:20:04 +02:00
yarn.lock Add lockfile symlinks (#55440) 2020-01-27 11:38:20 -05:00

@kbn/es

A command line utility for running elasticsearch from source or archive.

Getting started

If running elasticsearch from source, elasticsearch needs to be cloned to a sibling directory of Kibana.

To run, go to the Kibana root and run node scripts/es --help to get the latest command line options.

Examples

Run a snapshot install with a trial license

node scripts/es snapshot --license=trial

Run from source with a configured data directory

node scripts/es source --Epath.data=/home/me/es_data

API

run

Start a cluster

var es = require('@kbn/es');
es.run({
  license: 'basic',
  version: 7.0,
})
.catch(function (e) {
  console.error(e);
  process.exitCode = 1;
});

Options

options.license

Type: String

License type, one of: trial, basic, gold, platinum

options.version

Type: String

Desired elasticsearch version

options['source-path']

Type: String

Cloned location of elasticsearch repository, used when running from source

options['base-path']

Type: String

Location where snapshots are cached

Snapshot Pinning

Sometimes we need to pin snapshots for a specific version. We'd really like to get this automated, but until that is completed here are the steps to take to build, upload, and switch to pinned snapshots for a branch.

To use these steps you'll need to setup the google-cloud-sdk, which can be installed on macOS with brew cask install google-cloud-sdk. Login with the CLI and you'll have access to the gsutil to do efficient/parallel uploads to GCS from the command line.

  1. Clone the elasticsearch repo somewhere

  2. Checkout the branch you want to build

  3. Run the following to delete old distributables

    find distribution/archives -type f \( -name 'elasticsearch-*-*.tar.gz' -o -name 'elasticsearch-*-*.zip' \) -not -path *no-jdk* -exec rm {} \;
    
  4. Build the new artifacts

    ./gradlew -p distribution/archives assemble --parallel
    
  5. 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 \;
    
  6. Calculate shasums of the uploads

    cd ~/Downloads/tmp-artifacts
    find * -exec bash -c "shasum -a 512 {} > {}.sha512" \;
    
  7. Check that the files in ~/Downloads/tmp-artifacts look reasonable

  8. Upload the files to GCS

    gsutil -m rsync . gs://kibana-ci-tmp-artifacts/
    
  9. 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
    if (!process.env.KBN_ES_SNAPSHOT_URL && !process.argv.some(isVersionFlag)) {
      // return undefined;
      return 'https://storage.googleapis.com/kibana-ci-tmp-artifacts/{name}-{version}-{os}-x86_64.{ext}';
    }
    

    For 6.8, the format of the url should look like:

    'https://storage.googleapis.com/kibana-ci-tmp-artifacts/{name}-{version}.{ext}';