Skip to content

Commit 0fa0734

Browse files
committed
Add tabs to remaining Elasticsearch install content
1 parent d6ea951 commit 0fa0734

File tree

4 files changed

+255
-4
lines changed

4 files changed

+255
-4
lines changed

deploy-manage/deploy/self-managed/air-gapped-install.md

Lines changed: 158 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,13 @@ Besides setting up the EPR service, you also need to [configure {{kib}}](/deploy
8787

8888
### Additional {{package-registry}} examples
8989

90-
:::{dropdown} Script to generate a SystemD service file on a RHEL 8 system
90+
:::::{dropdown} Script to generate a SystemD service file on a RHEL 8 system
9191

9292
The following script generates a SystemD service file on a RHEL 8 system in order to run EPR with Podman in a production environment.
9393

94+
::::{tab-set}
95+
96+
:::{tab-item} Latest
9497
```sh subs=true
9598
#!/usr/bin/env bash
9699

@@ -115,10 +118,42 @@ podman create \
115118
```
116119
:::
117120

118-
:::{dropdown} SystemD service file launched as a Podman service
121+
:::{tab-item} Specific version
122+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
123+
```sh subs=true
124+
#!/usr/bin/env bash
125+
126+
EPR_BIND_ADDRESS="0.0.0.0"
127+
EPR_BIND_PORT="8443"
128+
EPR_TLS_CERT="/etc/elastic/epr/epr.pem"
129+
EPR_TLS_KEY="/etc/elastic/epr/epr-key.pem"
130+
EPR_IMAGE="docker.elastic.co/package-registry/distribution:<specific.version>"
131+
132+
podman create \
133+
--name "elastic-epr" \
134+
-p "$EPR_BIND_ADDRESS:$EPR_BIND_PORT:$EPR_BIND_PORT" \
135+
-v "$EPR_TLS_CERT:/etc/ssl/epr.crt:ro" \
136+
-v "$EPR_TLS_KEY:/etc/ssl/epr.key:ro" \
137+
-e "EPR_ADDRESS=0.0.0.0:$EPR_BIND_PORT" \
138+
-e "EPR_TLS_CERT=/etc/ssl/epr.crt" \
139+
-e "EPR_TLS_KEY=/etc/ssl/epr.key" \
140+
"$EPR_IMAGE"
141+
142+
## creates service file in the root directory
143+
# podman generate systemd --new --files --name elastic-epr --restart-policy always
144+
```
145+
:::
146+
::::
147+
148+
:::::
149+
150+
:::::{dropdown} SystemD service file launched as a Podman service
119151

120152
The following is an example of an actual SystemD service file for an EPR, launched as a Podman service.
121153

154+
::::{tab-set}
155+
156+
:::{tab-item} Latest
122157
```ini subs=true
123158
# container-elastic-epr.service
124159
# autogenerated by Podman 4.1.1
@@ -160,6 +195,52 @@ WantedBy=default.target
160195
```
161196
:::
162197

198+
::::::{tab-item} Specific version
199+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
200+
```ini subs=true
201+
# container-elastic-epr.service
202+
# autogenerated by Podman 4.1.1
203+
# Wed Oct 19 13:12:33 UTC 2022
204+
205+
[Unit]
206+
Description=Podman container-elastic-epr.service
207+
Documentation=man:podman-generate-systemd(1)
208+
Wants=network-online.target
209+
After=network-online.target
210+
RequiresMountsFor=%t/containers
211+
212+
[Service]
213+
Environment=PODMAN_SYSTEMD_UNIT=%n
214+
Restart=always
215+
TimeoutStopSec=70
216+
ExecStartPre=/bin/rm -f %t/%n.ctr-id
217+
ExecStart=/usr/bin/podman run \
218+
--cidfile=%t/%n.ctr-id \
219+
--cgroups=no-conmon \
220+
--rm \
221+
--sdnotify=conmon \
222+
-d \
223+
--replace \
224+
--name elastic-epr \
225+
-p 0.0.0.0:8443:8443 \
226+
-v /etc/elastic/epr/epr.pem:/etc/ssl/epr.crt:ro \
227+
-v /etc/elastic/epr/epr-key.pem:/etc/ssl/epr.key:ro \
228+
-e EPR_ADDRESS=0.0.0.0:8443 \
229+
-e EPR_TLS_CERT=/etc/ssl/epr.crt \
230+
-e EPR_TLS_KEY=/etc/ssl/epr.key docker.elastic.co/package-registry/distribution:<specific.version>
231+
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
232+
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
233+
Type=notify
234+
NotifyAccess=all
235+
236+
[Install]
237+
WantedBy=default.target
238+
```
239+
:::
240+
::::
241+
242+
:::::
243+
163244
## {{artifact-registry}} [air-gapped-elastic-artifact-registry]
164245

165246
Air-gapped install of the {{artifact-registry}} is necessary in order to enable {{agent}} deployments to perform self-upgrades and install certain components which are needed for some of the data integrations (that is, in addition to what is also retrieved from the EPR). To learn more, refer to [Host your own artifact registry for binary downloads](/reference/fleet/air-gapped.md#host-artifact-registry) in the {{fleet}} and {{elastic-agent}} Guide.
@@ -170,10 +251,13 @@ When setting up own web server, such as NGINX, to function as the {{artifact-reg
170251

171252
### Additional {{artifact-registry}} examples
172253

173-
:::{dropdown} Artifact download script
254+
:::::{dropdown} Artifact download script
174255

175256
The following example script downloads artifacts from the internet to be later served as a private Elastic Package Registry.
176257

258+
::::{tab-set}
259+
260+
:::{tab-item} Latest
177261
```sh subs=true
178262
#!/usr/bin/env bash
179263
set -o nounset -o errexit -o pipefail
@@ -241,6 +325,77 @@ done
241325
```
242326
:::
243327

328+
::::::{tab-item} Specific version
329+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
330+
```sh subs=true
331+
#!/usr/bin/env bash
332+
set -o nounset -o errexit -o pipefail
333+
334+
STACK_VERSION=<specific.version>
335+
ARTIFACT_DOWNLOADS_BASE_URL=https://artifacts.elastic.co/downloads
336+
337+
DOWNLOAD_BASE_DIR=${DOWNLOAD_BASE_DIR:?"Make sure to set DOWNLOAD_BASE_DIR when running this script"}
338+
339+
COMMON_PACKAGE_PREFIXES="apm-server/apm-server beats/auditbeat/auditbeat beats/elastic-agent/elastic-agent beats/filebeat/filebeat beats/heartbeat/heartbeat beats/metricbeat/metricbeat beats/osquerybeat/osquerybeat beats/packetbeat/packetbeat cloudbeat/cloudbeat endpoint-dev/endpoint-security fleet-server/fleet-server"
340+
341+
WIN_ONLY_PACKAGE_PREFIXES="beats/winlogbeat/winlogbeat"
342+
343+
RPM_PACKAGES="beats/elastic-agent/elastic-agent"
344+
DEB_PACKAGES="beats/elastic-agent/elastic-agent"
345+
346+
function download_packages() {
347+
local url_suffix="$1"
348+
local package_prefixes="$2"
349+
350+
local _url_suffixes="$url_suffix ${url_suffix}.sha512 ${url_suffix}.asc"
351+
local _pkg_dir=""
352+
local _dl_url=""
353+
354+
for _download_prefix in $package_prefixes; do
355+
for _pkg_url_suffix in $_url_suffixes; do
356+
_pkg_dir=$(dirname ${DOWNLOAD_BASE_DIR}/${_download_prefix})
357+
_dl_url="${ARTIFACT_DOWNLOADS_BASE_URL}/${_download_prefix}-${_pkg_url_suffix}"
358+
(mkdir -p $_pkg_dir && cd $_pkg_dir && curl -O "$_dl_url")
359+
done
360+
done
361+
}
362+
363+
# and we download
364+
for _os in linux windows; do
365+
case "$_os" in
366+
linux)
367+
PKG_URL_SUFFIX="${STACK_VERSION}-${_os}-x86_64.tar.gz"
368+
;;
369+
windows)
370+
PKG_URL_SUFFIX="${STACK_VERSION}-${_os}-x86_64.zip"
371+
;;
372+
*)
373+
echo "[ERROR] Something happened"
374+
exit 1
375+
;;
376+
esac
377+
378+
download_packages "$PKG_URL_SUFFIX" "$COMMON_PACKAGE_PREFIXES"
379+
380+
if [[ "$_os" = "windows" ]]; then
381+
download_packages "$PKG_URL_SUFFIX" "$WIN_ONLY_PACKAGE_PREFIXES"
382+
fi
383+
384+
if [[ "$_os" = "linux" ]]; then
385+
download_packages "${STACK_VERSION}-x86_64.rpm" "$RPM_PACKAGES"
386+
download_packages "${STACK_VERSION}-amd64.deb" "$DEB_PACKAGES"
387+
fi
388+
done
389+
390+
391+
## selinux tweaks
392+
# semanage fcontext -a -t "httpd_sys_content_t" '/opt/elastic-packages(/.*)?'
393+
# restorecon -Rv /opt/elastic-packages
394+
```
395+
:::
396+
::::
397+
:::::
398+
244399
:::{dropdown} NGINX config for private {{artifact-registry}} web server
245400
The following is an example NGINX configuration for running a web server for the {{artifact-registry}}.
246401

deploy-manage/deploy/self-managed/install-elasticsearch-docker-compose.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,29 @@ Use Docker Compose to start a three-node {{es}} cluster with {{kib}}. Docker Com
3939
...
4040
```
4141
42-
5. In the `.env` file, set `STACK_VERSION` to the current {{stack}} version.
42+
5. Edit the `.env` file to set the `STACK_VERSION`:
4343
44+
::::{tab-set}
45+
46+
:::{tab-item} Latest
47+
Set the stack version to the current {{es}} {{version.stack}} version.
4448
```txt subs=true
4549
...
4650
# Version of Elastic products
4751
STACK_VERSION={{version.stack}}
4852
...
4953
```
54+
:::
55+
56+
:::{tab-item} Specific version
57+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
58+
```txt subs=true
59+
...
60+
# Version of Elastic products
61+
STACK_VERSION=<specific.version>
62+
...
63+
:::
64+
::::
5065
5166
6. By default, the Docker Compose configuration exposes port `9200` on all network interfaces.
5267

deploy-manage/deploy/self-managed/install-elasticsearch-docker-configure.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,33 @@ To encrypt your secure settings with a password and have them persist outside th
6363

6464
For example:
6565

66+
::::{tab-set}
67+
68+
:::{tab-item} Latest
6669
```sh subs=true
6770
docker run -it --rm \
6871
-v full_path_to/config:/usr/share/elasticsearch/config \
6972
docker.elastic.co/elasticsearch/elasticsearch:{{version.stack}} \
7073
bin/elasticsearch-keystore create -p
7174
```
75+
:::
76+
77+
:::{tab-item} Specific version
78+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
79+
```sh subs=true
80+
docker run -it --rm \
81+
-v full_path_to/config:/usr/share/elasticsearch/config \
82+
docker.elastic.co/elasticsearch/elasticsearch:<specific.version> \
83+
bin/elasticsearch-keystore create -p
84+
```
85+
:::
86+
::::
7287

7388
You can also use a `docker run` command to add or update secure settings in the keystore. You’ll be prompted to enter the setting values. If the keystore is encrypted, you’ll also be prompted to enter the keystore password.
7489

90+
::::{tab-set}
91+
92+
:::{tab-item} Latest
7593
```sh subs=true
7694
docker run -it --rm \
7795
-v full_path_to/config:/usr/share/elasticsearch/config \
@@ -80,6 +98,20 @@ bin/elasticsearch-keystore \
8098
add my.secure.setting \
8199
my.other.secure.setting
82100
```
101+
:::
102+
103+
:::{tab-item} Specific version
104+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
105+
```sh subs=true
106+
docker run -it --rm \
107+
-v full_path_to/config:/usr/share/elasticsearch/config \
108+
docker.elastic.co/elasticsearch/elasticsearch:<specific.version> \
109+
bin/elasticsearch-keystore \
110+
add my.secure.setting \
111+
my.other.secure.setting
112+
```
113+
:::
114+
::::
83115

84116
If you’ve already created the keystore and don’t need to update it, you can bind-mount the `elasticsearch.keystore` file directly. You can use the `KEYSTORE_PASSWORD` environment variable to provide the keystore password to the container at startup. For example, a `docker run` command might have the following options:
85117

@@ -93,10 +125,23 @@ If you’ve already created the keystore and don’t need to update it, you can
93125

94126
In some environments, it might make more sense to prepare a custom image that contains your configuration. A `Dockerfile` to achieve this might be as simple as:
95127

128+
::::{tab-set}
129+
130+
:::{tab-item} Latest
96131
```sh subs=true
97132
FROM docker.elastic.co/elasticsearch/elasticsearch:{{version.stack}}
98133
COPY --chown=elasticsearch:elasticsearch elasticsearch.yml /usr/share/elasticsearch/config/
99134
```
135+
:::
136+
137+
:::{tab-item} Specific version
138+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
139+
```sh subs=true
140+
FROM docker.elastic.co/elasticsearch/elasticsearch:<specific.version>
141+
COPY --chown=elasticsearch:elasticsearch elasticsearch.yml /usr/share/elasticsearch/config/
142+
```
143+
:::
144+
::::
100145

101146
You could then build and run the image with:
102147

deploy-manage/deploy/self-managed/install-elasticsearch-docker-prod.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,21 @@ Increased ulimits for [nofile](setting-system-settings.md) and [nproc](/deploy-m
131131

132132
To check the Docker daemon defaults for ulimits, run:
133133

134+
::::{tab-set}
135+
136+
:::{tab-item} Latest
134137
```sh subs=true
135138
docker run --rm docker.elastic.co/elasticsearch/elasticsearch:{{version.stack}} /bin/bash -c 'ulimit -Hn && ulimit -Sn && ulimit -Hu && ulimit -Su'
136139
```
140+
:::
141+
142+
:::{tab-item} Specific version
143+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
144+
```sh subs=true
145+
docker run --rm docker.elastic.co/elasticsearch/elasticsearch:<specific.version> /bin/bash -c 'ulimit -Hn && ulimit -Sn && ulimit -Hu && ulimit -Su'
146+
```
147+
:::
148+
::::
137149

138150
If needed, adjust them in the Daemon or override them per container. For example, when using `docker run`, set:
139151

@@ -166,9 +178,21 @@ To manually set the heap size in production, bind mount a [JVM options](elastics
166178

167179
For testing, you can also manually set the heap size using the `ES_JAVA_OPTS` environment variable. For example, to use 1GB, use the following command.
168180

181+
::::{tab-set}
182+
183+
:::{tab-item} Latest
169184
```sh subs=true
170185
docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="<token>" --name es01 -p 9200:9200 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:{{version.stack}}
171186
```
187+
:::
188+
189+
:::{tab-item} Specific version
190+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
191+
```sh subs=true
192+
docker run -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -e ENROLLMENT_TOKEN="<token>" --name es01 -p 9200:9200 --net elastic -it docker.elastic.co/elasticsearch/elasticsearch:<specific.version>
193+
```
194+
:::
195+
::::
172196

173197
The `ES_JAVA_OPTS` variable overrides all other JVM options. We do not recommend using `ES_JAVA_OPTS` in production.
174198

@@ -177,9 +201,21 @@ The `ES_JAVA_OPTS` variable overrides all other JVM options. We do not recommend
177201

178202
Pin your deployments to a specific version of the {{es}} Docker image. For example:
179203

204+
::::{tab-set}
205+
206+
:::{tab-item} Latest
180207
```sh subs=true
181208
docker.elastic.co/elasticsearch/elasticsearch:{{version.stack}}
182209
```
210+
:::
211+
212+
:::{tab-item} Specific version
213+
Replace `<specific.version>` with the {{es}} version number you want. For example, you can replace `<specific.version>` with {{version.stack.base}}.
214+
```sh subs=true
215+
docker.elastic.co/elasticsearch/elasticsearch:<specific.version>
216+
```
217+
:::
218+
::::
183219

184220

185221
## Always bind data volumes [_always_bind_data_volumes]

0 commit comments

Comments
 (0)