apm-server
apm-server copied to clipboard
Document/improve Tilt setup with local version of apm-data
When working on a local version of apm-data, as documented in the apm-data documentation, we need to make the build use a local copy of apm-data with a command similar to:
go mod edit -replace=github.com/elastic/apm-data=/path/to/your/apm-data
While this works well for a local build of apm-server, this won't work with Tilt setup which provides a very convenient end-to-end setup and makes every agent developer a "10x engineer".
Because the apm-data build happens within Docker, we need to have /path/to/your/apm-data to be within a subfolder of the apm-server repository.
In order to make this work, I had to do the following:
- within
apm-serverroot folder, clone a copy ofapm-data - add
replace github.com/elastic/apm-data => ./apm-datatogo.mod(equivalent to thego mod edit -replaceabove) - add
COPY apm-data/ /src/apm-datajust afterCOPY go.mod go.sum /src/withinpackaging/docker/Dockerfile
I think we should attempt to address the following points, and fallback to document this
- the
apm-datarepository is often cloned next toapm-server, not as a direct subfolder (minor, but could be annoying) - we need to modify the Dockerfile to make this work, otherwise the build will fail as the dockerized build can't access a folder above
apm-server
Also, it is not possible to use symbolic links within Dockerfile, as a consequence you can't simply symlink ~/dev/apm-server/apm-data to ~/dev/apm-data but you can still do the opposite and keep the apm-data checkout folder within ~/dev/apm-server.
One option would be to change our docker image building to build the apm-server binary on the host, and copy it into the image. Then all the usual go.mod functionality would work as expected.