Skip to content

Commit 84f884a

Browse files
authored
Adds instructions for installing other 9.x versions (#2426)
In case someone needs to install an older version of the Elasticsearch 9.x series, I'm adding tabs to every installation-related command to add instructions for earlier versions. I've added two tabs for each command (where applicable): * Latest * Specific version The **Specific version** tab explains that users can replace the `<specific.version>` placeholder with the version that they want when they use the code samples. I've also grouped the tabs on pages where more than one tab was added in order to keep them in sync. That includes the tabs that are added as snippets, such as `.../deploy-manage/deploy/self-managed/_snippets/wolfi.md`, these get synced as well. Fixes #2234 ----------- <img width="862" height="221" alt="image" src="https://github.com/user-attachments/assets/2c370682-feff-4f3b-8f59-6a7aaef6dc8b" /> <img width="862" height="221" alt="image" src="https://github.com/user-attachments/assets/8f424dc4-44c2-4f67-a2e1-f720f45cb161" />
1 parent 0ff4a3d commit 84f884a

15 files changed

+785
-25
lines changed

deploy-manage/deploy/self-managed/_snippets/wolfi.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ To use the Wolfi image, append `-wolfi` to the image tag in the Docker command.
44

55
For example:
66

7+
::::{tab-set}
8+
:group: docker
9+
:::{tab-item} Latest
10+
:sync: latest
711
```sh subs=true
812
docker pull docker.elastic.co/elasticsearch/elasticsearch-wolfi:{{version.stack}}
9-
```
13+
```
14+
:::
15+
16+
:::{tab-item} Specific version
17+
:sync: specific
18+
```sh subs=true
19+
docker pull docker.elastic.co/elasticsearch/elasticsearch-wolfi:<SPECIFIC.VERSION.NUMBER>
20+
```
21+
You can download and install a specific version of the {{stack}} by replacing `<SPECIFIC.VERSION.NUMBER>` with the version number you want. For example, you can replace `<SPECIFIC.VERSION.NUMBER>` with {{version.stack.base}}.
22+
:::
23+
24+
::::

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.NUMBER>` with the {{stack}} version number you want. For example, you can replace `<SPECIFIC.VERSION.NUMBER>` 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.NUMBER>"
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.NUMBER>` with the {{stack}} version number you want. For example, you can replace `<SPECIFIC.VERSION.NUMBER>` 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.NUMBER>
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.NUMBER>` with the {{stack}} version number you want. For example, you can replace `<SPECIFIC.VERSION.NUMBER>` 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.NUMBER>
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

0 commit comments

Comments
 (0)