Commit graph

1388 commits

Author SHA1 Message Date
Nikola Grcevski
48bdb08d32
Remove more references to KeyStoreWrapper (#92378)
This change uses a new utility class that
abstracts the construction of secure settings,
into environment dependent version. KeyStoreWrapper
is just one implementation.
2023-01-27 13:35:06 -05:00
Luca Cavanna
a54bc1bdb1
Enable Panama-based mmap directory by default (#93232)
When we upgraded to lucene 9.5 (snapshot) with #92957 we initially disable panama-based
mmap directory through a system property. With this commit we remove the system property
and enable java 19 memory segments by default (based on https://github.com/apache/lucene/pull/12033)
2023-01-25 19:28:35 +01:00
Ryan Ernst
07b5d85dea
Remove user exception marker from server cli (#93206)
Previously UserExceptions could be thrown from the main Elasticsearch
process during startup. With recent refactorings all remaining
validation of arguments was moved to the server cli. Since there are no
longer any uses of the user exception in server, the marker code is no
longer needed. This commit removes that marker and the associated code
in the server cli error pump.
2023-01-24 08:59:51 -08:00
Luca Cavanna
edd7749164
Upgrade to lucene-9.5.0-snapshot-d19c3e2e0ed (#92957)
9.5 will include several changes related to vector search. An extensive list is available at https://github.com/apache/lucene/milestone/4 .
2023-01-19 14:07:33 +01:00
Przemyslaw Gomulka
2a7f61fb53
Scan stable plugins for named components upon install (#92528)
stable plugins not build with ES's gradle plugin will not have named_components.json file.
To allow these plugins to expose their named components, a scan can be performed upon install.

relates #88980
2023-01-18 18:19:02 +01:00
Mark Vieira
30faac838a
Ensure correct architecture for beats is used in cloud docker images (#92997) 2023-01-17 10:56:45 -08:00
Mark Vieira
3add0b2343
Fix reference to location of read-only Gradle dependency cache (#92852)
Environment variable of course only works in the context of a shell.
Instead of using `$HOME` just reference the `user.home` system property
here.
2023-01-11 17:49:34 -05:00
Daniel Mitterdorfer
8fc2d6af4c
Add log level for JVM logs (#92382)
With this commit we specify `level` in JVM logs. `level` helps to filter
more severe messages from mere debugging messages in logs and with this
change we are able to use it also for JVM logs.

Here are a few example lines:

Before:

```
[2022-12-15T06:19:16.936+0000][15181][gc,start    ] GC(0) Pause Young (Normal) (G1 Evacuation Pause)
```

After:

```
[2022-12-15T06:22:27.932+0000][16320][info][gc,start    ] GC(0) Pause Young (Normal) (G1 Evacuation Pause)
[2022-12-15T06:22:27.932+0000][16320][debug][gc,age      ] GC(0) Desired survivor size 14680064 bytes, new threshold 15 (max threshold 15)
[2022-12-15T06:22:27.935+0000][16320][info ][gc,phases   ] GC(0)   Pre Evacuate Collection Set: 0.1ms
[2022-12-15T06:22:27.935+0000][16320][trace][gc,age      ] GC(0) Age table with threshold 15 (max threshold 15)
```

Notice, that the log level might have trailing spaces.

See also
https://docs.oracle.com/en/java/javase/19/docs/specs/man/java.html#xlog-tags-and-levels
for the available log levels.
2023-01-10 07:58:18 +01:00
Artem Prigoda
2bc7398754
Use Strings.format instead of String.format(Locale.ROOT, ...) in tests (#92106)
Use local-independent `Strings.format` method instead of `String.format(Locale.ROOT, ...)`. 
Inline `ESTestCase.forbidden` calls with `Strings.format` for the consistency sake.
Add `Strings.format` alias in `common.Strings`
2023-01-03 19:28:27 +01:00
Mark Vieira
c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Nikola Grcevski
a3f8abb953
Switch usages from KeyStoreWrapper to SecureSettings (#92339)
Move away from using the KeyStoreWrapper type directly
and switch to SecureSettings, where possible.
2022-12-14 10:39:35 -05:00
Dimitrios Liappis
a6351aae3b
Add docs about multi-arch Docker builds (#92185)
Enhance docker distribution project docs with prerequisites for building
multi-architecture images.
2022-12-07 13:08:53 +02:00
Nikola Grcevski
a611295c11
Remove clutter from the elasticsearch.yml file. (#91631) 2022-11-17 10:20:36 -05:00
David Turner
d956501a80
Extend systemd startup timeout to 900s (#91338)
Extends the default `systemd` startup timeout from 75s to 900s.

Relates #86476
2022-11-17 11:16:22 +00:00
Mark Vieira
e68e28e4cb Ensure beats are bundled in Cloud docker image during DRA builds
(cherry picked from commit 210d4576fa)
2022-11-16 16:15:23 -08:00
Nikola Grcevski
3fd338ffd1
Bind the readiness service to the wildcard address (#91329)
This change changes the host binding on the readiness service to all from localhost.
2022-11-16 09:46:28 -05:00
Rene Groeschke
f6b1087f30
Provide compressed docker image exports for DRA process (#91593)
Initial fix for providing the expected Docker files for our DRA process
- Can be tweaked to be more efficient, but kept simple for now
2022-11-15 11:39:56 -05:00
Mark Vieira
143828e4f4
Add exportDockerImages lifecycle task for exporting docker tarballs (#91571)
We need exported Docker artifacts for the release process. Add a
lifecycle task to generate these artifacts.
2022-11-14 20:00:16 -05:00
Rene Groeschke
ecce75a543
Fix inter project handling of generateDependenciesReport (#91555)
Also fixes a deprecation warning we see when generating dependency
reports
2022-11-14 11:44:55 -05:00
Nikola Grcevski
0c150e4d06
Handle APM global labels as affix setting (#91438)
Co-authored-by: Rory Hunter <pugnascotia@users.noreply.github.com>
2022-11-10 14:45:39 -05:00
Rene Groeschke
f880d41669
Add DRA snapshot build (#91018)
* Add support for building against defined build-ids of dependent artifacts
* Introduce DraResolvePlugin and functional tests
* Declare initial dra snapshot ci job for elasticsearch

We run the DRA builds against ubuntu as other release related ci jobs have in the past. Also we only have libs2xmlutills available on our ubuntu based ci workers
2022-11-09 16:16:21 +01:00
Nikola Grcevski
691a679c65
Fix APM configuration file delete (#91058)
When we launch Elasticsearch with the APM monitoring
agent, we create a temporary configuration file to
securely pass the API key or secret. This temporary
file is cleaned up on Elasticsearch Node creation.

After we renamed the APM module, the delete logic
didn't get updated, which means we never delete the file
anymore.

This commit:
 - fixes the APM module pattern match when we delete
 - adds additional delete safety net on failed node start
 - adds tests for ensuring the naming dependency isn't
   broken again.
2022-11-02 09:25:11 -04:00
Rene Groeschke
43a0377735
Update forbiddenapis to 3.4 (#90624)
Fix breaking changes to source validation after change in default jdk rule set
2022-10-06 16:52:06 +02:00
Mark Vieira
3c3a70cbeb Add extensions points for building customized Docker images 2022-09-30 15:43:31 -07:00
Mark Vieira
3603aa7151
Use architecture specific tag for building cloud-ess image (#90074) 2022-09-15 16:19:30 -07:00
Mark Vieira
fa38d1ba8f
Allow for building multi-arch docker images via buildx (#89986) 2022-09-13 08:32:55 -07:00
Mark Vieira
5ebaece2ba
Use DRA artifacts for beats and ML dependencies (#89951) 2022-09-09 13:05:19 -07:00
Mark Vieira
c0019a3ff6
Ensure APM module is always installed in release test clusters (#89223) 2022-08-10 09:04:40 -07:00
Chris Hegarty
ac25477e40
Quote paths with whitespace in Windows service CLIs (#89072) 2022-08-08 17:06:07 +01:00
Rene Groeschke
3909b5eaf9
Add verification metadata for dependencies (#88814)
Removing the custom dependency checksum functionality in favor of Gradle build-in dependency verification support. 

- Use sha256 in favor of sha1 as sha1 is not considered safe these days.

Closes https://github.com/elastic/elasticsearch/issues/69736
2022-08-04 09:51:16 +02:00
Rory Hunter
512bfebc10
Provide tracing implementation using OpenTelemetry + APM agent (#88443)
Part of #84369. Implement the `Tracer` interface by providing a
module that uses OpenTelemetry, along with Elastic's APM
agent for Java.

See the file `TRACING.md` for background on the changes and the
reasoning for some of the implementation decisions.

The configuration mechanism is the most fiddly part of this PR. The
Security Manager permissions required by the APM Java agent make
it prohibitive to start an agent from within Elasticsearch
programmatically, so it must be configured when the ES JVM starts.
That means that the startup CLI needs to assemble the required JVM
options.

To complicate matters further, the APM agent needs a secret token
in order to ship traces to the APM server. We can't use Java system
properties to configure this, since otherwise the secret will be
readable to all code in Elasticsearch. It therefore has to be
configured in a dedicated config file. This in itself is awkward,
since we don't want to leave secrets in config files. Therefore,
we pull the APM secret token from the keystore, write it to a config
file, then delete the config file after ES starts.

There's a further issue with the config file. Any options we set
in the APM agent config file cannot later be reconfigured via system
properties, so we need to make sure that only "static" configuration
goes into the config file.

I generated most of the files under `qa/apm` using an APM test
utility (I can't remember which one now, unfortunately). The goal
is to setup up a complete system so that traces can be captured in
APM server, and the results in Elasticsearch inspected.
2022-08-03 14:13:31 +01:00
Rory Hunter
ec8af834f4
Write docs about our Docker build setup (#89036)
Add a README.md to the docker distribution project, with details
about how we build and test our images.
2022-08-03 11:02:27 +01:00
Mark Vieira
41af3cb8e5
Ignore beats artifacts when resolving all artifact dependencies (#88960) 2022-07-29 13:32:24 -07:00
Chris Hegarty
4e3b71b6af
Ensure that the extended socket options TCP_KEEPXXX are available (#88935) 2022-07-29 17:54:33 +01:00
Rory Hunter
4ed027b165
Remove unused plugins dir var from server CLI (#88917)
Split out of #88443. Remove the now-unused plugins directory variable from the
server CLI code.
2022-07-28 21:45:00 +01:00
Ryan Ernst
0986d8b44e
Add support for reading stable plugin descriptors (#88731)
The new stable plugin api will have a slightly different descriptor file
format. This commit prepares for stable plugins by adding support for
reading those new files. The basic info for a plugin is the same like
name and version info. Other stuff like classname are not necessary. The
one additional property specific to the new plugins is "modular", which
indicates whether the jars of the plugin should be loaded as named
modules (this is akin to setting the module path when running java).
2022-07-26 10:28:24 +09:30
Rory Hunter
d5b1356b6c
Fix docker positional params (take 2) (#88584)
As part of #50277, we removed the `TAKE_FILE_OWNERSHIP` option from the
Docker entrypoint script and the associated chroot calls, and instead
just defaulted to running the image as `elasticsearch` instead of
`root`.

However, we didn't check that it was still possible to pass CLI options
to Elasticsearch via CLI arguments, and broke this by mistake. This is
probably an uncommon pattern, versus environment variables or a config
file.  Nevertheless, it is supposed to be possible and is mentioned in
the documentation.

Fix the problem by suppling the missing positional params when calling
Elasticsearch, and add a test case so that we don't break it again.
2022-07-19 09:17:36 +01:00
Rory Hunter
ffc6a14755 Revert "Fix passing positional args to ES in Docker (#88502)"
This reverts commit 9f4b32a20a.
2022-07-18 09:28:49 +01:00
Rory Hunter
9f4b32a20a
Fix passing positional args to ES in Docker (#88502)
As part of #50277, we removed the `TAKE_FILE_OWNERSHIP` option from the
Docker entrypoint script and the associated chroot calls, and instead
just defaulted to running the image as `elasticsearch` instead of
`root`.

However, we didn't check that it was still possible to pass CLI options
to Elasticsearch via CLI arguments, and broke this by mistake. This is
probably an uncommon pattern, versus environment variables or a config
file.  Nevertheless, it is supposed to be possible and is mentioned in
the documentation.

Fix the problem by suppling the missing positional params when calling
Elasticsearch, and add a test case so that we don't break it again.
2022-07-14 09:12:04 +01:00
Rene Groeschke
dbf39741a0
Make LoggedExec gradle task configuration cache compatible (#87621)
This changes the LoggedExec task to be configuration cache compatible. We changed the implementation
to use `ExecOperations` instead of extending `Exec` task. As double checked with the Gradle team this task
is not planned to be made configuration cache compatible out of the box anytime soon.

This is part of the effort on https://github.com/elastic/elasticsearch/issues/57918
2022-07-11 08:46:54 +02:00
Rene Groeschke
8ccae4da71
Setup elasticsearch dependency monitoring with Snyk for production code (#88036)
This adds the generation and upload logic of Gradle dependency graphs to snyk

We directly implemented a rest api based snyk plugin as:

the existing snyk gradle plugin delegates to the snyk command line tool the command line tool 
uses custom gradle logic by injecting a init file that is 

a) using deprecated build logic which we definitely want to avoid
b) uses gradle api we avoid like eager task creation.

Shipping this as a internal gradle plugin gives us the most flexibility as we only want to monitor 
production code for now we apply this plugin as part of the elasticsearch.build plugin, 
that usage has been for now the de-facto indicator if a project is considered a "production" project 
that ends up in our distribution or public maven repositories. This isnt yet ideal and we will revisit 
the distinction between production and non production code / projects in a separate effort.

As part of this effort we added the elasticsearch.build plugin to more projects that actually end up 
in the distribution. To unblock us on this we for now disabled a few check tasks that started failing by applying elasticsearch.build. 

Addresses  #87620
2022-06-29 13:29:14 +02:00
Ryan Ernst
eed8da3919
Move the ingest attachment processor to the default distribution (#87989)
The ingest attachment processor is currently available as a plugin. This
commit moves the processor to the default distribution so it is always
available.
2022-06-28 02:10:36 -04:00
Ryan Ernst
e3c4cddbe2
Remove legacy bootstrap plugins (#87775)
Bootstrap plugins were an internal mechanism added to allow a
filesystemprovider for cloud with the quota-aware-fs plugin. Since that
was removed, bootstrap plugins no longer serve a purpose. They were
never officially documented because they were for internal use only.
This commit removes the bootstrap plugins infrastructure.
2022-06-23 20:38:06 -04:00
Ryan Ernst
fc09896ec6
Remove keystore v1 and v2 formats (#87893)
The keystore format has been changed a few times since it was first
introduced. Part of Elasticsearch startup automatically upgrades the
format. Since Elasticsearch has fixed bounds of supported versions for
upgrades, there are also fixed bounds on the keystore formats we might
need to read.

The v3 keystore format was introduced in Elasticsearch 6.3.0. Since
current Elasticsearch master branch is 8.x, and 8.x only supports
offline upgrades from 7.x, it is therefore impossible to need to read
v1 or v2 formats. This commit removes support for those formats.
2022-06-21 21:47:28 -07:00
Ryan Ernst
9b25b5f986
Simplify bootstrap error logging (#87809)
During startup of Elasticsearch we go to great lengths to present errors
in a meaningful way to users. Over time, though, the error handling has
been amended to address various issues, and that has resulted in a
complicated system of try/catches handling various cases. One
particularly kludgy piece is removing the console logger in special
cases to avoid printing exceptions to the console. Additionally, the
console removal wasn't actually effective because later in exception
handling the exception would be both logged anyways, and then also sent
to stderr, meaning that we could see the same exception several times.

This commit reworks how exceptions are logged during bootstrap. To
address the concern of printing full exceptions to the console, a new
log4j exception filter is added to the console appender which will only
print out the exception message and some additional explanatory info. To
address logging multiple times, the try/catch within init is removed so
that excpetions can propagate to the try/catch in main, which now
handles all exceptions. Additionally, phase 1 (before logging) handles
it's own failure cases since there is definitely no logging at that
time. This simplifies the other failure cases latere so that they do not
need to check if logging has been initialized through sysprops.
2022-06-21 06:26:39 -07:00
Rory Hunter
cb70dac016
Remove vim-tiny from Docker build (#87812)
Closes #85634.
2022-06-21 10:22:18 +01:00
Przemyslaw Gomulka
3739e4b499
Revert "Deprecation dataset value changed to elasticsearch.deprecation (#83254)" (#87837)
This reverts commit bb06fac.
relates #83251
2022-06-20 14:02:34 +02:00
Ryan Ernst
4a2eb01f13
Move logging config assertion to server cli (#87774)
The log4j configuration file is shipped with all ES distributions. We
also check recursively for files possibly added by plugins. If no files
are found, we give a helpful startup error message. However, since the
log4j2 configuration file shipped with ES should always exist, we can
check upfront in the cli before even initializing logging.

This commit moves the validation of an existing log4j2 properties file
to the server cli.
2022-06-17 06:16:33 -07:00
David Roberts
36cffef079
Add Lintian overrides to ignore Intel MKL not linked to libc (#87706)
We don't build these libraries ourselves and the license forbids
us from modifying them in any way, so we won't be able to make
this rule pass on them. All we can do is override it.

Fixes #87632
2022-06-16 18:02:21 +01:00
Przemyslaw Gomulka
bb06fac7b7
Deprecation dataset value changed to elasticsearch.deprecation (#83254)
The dataset value for all ES logs are prefixed with elasticsearch + log
type. Like elasticsearch.server. Deprecation log had it reverted
deprecation.elasticsearch
This commit renames the dataset for deprecation logs to
`elasticsearch.deprecation.

closes #83251
2022-06-14 10:42:24 +02:00