Skip to content

Commit

Permalink
Merge pull request #1 from rebuy-de/initial
Browse files Browse the repository at this point in the history
Initial
  • Loading branch information
stephanlindauer authored Sep 24, 2018
2 parents c5fe462 + c0a1ea5 commit a0f1f27
Show file tree
Hide file tree
Showing 19 changed files with 916 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor
/cost-exporter*
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
sudo: required

language: go

services:
- docker

script:
- docker build -t cost-exporter --target builder --no-cache .
- >
docker run
--name cost-exporter
--entrypoint "sh"
-e CGO_ENABLED=0
--workdir "/go/src/github.com/rebuy-de/cost-exporter"
cost-exporter
-euxc "make xc && mkdir releases && mv cost-exporter-* releases"
- docker cp -L cost-exporter:/go/src/github.com/rebuy-de/cost-exporter/releases ./releases
- ls -l *

deploy:
provider: releases
api_key: $GITHUB_TOKEN
file_glob: true
file: releases/*
skip_cleanup: true
on:
repo: rebuy-de/cost-exporter
tags: true
28 changes: 27 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
FROM golang:1.10-alpine
FROM golang:1.10-alpine as builder

RUN apk add --no-cache git make

# Configure Go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin

# Install Go Tools
RUN go get -u github.com/golang/lint/golint
RUN go get -u github.com/golang/dep/cmd/dep

COPY . /go/src/github.com/rebuy-de/cost-exporter
WORKDIR /go/src/github.com/rebuy-de/cost-exporter
RUN CGO_ENABLED=0 make install

FROM alpine:latest

RUN apk add --no-cache ca-certificates

COPY --from=builder /go/bin/cost-exporter /usr/local/bin/
COPY run.sh /run.sh

RUN chmod +x /run.sh

ENTRYPOINT ["/run.sh"]
238 changes: 238 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[constraint]]
name = "github.com/rebuy-de/rebuy-go-sdk"
version = "1.2.0"

[[constraint]]
name = "github.com/prometheus/client_golang"
version = "0.8.0"

[[constraint]]
name = "github.com/aws/aws-sdk-go"
version = "1.15.4"

[[constraint]]
name = "github.com/robfig/cron"
version = "1.1.0"
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PACKAGE=github.com/rebuy-de/cost-exporter

include golang.mk
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
# cost-exporter
Retrieves cost metrics and core counts from the AWS API and exposes this information via a Prometheus /metrics endpoint.

[![Build Status](https://travis-ci.org/rebuy-de/cost-exporter.svg?branch=master)](https://travis-ci.org/rebuy-de/cost-exporter)
[![license](https://img.shields.io/github/license/rebuy-de/cost-exporter.svg)]()

Retrieves cost metrics and core counts from the AWS API and exposes this information via a Prometheus `/metrics` endpoint.

> **Development Status** *cost-exporter* is for internal use only. Feel free to use
> it, but expect big unanounced changes at any time. Furthermore we are very
> restrictive about code changes, therefore you should communicate any changes
> before working on an issue.

## Installation

Docker containers are are provided [here](https://quay.io/repository/rebuy/cost-exporter). To obtain the latest docker image run `docker pull quay.io/rebuy/cost-exporter:master`.

To compile *cost-exporter* from source you need a working
[Golang](https://golang.org/doc/install) development environment. The sources
must be cloned to `$GOPATH/src/github.com/rebuy-de/cost-exporter`.

Also you need to install [godep](github.com/golang/dep/cmd/dep),
[golint](https://github.com/golang/lint/) and [GNU
Make](https://www.gnu.org/software/make/).

Then you just need to run `make build` to compile a binary into the project
directory or `make install` to install *cost-exporter* into `$GOPATH/bin`. With
`make xc` you can cross compile *cost-exporter* for other platforms.


## Usage

**node-drainer**'s configuration is done using an configuration file that is pointed to when running the command, as well as a flag that defines the port it should listen on:
```
cost-exporter --config=/cost-exporter/config.yaml --port=8080
```

For more information, run:
```
cost-exporter --help
```


### Running in Kubernetes

Please see the `example/k8s/` directory for an example of how to run `cost-exporter` in Kubernetes.
Loading

0 comments on commit a0f1f27

Please sign in to comment.