Commit graph

1378 commits

Author SHA1 Message Date
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
Ryan Ernst
4b44413783
Move declarative plugin sync to server cli (#87273)
When running in Docker, the elasticsearch-plugins.yml allows configuring
plugins that should be installed in the system. Upon Elasticsearch
starting up, plugins are installed/removed to match the configured
plugins. However, this happens late in startup, and it would be nice to
keep the main Elasticsearch process from ever writing outside the
configured data directories. Now that the server cli has been moved to
Java, this is possible.

This commit moves invocation of the plugins sync command into the server
cli. Note that the sync plugins action should probably be reworked as it
can be implement Command directly now. However, this commit tries to be
the minimal change possible to remove plugin cli knowledge from server.
2022-06-01 15:52:02 -04:00
Nikola Grcevski
978c2dbe42
Fix NullPointerException in creating the parent Pid directory (#87008) 2022-05-26 12:35:24 -04:00
Ryan Ernst
3ddad4a7a7
Handle unexpected exit code from server process (#87098)
When running Elasticsearch in the foreground, the cli process waits
indefinitely on the server. If the server dies unexpectedly, the
ServerProcess throws an exception. However, the exit code is hidden in
the exception message. This commit changes waitFor to return the exit
code, so it can be propagated to the cli main. Note that when stopping
in a shutdown hook the exit code must be ignored because calling
System.exit from a shutdownhook results in a deadlock.
2022-05-25 06:32:47 -07:00
Ryan Ernst
e46975bb12
Improve server process tests (#87012)
When the server process dies, the cli should reflect the unexpected exit
of the process in its return from waitFor. The test for this closed the
input side of the pipe, but that is where the buffer lives. This means
there is a race condition in the cli testcase fully reading the final
message expected. This commit removes some complexity from the test by
using a single latch, and closing the pipe from the process side to
mimic the break.
2022-05-23 14:43:13 -07:00
Nikola Grcevski
00dfe7b84b
Fix null message in stdout (#86981) 2022-05-20 15:12:04 -04:00
Ryan Ernst
300a578ad3
Rename PluginInfo to PluginDescriptor (#86950)
The class PluginInfo represents the plugin-descriptor.properties file
that each plugin must have. This commit renames the class to more
closely match what it represents: the plugin descriptor.
2022-05-20 07:23:44 -07:00
Chris Hegarty
3071c6a055
Modularize Elasticsearch (#81066)
This PR represents the initial phase of Modularizing Elasticsearch (with
Java Modules).

This initial phase modularizes the core of the Elasticsearch server
with Java Modules, which is then used to load and configure extension
components atop the server. Only a subset of extension components are
modularized at this stage (other components come in a later phase).
Components are loaded dynamically at runtime with custom class loaders
(same as is currently done). Components with a module-info.class are
defined to a module layer.

This architecture is somewhat akin to the Modular JDK, where
applications run on the classpath. In the analogy, the Elasticsearch
server modules are the platform (thus are always resolved and present),
while components without a module-info.class are non-modular code
running atop the Elasticsearch server modules. The extension components
cannot access types from non-exported packages of the server modules, in
the same way that classpath applications cannot access types from
non-exported packages of modules from the JDK. Broadly, the core
Elasticseach java modules simply "wrap" the existing packages and export
them. There are opportunites to export less, which is best done in more
narrowly focused follow-up PRs.

The Elasticsearch distribution startup scripts are updated to put jars
on the module path (the class path is empty), so the distribution will
run the core of the server as java modules. A number of key components
have been retrofitted with module-info.java's too, and the remaining
components can follow later. Unit and functional tests run as
non-modular (since they commonly require package-private access), while
higher-level integration tests, that run the distribution, run as
modular.

Co-authored-by: Chris Hegarty <christopher.hegarty@elastic.co>
Co-authored-by: Ryan Ernst <ryan@iernst.net>
Co-authored-by: Rene Groeschke <rene@elastic.co>
2022-05-20 13:11:42 +01:00
Yang Wang
74305b5984
[Test] Increase length of test password for FIPS (#86948)
Password must be at least 114 bits in FIPS mode. This PR fixes the
password length in the new ServerCliTests so it passes in FIPS mode.

Relates: #85758 

PS: The test
[failed](https://gradle-enterprise.elastic.co/s/mrlw6o27onxee/tests/:distribution:tools:server-cli:test/org.elasticsearch.server.cli.ServerCliTests/testKeystorePassword)
on my PR CI.
2022-05-19 21:33:56 -04:00
Ryan Ernst
4b2d553e51
Handle windows scripts invoked without .bat (#86944)
On Windows cmd, one can invoke `myscript.bat` by just typing `myscript`.
This commit adjusts the CliToolLauncher to account for this case, making
the .bat stripping to find the toolname conditional.

closes #86940
2022-05-19 17:07:59 -07:00
Ryan Ernst
55d8e60298
Move pidfile handling to server cli (#86934)
Now that the server cli is in java, we can do more system level things
inside it. This commit moves validating and writing the pidfile into the
server cli. One benefit is we get validation of directory/file problems
up front before even trying to start the ES process.
2022-05-19 14:59:56 -07:00