feat!: Remove support for Compose v1

There has been no release of the deprecated 'docker-compose' Python
package since v1.29.2, which was published in May 2021[1]. This release
is currently broken due to a breaking change in the 'docker' Python
package at version 7.0.0[1], and there is seemlingly no plan to release
a patch version of Compose v1 to address the problem.

The official path forward is to use Compose v2, which is now bundled
with the Docker client and available on all platforms where Docker is
supported.

This commit additionally removes the 'version' attribute from Compose
files, since it was obsoleted in the Compose Spec[3].

Closes #1017

[1]: https://pypi.org/project/docker-compose/#history
[2]: docker/docker-py#3194
[3]: https://compose-spec.io
This commit is contained in:
Antoine Cotten
2024-09-17 09:20:56 +02:00
parent de57b24f8c
commit 24306fd49d
15 changed files with 25 additions and 42 deletions

View File

@@ -32,11 +32,11 @@ Other available stack variants:
## tl;dr
```sh
docker-compose up setup
docker compose up setup
```
```sh
docker-compose up
docker compose up
```
![Animated demo](https://user-images.githubusercontent.com/3299086/155972072-0c89d6db-707a-47a1-818b-5f976565f95a.gif)
@@ -91,7 +91,7 @@ own_. [sherifabdlnaby/elastdocker][elastdocker] is one example among others of p
### Host setup
* [Docker Engine][docker-install] version **18.06.0** or newer
* [Docker Compose][compose-install] version **1.28.0** or newer (including [Compose V2][compose-v2])
* [Docker Compose][compose-install] version **2.0.0** or newer
* 1.5 GB of RAM
> [!NOTE]
@@ -128,7 +128,7 @@ instructions from the [documentation][mac-filesharing] to add more locations.
## Usage
> [!WARNING]
> You must rebuild the stack images with `docker-compose build` whenever you switch branch or update the
> You must rebuild the stack images with `docker compose build` whenever you switch branch or update the
> [version](#version-selection) of an already existing stack.
### Bringing up the stack
@@ -142,13 +142,13 @@ git clone https://github.com/deviantony/docker-elk.git
Then, initialize the Elasticsearch users and groups required by docker-elk by executing the command:
```sh
docker-compose up setup
docker compose up setup
```
If everything went well and the setup completed without error, start the other stack components:
```sh
docker-compose up
docker compose up
```
> [!NOTE]
@@ -186,15 +186,15 @@ reset the passwords of all aforementioned Elasticsearch users to random secrets.
of them.
```sh
docker-compose exec elasticsearch bin/elasticsearch-reset-password --batch --user elastic
docker compose exec elasticsearch bin/elasticsearch-reset-password --batch --user elastic
```
```sh
docker-compose exec elasticsearch bin/elasticsearch-reset-password --batch --user logstash_internal
docker compose exec elasticsearch bin/elasticsearch-reset-password --batch --user logstash_internal
```
```sh
docker-compose exec elasticsearch bin/elasticsearch-reset-password --batch --user kibana_system
docker compose exec elasticsearch bin/elasticsearch-reset-password --batch --user kibana_system
```
If the need for it arises (e.g. if you want to [collect monitoring information][ls-monitoring] through Beats and
@@ -223,7 +223,7 @@ reset the passwords of all aforementioned Elasticsearch users to random secrets.
1. Restart Logstash and Kibana to re-connect to Elasticsearch using the new passwords
```sh
docker-compose up -d logstash kibana
docker compose up -d logstash kibana
```
> [!NOTE]
@@ -260,7 +260,7 @@ Elasticsearch data is persisted inside a volume by default.
In order to entirely shutdown the stack and remove all persisted data, use the following Docker Compose command:
```sh
docker-compose down -v
docker compose down -v
```
### Version selection
@@ -269,7 +269,7 @@ This repository stays aligned with the latest version of the Elastic stack. The
version (8.x).
To use a different version of the core Elastic components, simply change the version number inside the [`.env`](.env)
file. If you are upgrading an existing stack, remember to rebuild all container images using the `docker-compose build`
file. If you are upgrading an existing stack, remember to rebuild all container images using the `docker compose build`
command.
> [!IMPORTANT]
@@ -359,7 +359,7 @@ To run the setup container again and re-initialize all users for which a passwor
simply "up" the `setup` Compose service again:
```console
$ docker-compose up setup
$ docker compose up setup
⠿ Container docker-elk-elasticsearch-1 Running
⠿ Container docker-elk-setup-1 Created
Attaching to docker-elk-setup-1
@@ -393,7 +393,7 @@ To add plugins to any ELK component you have to:
1. Add a `RUN` statement to the corresponding `Dockerfile` (eg. `RUN logstash-plugin install logstash-filter-json`)
1. Add the associated plugin code configuration to the service configuration (eg. Logstash input/output)
1. Rebuild the images using the `docker-compose build` command
1. Rebuild the images using the `docker compose build` command
### How to enable the provided extensions
@@ -471,7 +471,6 @@ See the following Wiki pages:
[docker-install]: https://docs.docker.com/get-docker/
[compose-install]: https://docs.docker.com/compose/install/
[compose-v2]: https://docs.docker.com/compose/compose-v2/
[linux-postinstall]: https://docs.docker.com/engine/install/linux-postinstall/
[bootstrap-checks]: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
# The 'setup' service runs a one-off script which initializes users inside

View File

@@ -8,7 +8,7 @@ If you want to include the Curator extension, run Docker Compose from the root o
command line argument referencing the `curator-compose.yml` file:
```bash
$ docker-compose -f docker-compose.yml -f extensions/curator/curator-compose.yml up
$ docker compose -f docker-compose.yml -f extensions/curator/curator-compose.yml up
```
This sample setup demonstrates how to run `curator` every minute using `cron`.

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
curator:
build:

View File

@@ -70,7 +70,7 @@ To include Enterprise Search in the stack, run Docker Compose from the root of t
line argument referencing the `enterprise-search-compose.yml` file:
```console
$ docker-compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml up
$ docker compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml up
```
Allow a few minutes for the stack to start, then open your web browser at the address <http://localhost:3002> to see the
@@ -120,7 +120,7 @@ enterprise-search:
Any change to the Enterprise Search configuration requires a restart of the Enterprise Search container:
```console
$ docker-compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml restart enterprise-search
$ docker compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml restart enterprise-search
```
Please refer to the following documentation page for more details about how to configure Enterprise Search inside a

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
enterprise-search:
build:

View File

@@ -14,7 +14,7 @@ To include Filebeat in the stack, run Docker Compose from the root of the reposi
argument referencing the `filebeat-compose.yml` file:
```console
$ docker-compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml up
$ docker compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml up
```
## Configuring Filebeat
@@ -25,7 +25,7 @@ the help of the [Configuration reference][filebeat-config].
Any change to the Filebeat configuration requires a restart of the Filebeat container:
```console
$ docker-compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml restart filebeat
$ docker compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml restart filebeat
```
Please refer to the following documentation page for more details about how to configure Filebeat inside a Docker

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
filebeat:
build:

View File

@@ -21,7 +21,7 @@ To include Fleet Server in the stack, run Docker Compose from the root of the re
argument referencing the `fleet-compose.yml` file:
```console
$ docker-compose -f docker-compose.yml -f extensions/fleet/fleet-compose.yml up
$ docker compose -f docker-compose.yml -f extensions/fleet/fleet-compose.yml up
```
## Configuring Fleet Server

View File

@@ -1,10 +1,8 @@
version: '3.7'
# Example of Fleet-enrolled Elastic Agent pre-configured with an agent policy
# for running the APM Server integration (see kibana.yml).
#
# Run with
# docker-compose \
# docker compose \
# -f docker-compose.yml \
# -f extensions/fleet/fleet-compose.yml \
# -f extensions/fleet/agent-apmserver-compose.yml \

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
fleet-server:
build:

View File

@@ -13,7 +13,7 @@ To include Heartbeat in the stack, run Docker Compose from the root of the repos
argument referencing the `heartbeat-compose.yml` file:
```console
$ docker-compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml up
$ docker compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml up
```
## Configuring Heartbeat
@@ -24,7 +24,7 @@ with the help of the [Configuration reference][heartbeat-config].
Any change to the Heartbeat configuration requires a restart of the Heartbeat container:
```console
$ docker-compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml restart heartbeat
$ docker compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml restart heartbeat
```
Please refer to the following documentation page for more details about how to configure Heartbeat inside a

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
heartbeat:
build:

View File

@@ -14,7 +14,7 @@ To include Metricbeat in the stack, run Docker Compose from the root of the repo
argument referencing the `metricbeat-compose.yml` file:
```console
$ docker-compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml up
$ docker compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml up
```
## Configuring Metricbeat
@@ -25,7 +25,7 @@ with the help of the [Configuration reference][metricbeat-config].
Any change to the Metricbeat configuration requires a restart of the Metricbeat container:
```console
$ docker-compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml restart metricbeat
$ docker compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml restart metricbeat
```
Please refer to the following documentation page for more details about how to configure Metricbeat inside a

View File

@@ -1,5 +1,3 @@
version: '3.7'
services:
metricbeat:
build: