Skip to content

Commit

Permalink
feat(update): minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcrea committed Sep 28, 2018
1 parent 7594d25 commit 5a6a165
Show file tree
Hide file tree
Showing 9 changed files with 592 additions and 114 deletions.
4 changes: 4 additions & 0 deletions .env.default
@@ -1,5 +1,9 @@
# Docker
CONTAINER_NAMESPACE=
TELEGRAF_VERSION=1.8-alpine
INFLUXDB_VERSION=1.6-alpine
CHRONOGRAF_VERSION=1.6-alpine
KAPACITOR_VERSION=1.5-alpine

# Nginx
INFLUXDB_HOST=influxdb.company.io
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,4 +1,5 @@
volumes/
.history/
.idea/
.env
.remote-sync.json
.remote-sync.json
6 changes: 4 additions & 2 deletions Makefile
@@ -1,7 +1,9 @@
SHELL := /bin/bash

all: build

exec:
@docker-compose exec influxdb /bin/sh
bash:
@bash scripts/bash.sh influxdb

pull:
@bash scripts/pull.sh
Expand Down
23 changes: 23 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,29 @@ Working `docker-compose.yml` for official [influxdata](https://www.influxdata.co

Made to work behind a separate automated [nginx-proxy](https://github.com/jwilder/nginx-proxy) with SSL support via letsencrypt.

## Docs

- [telegraf](https://docs.influxdata.com/telegraf/v1.8/administration/configuration/)
- [influxdb](https://docs.influxdata.com/influxdb/v1.6/administration/config/)

## Configuration

- [telegraf](https://github.com/influxdata/telegraf/blob/release-1.8/etc/telegraf.conf)

Generate an up-to-date sample telegraf config

```bash
bash scripts/bash.sh telegraf "telegraf config" > /tmp/telegraf.conf
```

- [influxdb](https://raw.githubusercontent.com/influxdata/influxdb/1.6/etc/config.sample.toml)

Generate an up-to-date sample telegraf config

```bash
bash scripts/bash.sh influxdb "influxd config" > /tmp/influxd.conf
```

## Quickstart

- You can quickly start your compose gitlab instance (requires a working automated nginx_proxy compose instance)
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Expand Up @@ -2,7 +2,7 @@
version: '3.3'
services:
telegraf:
image: telegraf:1.6-alpine
image: telegraf:${TELEGRAF_VERSION}
command: -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
restart: always
container_name: ${CONTAINER_NAMESPACE}telegraf
Expand All @@ -16,7 +16,7 @@ services:
- default

influxdb:
image: influxdb:1.5-alpine
image: influxdb:${INFLUXDB_VERSION}
restart: always
container_name: ${CONTAINER_NAMESPACE}influxdb
hostname: influxdb
Expand All @@ -35,7 +35,7 @@ services:
nginx_proxy:

chronograf:
image: chronograf:1.5-alpine
image: chronograf:${CHRONOGRAF_VERSION}
restart: always
container_name: ${CONTAINER_NAMESPACE}chronograf
hostname: chronograf
Expand All @@ -61,7 +61,7 @@ services:
nginx_proxy:

kapacitor:
image: kapacitor:1.5-alpine
image: kapacitor:${KAPACITOR_VERSION}
restart: always
container_name: ${CONTAINER_NAMESPACE}kapacitor
hostname: kapacitor
Expand Down
24 changes: 24 additions & 0 deletions scripts/bash.sh
@@ -0,0 +1,24 @@
source .env

CMD=${2:-"/bin/sh"}

case "$1" in
"telegraf")
DOCKER_IMAGE="${1}:${TELEGRAF_VERSION}"
;;
"influxdb")
DOCKER_IMAGE="${1}:${INFLUXDB_VERSION}"
;;
"chronograf")
DOCKER_IMAGE="${1}:${CHRONOGRAF_VERSION}"
;;
"kapacitor")
DOCKER_IMAGE="${1}:${KAPACITOR_VERSION}"
;;
*)
DOCKER_IMAGE="ubuntu:16.04"
;;
esac

>&2 echo "$ docker run --rm --net=host -it ${DOCKER_IMAGE} ${CMD}"
docker run --rm --net=host -it ${DOCKER_IMAGE} ${CMD}
8 changes: 4 additions & 4 deletions scripts/build.sh
@@ -1,11 +1,11 @@
set -a
source .env

echo "Building \"telegraf.conf\" via envsubst"
>&2 echo "Building \"telegraf.conf\" via envsubst"
envsubst < templates/telegraf.conf > "volumes/config/telegraf.conf"
echo "Building \"influxdb.conf\" via envsubst"
>&2 echo "Building \"influxdb.conf\" via envsubst"
envsubst < templates/influxdb.conf > "volumes/config/influxdb.conf"
echo "Building \"kapacitor.conf\" via envsubst"
>&2 echo "Building \"kapacitor.conf\" via envsubst"
envsubst < templates/kapacitor.conf > "volumes/config/kapacitor.conf"

ENV_VARS=""
Expand All @@ -19,7 +19,7 @@ if [[ -v INFLUXDB_READ_USER_PASSWORD ]]; then ENV_VARS="${ENV_VARS} -e INFLUXDB_
if [[ -v INFLUXDB_WRITE_USER ]]; then ENV_VARS="${ENV_VARS} -e INFLUXDB_WRITE_USER=${INFLUXDB_WRITE_USER}"; fi
if [[ -v INFLUXDB_WRITE_USER_PASSWORD ]]; then ENV_VARS="${ENV_VARS} -e INFLUXDB_WRITE_USER_PASSWORD=${INFLUXDB_WRITE_USER_PASSWORD}"; fi

echo "Initializing InfluxDB database"
>&2 echo "Initializing InfluxDB database"
docker run --rm $ENV_VARS \
-v $PWD/volumes/config/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
-v $PWD/volumes/influxdb:/var/lib/influxdb:rw \
Expand Down
1 change: 1 addition & 0 deletions scripts/pull.sh
Expand Up @@ -7,4 +7,5 @@
# docker pull chronograf:${CHRONOGRAF_VERSION}
# docker pull kapacitor:${KAPACITOR_VERSION}

>&2 echo "Pulling latest images from Docker registry"
cat docker-compose.yml | grep image: | cut -d':' -f2-3 | while read line; do docker pull $line; done

0 comments on commit 5a6a165

Please sign in to comment.