Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
consulthys committed Aug 18, 2016
0 parents commit 160ceaa
Show file tree
Hide file tree
Showing 27 changed files with 1,459 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
/.idea
/build

.DS_Store
/springbeat
/springbeat.test
*.pyc
43 changes: 43 additions & 0 deletions .travis.yml
@@ -0,0 +1,43 @@
sudo: required
dist: trusty
services:
- docker

language: go

go:
- 1.6

os:
- linux
- osx

env:
matrix:
- TARGETS="check"
- TARGETS="-C springbeat testsuite"

global:
# Cross-compile for amd64 only to speed up testing.
- GOX_FLAGS="-arch amd64"

addons:
apt:
packages:
- python-virtualenv

before_install:
# Redo the travis setup but with the elastic/libbeat path. This is needed so the package path is correct
- mkdir -p $HOME/gopath/src/github.com/elastic/beats/
- rsync -az ${TRAVIS_BUILD_DIR}/ $HOME/gopath/src/github.com/elastic/beats/
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/elastic/beats/
- cd $HOME/gopath/src/github.com/elastic/beats/

install:
- true

script:
- make $TARGETS

after_success:
# Copy full.cov to coverage.txt because codecov.io requires this file
Empty file added CONTRIBUTING.md
Empty file.
13 changes: 13 additions & 0 deletions LICENSE
@@ -0,0 +1,13 @@
Copyright (c) 2016 Val Crettaz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
42 changes: 42 additions & 0 deletions Makefile
@@ -0,0 +1,42 @@
BEATNAME=springbeat
BEAT_DIR=github.com/consulthys
SYSTEM_TESTS=false
TEST_ENVIRONMENT=false
ES_BEATS=./vendor/github.com/elastic/beats
GOPACKAGES=$(shell glide novendor)
PREFIX?=.

# Path to the libbeat Makefile
-include $(ES_BEATS)/libbeat/scripts/Makefile

.PHONY: init
init:
glide update --no-recursive
make update
git init

.PHONY: commit
commit:
git add README.md CONTRIBUTING.md
git commit -m "Initial commit"
git add LICENSE
git commit -m "Add the LICENSE"
git add .gitignore
git commit -m "Add git settings"
git add .
git reset -- .travis.yml
git commit -m "Add springbeat"
git add .travis.yml
git commit -m "Add Travis CI"

.PHONY: update-deps
update-deps:
glide update --no-recursive --strip-vcs

# This is called by the beats packer before building starts
.PHONY: before-build
before-build:

# Create binary packages for the beat
pack: create-packer
cd dev-tools/packer; make deps images springbeat
142 changes: 142 additions & 0 deletions README.md
@@ -0,0 +1,142 @@
# Springbeat

Welcome to Springbeat.

**Important Notes:**
1. For now, only two endpoints are supported, namely `/metrics` and `/health`. We'll add [more endpoints](http://docs.spring.io/spring-boot/docs/1.4.0.RELEASE/reference/htmlsingle/#production-ready-endpoints) as we go
2. This plugin will only work if your Spring Boot application has the `spring-boot-starter-actuator` dependency

```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
```

Ensure that this folder is at the following location:
`${GOPATH}/github.com/consulthys`

## Getting Started with Springbeat

### Requirements

* [Golang](https://golang.org/dl/) 1.6
* [Glide](https://github.com/Masterminds/glide) >= 0.10.0

### Init Project
To get running with Springbeat, run the following command:

```
make init
```

To commit the first version before you modify it, run:

```
make commit
```

It will create a clean git history for each major step. Note that you can always rewrite the history if you wish before pushing your changes.

To push Springbeat in the git repository, run the following commands:

```
git remote set-url origin https://github.com/consulthys/springbeat
git push origin master
```

For further development, check out the [beat developer guide](https://www.elastic.co/guide/en/beats/libbeat/current/new-beat.html).

### Build

To build the binary for Springbeat run the command below. This will generate a binary
in the same directory with the name springbeat.

```
make
```


### Run

To run Springbeat with debugging output enabled, run:

```
./springbeat -c springbeat.yml -e -d "*"
```


### Test

To test Springbeat, run the following command:

```
make testsuite
```

alternatively:
```
make unit-tests
make system-tests
make integration-tests
make coverage-report
```

The test coverage is reported in the folder `./build/coverage/`


### Package

To be able to package Springbeat the requirements are as follows:

* [Docker Environment](https://docs.docker.com/engine/installation/) >= 1.10
* $GOPATH/bin must be part of $PATH: `export PATH=${PATH}:${GOPATH}/bin`

To cross-compile and package Springbeat for all supported platforms, run the following commands:

```
cd dev-tools/packer
make deps
make images
make
```

### Update

Each beat has a template for the mapping in elasticsearch and a documentation for the fields
which is automatically generated based on `etc/fields.yml`.
To generate etc/springbeat.template.json and etc/springbeat.asciidoc

```
make update
```


### Cleanup

To clean Springbeat source code, run the following commands:

```
make fmt
make simplify
```

To clean up the build directory and generated artifacts, run:

```
make clean
```


### Clone

To clone Springbeat from the git repository, run the following commands:

```
mkdir -p ${GOPATH}/github.com/consulthys
cd ${GOPATH}/github.com/consulthys
git clone https://github.com/consulthys/springbeat
```


For further development, check out the [beat developer guide](https://www.elastic.co/guide/en/beats/libbeat/current/new-beat.html).

0 comments on commit 160ceaa

Please sign in to comment.