Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/howto/system_benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ To use environment variables within the Terraform service deployer a `env.yml` f
The file should be structured like this:

```yaml
version: '2.3'
services:
terraform:
environment:
Expand Down
6 changes: 0 additions & 6 deletions docs/howto/system_testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ the log files from your package's integration service must be written to a volum
the following definition in it's integration service's `docker-compose.yml` file.

```yaml
version: '2.3'
services:
apache:
# Other properties such as build, ports, etc.
Expand All @@ -95,7 +94,6 @@ For example docker images for MySQL include a volume for the data directory
tests are executed, a volume can be added to the `docker-compose.yml`:

```yaml
version: '2.3'
services:
mysql:
# Other properties such as build, ports, etc.
Expand All @@ -118,7 +116,6 @@ This is useful if you need different capabilities than the provided by the

`custom-agent.yml`
```yaml
version: '2.3'
services:
docker-custom-agent:
pid: host
Expand All @@ -131,7 +128,6 @@ services:
This will result in an agent configuration such as:

```yaml
version: '2.3'
services:
docker-custom-agent:
hostname: docker-custom-agent
Expand Down Expand Up @@ -196,7 +192,6 @@ RUN apt-get update && apt-get -y install \
```
An example for `custom-agent.yml` in multi-service setup is as below
```yaml
version: '2.3'
services:
docker-custom-agent:
build:
Expand Down Expand Up @@ -328,7 +323,6 @@ To use environment variables within the Terraform service deployer a `env.yml` f
The file should be structured like this:

```yaml
version: '2.3'
services:
terraform:
environment:
Expand Down
1 change: 0 additions & 1 deletion internal/agentdeployer/_static/docker-agent-base.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.3"
services:
elastic-agent:
hostname: ${AGENT_HOSTNAME}
Expand Down
19 changes: 5 additions & 14 deletions internal/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type Project struct {
name string
composeFilePaths []string

dockerComposeV1 bool
dockerComposeStandalone bool
disableANSI bool
disablePullProgressInformation bool
Expand Down Expand Up @@ -199,20 +198,15 @@ func NewProject(name string, paths ...string) (*Project, error) {
// Passing a nil context here because we are on initialization.
ver, err := c.dockerComposeVersion(context.Background())
if err != nil {
logger.Errorf("Unable to determine Docker Compose version: %v. Defaulting to 1.x", err)
c.dockerComposeV1 = true
return &c, nil
return nil, fmt.Errorf("unable to determine Docker Compose version: %w", err)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this an error now, the main reason for this to fail is that docker compose command is not found.

}

versionMessage := fmt.Sprintf("Determined Docker Compose version: %v", ver)
if ver.Major() == 1 {
versionMessage = fmt.Sprintf("%s, the tool will use Compose V1", versionMessage)
c.dockerComposeV1 = true
if ver.Major() < 2 {
return nil, fmt.Errorf("required Docker Compose v2, found %s", ver.String())
}
logger.Debug(versionMessage)
logger.Debugf("Determined Docker Compose version: %v", ver)

v, ok = os.LookupEnv(DisableVerboseOutputComposeEnv)
if !c.dockerComposeV1 && ok && strings.ToLower(v) != "false" {
if ok && strings.ToLower(v) != "false" {
if c.composeVersion.LessThan(semver.MustParse("2.19.0")) {
c.disableANSI = true
} else {
Expand Down Expand Up @@ -543,8 +537,5 @@ func (p *Project) dockerComposeVersion(ctx context.Context) (*semver.Version, er

// ContainerName method the container name for the service.
func (p *Project) ContainerName(serviceName string) string {
if p.dockerComposeV1 {
return fmt.Sprintf("%s_%s_1", p.name, serviceName)
}
return fmt.Sprintf("%s-%s-1", p.name, serviceName)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.3"
services:
docker-custom-agent:
image: "${ELASTIC_AGENT_IMAGE_REF}"
Expand Down
1 change: 0 additions & 1 deletion internal/servicedeployer/_static/terraform_deployer.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2.3'
services:
terraform:
build: .
Expand Down
1 change: 0 additions & 1 deletion internal/stack/_static/docker-compose-stack.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{ $username := fact "username" }}
{{ $password := fact "password" }}
{{ $apm_enabled := fact "apm_enabled" }}
version: '2.4'
services:
elasticsearch:
image: "${ELASTICSEARCH_IMAGE_REF}"
Expand Down
1 change: 0 additions & 1 deletion internal/stack/_static/serverless-docker-compose.yml.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2.4'
services:
elastic-agent:
image: "{{ fact "agent_image" }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.3"
services:
cisco-logfile:
image: alpine
Expand Down