Skip to content

conzetti/elastic-agent-release

Repository files navigation

Elastic Agent BOSH Release

💡 A deployment mechanism for Elastic Agent on BOSH managed virtual machines

🎬 Getting Started

Fork this repo or download one of the prebuilt releases.

NOTE: This is intended to be used as a BOSH addon

⚙️ Create a BOSH runtime configuration

Example runtime configuration YAML to run on a variety of Ubuntu Linux stemcells

releases:
- name: elastic-agent
  version: 2.0.0

addons:
- name: elastic-agent
  jobs:
  - name: elastic-agent
    release: elastic-agent
    properties:
      fleet:
        enrollment_token: Zm9vOmJhego=
        url: https://foobaz.fleet.us-east4.gcp.elastic-cloud.com
      tags:
      - sandbox
      - cloudfoundry
    exclude:
      deployments:
      - bosh-health
    include:
      lifecycle: service
      stemcell:
      - os: ubuntu-xenial
      - os: ubuntu-jammy

📣 See the Platform Automation Documentation for help including this with Ops Manager deployed BOSH

🔨 Building an updated release

  • Clone this repo and navigate to elastic-agent-release/

    git clone [email protected]:conzetti/elastic-agent-release.git
    pushd elastic-agent-release/
  • Print out the current "blobs"

    bosh blobs
    Path                                      Size     Blobstore ID                          Digest
    elastic-agent-8.10.4-linux-x86_64.tar.gz  535 MiB  8c37c4fb-fe2c-4b08-7f63-3846b10a175f  sha256:c789cc3b68453c5c45992ec86b9c2624acd13346a726e20a34064dcd223e470b
    
    1 blobs
    
    Succeeded
  • Purge the current blob for the Elastic Agent

    bosh remove-blob elastic-agent-8.10.2-linux-x86_64.tar.gz
  • Gather the latest Elastic Agent via one of the following methods

    • Manually download from https://www.elastic.co/downloads/elastic-agent
    • Using wget && jq

      wget https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-$(wget -qO - https://api.github.com/repos/elastic/elastic-agent/tags\?per_page\=1 | jq -r '.[].name | capture("(?<v>[[:digit:].]+)").v')-linux-x86_64.tar.gz

    • Using curl && jq

      curl https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-$(curl -s GET https://api.github.com/repos/elastic/elastic-agent/tags\?per_page\=1 | jq -r '.[].name| capture("(?<v>[[:digit:].]+)").v')-linux-x86_64.tar.gz --output elastic-agent-$(curl -s GET https://api.github.com/repos/elastic/elastic-agent/tags\?per_page\=1 | jq -r '.[].name | capture("(?<v>[[:digit:].]+)").v')-linux-x86_64.tar.gz

  • Add the updated agent to the BOSH blob store

    bosh add-blob ~/Downloads/elastic-agent-8.10.4-linux-x86_64.tar.gz elastic-agent-8.10.4-linux-x86_64.tar.gz
  • Optionally upload the blobs to S3 (not required for offline or local development)

bosh upload-blobs
  • Amend the following files with the updated agent filename

    packages/elastic-agent/spec
    
  • Generate a release tarball

    bosh create-release \
      --name elastic-agent-release \
      --version 2.0.0 \
      --tarball /tmp/release.tgz \
      --[force | final]
  • NOTE: When crafting your runtime.yml, be sure to reference the updated release version (and make sure that you've uploaded the new release to BOSH)