zmoog / public-notes

Apache License 2.0
0 stars 1 forks source link

Figure out how to setup a linux machine to build Beats and Agent #55

Open zmoog opened 9 months ago

zmoog commented 9 months ago

I want to set up a Linux virtual machine to run build for Beats and Agent.

zmoog commented 9 months ago

Note: this is a dump of a few notes I copy & pasted from a terminal session.

Build Beats

DEV=true \
    SNAPSHOT=false \
    AGENT_DROP_PATH=~/tmp/agent_drop_path PLATFORMS="linux/amd64" \
    PACKAGES="docker" \
    mage -v clean package

Dependencies

sudo dnf install git htop docker tmux
sudo yum groupinstall "Development Tools"

asdf

4  git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3
5  asdf plugin add golang https://github.com/kennyp/asdf-golang.git
6  . "$HOME/.asdf/asdf.sh"
7  . "$HOME/.asdf/completions/asdf.bash"
8  asdf plugin add golang https://github.com/kennyp/asdf-golang.git
9  asdf install golang v

10 asdf install golang 1.19.9

docker

sudo usermod -a -G docker ec2-user
newgrp docker
sudo systemctl start docker.service
sudo systemctl enable docker.service

Testing

$ export ENROLLMENT_TOKEN="`pbpaste`"
$ export FLEET_URL="https://123.fleet.eastus2.azure.elastic-cloud.com:443"
$ docker run \
    --name "elastic-agent-escalation" \
    --env FLEET_ENROLL=1 \
    --env FLEET_URL=${FLEET_URL} \
    --env FLEET_ENROLLMENT_TOKEN=${ENROLLMENT_TOKEN} --rm zmoog/elastic-agent:8.7.2a

curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.7.1-linux-x86_64.tar.gz
tar xzvf elastic-agent-8.7.1-linux-x86_64.tar.gz
cd elastic-agent-8.7.1-linux-x86_64
sudo ./elastic-agent install --url=https://123.fleet.westus2.azure.elastic-cloud.com:443 --enrollment-token=123