Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into use_upstream_mani…
Browse files Browse the repository at this point in the history
…fest_to_deploy_agent_on_k8s
  • Loading branch information
MichaelKatsoulis committed Aug 2, 2021
2 parents 7d44d2d + b7d8e15 commit cb63b32
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
12 changes: 6 additions & 6 deletions internal/profile/static_snapshot_yml.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const SnapshotFile configFile = "snapshot.yml"
const snapshotYml = `version: '2.3'
services:
elasticsearch:
image: ${ELASTICSEARCH_IMAGE_REF}
image: "${ELASTICSEARCH_IMAGE_REF}"
healthcheck:
test: ["CMD", "curl", "-f", "-u", "elastic:changeme", "http://127.0.0.1:9200/"]
retries: 300
Expand Down Expand Up @@ -44,7 +44,7 @@ services:
condition: service_healthy
kibana:
image: ${KIBANA_IMAGE_REF}
image: "${KIBANA_IMAGE_REF}"
depends_on:
elasticsearch:
condition: service_healthy
Expand All @@ -69,9 +69,9 @@ services:
package-registry:
build:
context: ../../../
dockerfile: ${STACK_PATH}/Dockerfile.package-registry
dockerfile: "${STACK_PATH}/Dockerfile.package-registry"
args:
PROFILE: ${PROFILE_NAME}
PROFILE: "${PROFILE_NAME}"
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8080"]
retries: 300
Expand All @@ -86,7 +86,7 @@ services:
condition: service_healthy
fleet-server:
image: ${ELASTIC_AGENT_IMAGE_REF}
image: "${ELASTIC_AGENT_IMAGE_REF}"
depends_on:
elasticsearch:
condition: service_healthy
Expand Down Expand Up @@ -114,7 +114,7 @@ services:
condition: service_healthy
elastic-agent:
image: ${ELASTIC_AGENT_IMAGE_REF}
image: "${ELASTIC_AGENT_IMAGE_REF}"
depends_on:
fleet-server:
condition: service_healthy
Expand Down
13 changes: 12 additions & 1 deletion internal/stack/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ func dockerComposeBuild(options Options) error {
return errors.Wrap(err, "could not create docker compose project")
}

appConfig, err := install.Configuration()
if err != nil {
return errors.Wrap(err, "can't read application configuration")
}

opts := compose.CommandOptions{
Env: options.Profile.ComposeEnvVars(),
Env: append(appConfig.StackImageRefs(options.StackVersion).AsEnv(), options.Profile.ComposeEnvVars()...),
Services: withIsReadyServices(withDependentServices(options.Services)),
}

Expand Down Expand Up @@ -87,7 +92,13 @@ func dockerComposeDown(options Options) error {
return errors.Wrap(err, "could not create docker compose project")
}

appConfig, err := install.Configuration()
if err != nil {
return errors.Wrap(err, "can't read application configuration")
}

downOptions := compose.CommandOptions{
Env: append(appConfig.StackImageRefs(options.StackVersion).AsEnv(), options.Profile.ComposeEnvVars()...),
// Remove associated volumes.
ExtraArgs: []string{"--volumes"},
}
Expand Down
10 changes: 9 additions & 1 deletion internal/stack/shellinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"gopkg.in/yaml.v3"

"github.com/elastic/elastic-package/internal/compose"
"github.com/elastic/elastic-package/internal/install"
"github.com/elastic/elastic-package/internal/profile"
)

Expand Down Expand Up @@ -55,7 +56,14 @@ func ShellInit(elasticStackProfile *profile.Profile) (string, error) {
return "", errors.Wrap(err, "could not create docker compose project")
}

serviceComposeConfig, err := p.Config(compose.CommandOptions{})
appConfig, err := install.Configuration()
if err != nil {
return "", errors.Wrap(err, "can't read application configuration")
}

serviceComposeConfig, err := p.Config(compose.CommandOptions{
Env: append(appConfig.StackImageRefs(install.DefaultStackVersion).AsEnv(), elasticStackProfile.ComposeEnvVars()...),
})
if err != nil {
return "", errors.Wrap(err, "could not get Docker Compose configuration for service")
}
Expand Down

0 comments on commit cb63b32

Please sign in to comment.