|
| 1 | +# Integrations Testing |
| 2 | +This documents covers the steps required to make changes to the APM package in Elastic Integrations and validate using a local Elastic Stack and a local Elastic Agent. |
| 3 | + |
| 4 | +## Use Cases |
| 5 | +1. Expose new APM-Server configuration to the APM Integration |
| 6 | + |
| 7 | +## Update Integrations |
| 8 | +1. Follow the steps [here](https://github.com/elastic/integrations/blob/main/CONTRIBUTING.md) to fork and clone the integrations repo and make your changes |
| 9 | +2. Use [elastic-package](https://github.com/elastic/elastic-package) to spin up a local stack. See integrations [quick start](https://www.elastic.co/docs/extend/integrations/quick-start) guide for more details |
| 10 | +- Run the below command. This will create a local stack (Kibana, ElasticSearch, Fleet Server, etc). This will also output a couple links to the local Kibana and ElasticSearch instances. It will also contain credentials to log in to the local Kibana. |
| 11 | + |
| 12 | + ```bash |
| 13 | + elastic-package stack up -d --version 9.0.0 |
| 14 | + ``` |
| 15 | + |
| 16 | +3. Install the updated APM package |
| 17 | +- Update the `apm` integration as needed. Then run the below commands to install the updates on the Fleet Server. |
| 18 | + |
| 19 | + ```bash |
| 20 | + cd packages/apm |
| 21 | + elastic-packge build |
| 22 | + elastic-package install |
| 23 | + ``` |
| 24 | + |
| 25 | +4. Install the integration using the Kibana UI |
| 26 | +- Go to the Kibana Host: https://127.0.0.1:5601. |
| 27 | +- Then to Integrations > Installed integrations > Elastic APM. |
| 28 | +- Select `Add Elastic APM` and configure the integration/policy. |
| 29 | +- Select `Save and continue` and `Add Elastic Agent to your hosts`. Then select `Add agent`. |
| 30 | +- Copy the provided commands to download and install the Elastic Agent. |
| 31 | +
|
| 32 | +## Install an Elastic Agent |
| 33 | +1. Install the agent in a Docker container |
| 34 | +- Note: You can install the agent on your local instead with the `--develop` option as described [here](https://github.com/elastic/elastic-agent?tab=readme-ov-file#development-installations). |
| 35 | +- Start the container. |
| 36 | +
|
| 37 | + ```bash |
| 38 | + docker run --rm -it buildpack-deps:24.04 /bin/bash |
| 39 | + ``` |
| 40 | +- Next we need to add a dns bypass entry for `fleet-server` since the Elastic-Agent will use this hostname to connect to the Fleet Server in the local stack. |
| 41 | +- Run the below command and copy the ipaddress. |
| 42 | +
|
| 43 | + ```bash |
| 44 | + curl -vv host.docker.internal |
| 45 | + ``` |
| 46 | + |
| 47 | +- Then run the below command with the updated ipaddress. |
| 48 | +
|
| 49 | + ```bash |
| 50 | + echo "<ipaddress> fleet-server" >> /etc/hosts |
| 51 | + ``` |
| 52 | + |
| 53 | +2. Run the below commands within the container |
| 54 | +- This is the command provided in Kibana when you select `Add agent`. The example below has been modified for ARM and includes the required `--insecure` option. |
| 55 | + |
| 56 | + ```bash |
| 57 | + curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-9.0.1-linux-arm64.tar.gz |
| 58 | + tar xzvf elastic-agent-9.0.1-linux-arm64.tar.gz |
| 59 | + cd elastic-agent-9.0.1-linux-arm64 |
| 60 | + ./elastic-agent install --url=https://fleet-server:8220 --enrollment-token=enE0al81WUJLeTNtNjR0ZEVLNDI6Rm5ZY1pPcXl2Q3lzeWx5T0FmYVdiQQ== --install-servers --insecure |
| 61 | + ``` |
| 62 | + |
| 63 | +3. Run `elastic-agent status`. You should see a output like this: |
| 64 | + |
| 65 | + ``` |
| 66 | + ┌─ fleet |
| 67 | + │ └─ status: (HEALTHY) Connected |
| 68 | + └─ elastic-agent |
| 69 | + └─ status: (HEALTHY) Running |
| 70 | + ``` |
| 71 | + |
| 72 | +- You can also double-check the agent is healthy in Kibana under Fleet > Agents. |
| 73 | +4. The agent is now installed and running within the docker container. You can now send data to the APM server and perform any validations |
0 commit comments