Skip to content

Commit 6617e74

Browse files
cmacknzycombinator
andauthored
Link to ARCHITECTURE.md from README.md (#2341)
* Link to the architecture.md file. Clean up the build instructions. * Fix header levels. * Update README.md Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com> --------- Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
1 parent 2c41221 commit 6617e74

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

README.md

+33-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Elastic Agent
22

3+
## Architecture
4+
5+
See [ARCHITECTURE.md](ARCHITECTURE.md)
6+
37
## Developer docs
48

59
The source files for the general Elastic Agent documentation are currently stored
@@ -23,49 +27,48 @@ summary: Fix a panic caused by a race condition when installing the Elastic Agen
2327
pr: https://github.com/elastic/elastic-agent/pull/823
2428
```
2529
26-
## Testing
30+
### Packaging
2731
2832
Prerequisites:
2933
- installed [mage](https://github.com/magefile/mage)
3034
- [Docker](https://docs.docker.com/get-docker/)
3135
- [X-pack](https://github.com/elastic/beats/tree/main/x-pack) to pre-exist in the parent folder of the local Git repository checkout
3236
- [elastic-agent-changelog-tool](https://github.com/elastic/elastic-agent-changelog-tool) to add changelog fragments for changelog generation
3337
34-
If you are on a Mac with M1 chip, don't forget to export some docker variable to be able to build for AMD
35-
```
36-
export DOCKER_BUILDKIT=0
37-
export COMPOSE_DOCKER_CLI_BUILD=0
38-
export DOCKER_DEFAULT_PLATFORM=linux/amd64
39-
```
38+
To build a local version of the agent for development, run the command below. The following platforms are supported:
39+
* darwin/amd64
40+
* darwin/arm64
41+
* linux/amd64
42+
* linux/arm64
43+
* windows/amd64
4044
41-
If you are on a Mac with M1 chip, don't forget to export some docker variable to be able to build for AMD
42-
```
43-
export DOCKER_BUILDKIT=0
44-
export COMPOSE_DOCKER_CLI_BUILD=0
45-
export DOCKER_DEFAULT_PLATFORM=linux/amd64
45+
```sh
46+
# DEV=true disable signature verification to allow replacing binaries in the components sub-directory of the package.
47+
# EXTERNAL=true downloads the matching version of the binaries that are packaged with agent (Beats for example).
48+
# SNAPSHOT=true indicates that this is a snapshot version and not a release version.
49+
# PLATFORMS=linux/amd64 builds an agent that will run on 64 bit Linux systems.
50+
# PACKAGES=tar.gz produces a tar.gz package
51+
DEV=true EXTERNAL=true SNAPSHOT=true PLATFORMS=linux/amd64 PACKAGES=tar.gz mage -v package
4652
```
4753

48-
If you are on a Mac with M1 chip, don't forget to export some docker variable to be able to build for AMD
49-
```
50-
export DOCKER_BUILDKIT=0
51-
export COMPOSE_DOCKER_CLI_BUILD=0
52-
export DOCKER_DEFAULT_PLATFORM=linux/amd64
53-
```
54+
The resulting package will be produced in the build/distributions directory. The version is controlled by the value in [version.go](version/version.go).
55+
To install the agent extract the package and run the install command:
5456

55-
If you are on a Mac with M1 chip, don't forget to export some docker variable to be able to build for AMD
56-
```
57-
export DOCKER_BUILDKIT=0
58-
export COMPOSE_DOCKER_CLI_BUILD=0
59-
export DOCKER_DEFAULT_PLATFORM=linux/amd64
57+
```sh
58+
cd build/distributions
59+
tar xvfz build/distributions/elastic-agent-8.8.0-SNAPSHOT-darwin-aarch64.tar.gz
60+
cd build/distributions/elastic-agent-8.8.0-SNAPSHOT-darwin-aarch64
61+
sudo elastic-agent install
6062
```
6163

62-
In Linux operating systems that you can not run docker as a root user you need to follow [linux-postinstall steps](https://docs.docker.com/engine/install/linux-postinstall/)
64+
For basic use the agent binary can be run directly, with the `sudo elastic-agent run` command.
6365

64-
### Testing docker container
66+
### Docker
6567

6668
Running Elastic Agent in a docker container is a common use case. To build the Elastic Agent and create a docker image run the following command:
6769

6870
```
71+
# Use PLATFORMS=linux/arm64 if you are using an ARM based Mac.
6972
DEV=true SNAPSHOT=true PLATFORMS=linux/amd64 PACKAGES=docker mage package
7073
```
7174

@@ -147,27 +150,27 @@ kubectl -n kube-system get pods -l app=elastic-agent
147150
## Testing on Elastic Cloud
148151
149152
Elastic employees can create an Elastic Cloud deployment with a locally
150-
built Elastic Agent, by pushing images to an internal Docker repository. The images will be
153+
built Elastic Agent, by pushing images to an internal Docker repository. The images will be
151154
based on the SNAPSHOT images with the version defined in `version/version.go`.
152155
153156
Prerequisite to running following commands is having `terraform` installed and running `terraform init` from within `testing/environments/cloud`.
154157
155158
Running a shorthand `make deploy_local` in `testing/environments/cloud` will build Agent, tag the docker image correctly, push it to the repository and deploy to Elastic Cloud.
156159
157160
For more advanced scenarios:
158-
Running `make build_elastic_agent_docker_image` in `testing/environments/cloud` will build and push the images.
161+
Running `make build_elastic_agent_docker_image` in `testing/environments/cloud` will build and push the images.
159162
Running `make push_elastic_agent_docker_image` in `testing/environments/cloud` will publish built docker image to CI docker repository.
160163
161-
Once docker images are published you can run `EC_API_KEY=your_api_key make apply` from `testing/environments/cloud` directory to deploy them to Elastic Cloud.
164+
Once docker images are published you can run `EC_API_KEY=your_api_key make apply` from `testing/environments/cloud` directory to deploy them to Elastic Cloud.
162165
To get `EC_API_KEY` follow [this guide](https://www.elastic.co/guide/en/cloud/current/ec-api-authentication.html)
163166
164167
The custom images are tagged with the current version, commit and timestamp. The
165168
timestamp is included to force a new Docker image to be used, which enables pushing new
166169
binaries without recreating the deployment.
167170
168-
To specify custom images create your `docker_image.auto.tfvars` file similar to `docker_image.auto.tfvars.sample`.
171+
To specify custom images create your `docker_image.auto.tfvars` file similar to `docker_image.auto.tfvars.sample`.
169172
170-
You can also use `mage cloud:image` and `mage cloud:push` respectively from repo root directory.
173+
You can also use `mage cloud:image` and `mage cloud:push` respectively from repo root directory.
171174
To deploy your changes use `make apply` (from `testing/environments/cloud`) with `EC_API_KEY` instead of `make deploy_local` described above.
172175
173176
SNAPSHOT images are used by default. To use non-snapshot image specify `SNAPSHOT=false` explicitly.

0 commit comments

Comments
 (0)