Skip to content

Commit

Permalink
standalone forwarder build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
asobrien committed Mar 31, 2020
1 parent fddd2d5 commit 040bf17
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: dep build generate clean

GOOS = linux
GOARCH = amd64
TAG = $(shell git describe --tags --always --abbrev=0)
COMMIT = $(shell git rev-parse --short HEAD)
CODENAME = hotwings

dep:
dep ensure

build:
GOOS=$(GOOS) GOARCH=$(GOARCH) go build \
-ldflags "-X github.com/DataDog/datadog-agent/pkg/version.Commit=$(COMMIT) \
-X github.com/DataDog/datadog-agent/pkg/version.AgentVersion=$(TAG)+$(CODENAME)" \
-o cmd/dogstatsd/dist/dogstatsd_$(GOOS)_$(GOARCH) \
cmd/dogstatsd/{main.go,main_nix.go}

build-darwin: GOOS=darwin
build-darwin: build

generate:
go generate cmd/dogstatsd/*.go

clean:
rm -rf cmd/dogstatsd/dist/*
38 changes: 38 additions & 0 deletions README.forwarder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Standalone Dogstatsd Forwarder
==============================
This repo extends the DataDog/datadog-agent to build a standalone forwarder.

## Prerequisites
Ensure you have all required dependencies. This requires `dep` to fulfill the
dependencies. With `dep` installed, and on your PATH you can use Makefile:

$ make dep

## Build
Building can be done with the via the Makefile. To build a linux release:

$ make build

To build a darwin binary:

$ make build-darwin

A default config file can be generated with via the Makefile:

$ make generate

Note that all build artifacts can be found under the `cmd/dogstatsd/dist/`
directory.

## Update Code
This repo just follows the upstream DataDog/datadog-agent repo with some added
files to ease building a standalone forwarder, the code can be updated with git:

$ git fetch upstream master
$ git merge --ff-only upstream/master
$ git push origin

The `upstream` is configured with git:

$ git remote add upstream https://github.com/DataDog/datadog-agent.git

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Datadog Agent

**SEE [README.forwarder.md](README.forwarder.md) for instructions specific to this repo**
[![CircleCI](https://circleci.com/gh/DataDog/datadog-agent/tree/master.svg?style=svg&circle-token=dbcee3f02b9c3fe5f142bfc5ecb735fdec34b643)](https://circleci.com/gh/DataDog/datadog-agent/tree/master)
[![Build status](https://ci.appveyor.com/api/projects/status/kcwhmlsc0oq3m49p/branch/master?svg=true)](https://ci.appveyor.com/project/Datadog/datadog-agent/branch/master)
[![Coverage status](https://codecov.io/github/DataDog/datadog-agent/coverage.svg?branch=master)](https://codecov.io/github/DataDog/datadog-agent?branch=master)
Expand Down

0 comments on commit 040bf17

Please sign in to comment.