Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose service deployer - Provide a volume to share data with elastic-agent #1852

Open
andrewkroh opened this issue May 22, 2024 · 1 comment

Comments

@andrewkroh
Copy link
Member

On Linux, bind mounting the host-based SERVICE_LOGS_DIR into a container can cause permissions problems for elastic-package when the service writes files as root. You can get failures like:

Error: error running package system tests: could not complete test run: could not setup service: removing service logs failed: readdir failed (path: /opt/buildkite-agent/.elastic-package/tmp/service_logs): open /opt/buildkite-agent/.elastic-package/tmp/service_logs: permission denied

Instead of using a host bind-mount, elastic-package could create volume and mount it inside the elastic-agent container. Then when a service want to share logs with the elastic-agent, it can mount the volume instead of SERVICE_LOGS_DIR. This would look like

# ./profiles/default/stack/docker-compose.yml
services:
  elastic-agent:
    volumes:
      - elastic_agent_volume:/elastic_agent_volume

volumes:
  elastic_agent_volume:
    # Prevent docker-compose from prefixing the volume name.
    name: elastic_agent_volume

Then in the integration deployment it refers to an external volume.

# _dev/deploy/docker/docker-compose.yml
version: '3.0'
services:
  gitlab:
    image: gitlab/gitlab-ce:${SERVICE_VERSION}
    volumes:
      - elastic_agent_volume:/var/log/gitlab/gitlab-rails

volumes:
  elastic_agent_volume:
    # To indicate that docker-compose should not create this volume.
    external: true

Related

@jsoriano
Copy link
Member

For the transparent migration of the docker-compose.yml files that use SERVICE_LOGS_DIR we could append the new volume definition, and set SERVICE_LOGS_DIR to elastic_agent_volume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants