forked from bkconrad/screeps-grafana
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated ansible playbooks and fixed datasource/sample setup
- Loading branch information
1 parent
2d53dbe
commit ffd20d1
Showing
8 changed files
with
171 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
node: | ||
build: . | ||
links: | ||
- statsd | ||
environment: | ||
GRAPHITE_PORT_8125_UDP_ADDR: "statsd" | ||
env_file: docker-compose.env | ||
statsd: | ||
image: ennexa/statsd | ||
links: | ||
- graphite | ||
graphite: | ||
image: ennexa/graphite | ||
volumes: | ||
- /opt/graphite/conf | ||
- /opt/graphite/storage/whisper | ||
grafana: | ||
image: grafana/grafana | ||
volumes: | ||
- /var/lib/grafana | ||
links: | ||
- graphite | ||
ports: | ||
- "3000:3000" | ||
grafana_setup_datasource: | ||
image: appropriate/curl | ||
links: | ||
- grafana | ||
command: | | ||
curl 'http://admin:admin@grafana:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"localGraphite","type":"graphite","url":"http://graphite:8000","access":"proxy","isDefault":true,"database":""}' | ||
grafana_setup_sampledashboard: | ||
image: appropriate/curl | ||
links: | ||
- grafana | ||
volumes: | ||
- ./sampleDashboard.json:/sampleDashboard.json | ||
command: | | ||
curl 'http://admin:admin@grafana:3000/api/dashboards/db' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data @/sampleDashboard.json | ||
version: "2" | ||
services: | ||
node: | ||
image: kaen/screeps-statsd | ||
restart: always | ||
links: | ||
- statsd | ||
environment: | ||
GRAPHITE_PORT_8125_UDP_ADDR: "statsd" | ||
env_file: docker-compose.env | ||
statsd: | ||
image: ennexa/statsd | ||
links: | ||
- graphite | ||
graphite: | ||
image: ennexa/graphite | ||
restart: always | ||
volumes: | ||
- /opt/graphite/conf | ||
- /opt/graphite/storage/whisper | ||
grafana: | ||
image: grafana/grafana | ||
restart: always | ||
volumes: | ||
- /var/lib/grafana | ||
links: | ||
- graphite | ||
ports: | ||
- "1337:3000" | ||
# grafana_setup_datasource: | ||
# image: appropriate/curl | ||
# links: | ||
# - grafana | ||
# command: | | ||
# curl 'http://admin:admin@grafana:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"localGraphite","type":"graphite","url":"http://graphite:8000","access":"proxy","isDefault":true,"database":""}' | ||
# grafana_setup_sampledashboard: | ||
# image: appropriate/curl | ||
# links: | ||
# - grafana | ||
# volumes: | ||
# - ./sampleDashboard.json:/sampleDashboard.json | ||
# command: | | ||
# curl 'http://admin:admin@grafana:3000/api/dashboards/db' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data @/sampleDashboard.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
192.168.122.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
# defaults file for screeps-statsd | ||
docker_engine_version: 1.9.1 | ||
docker_engine_version: latest | ||
docker_keyserver: hkp://p80.pool.sks-keyservers.net:80 | ||
docker_repo_key: 58118E89F3A912897C070ADBF76221572C52609D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
# | ||
# Run docker-compose in a container | ||
# | ||
# This script will attempt to mirror the host paths by using volumes for the | ||
# following paths: | ||
# * $(pwd) | ||
# * $(dirname $COMPOSE_FILE) if it's set | ||
# * $HOME if it's set | ||
# | ||
# You can add additional volumes (or any docker run options) using | ||
# the $COMPOSE_OPTIONS environment variable. | ||
# | ||
|
||
|
||
set -e | ||
|
||
VERSION="1.7.1" | ||
IMAGE="docker/compose:$VERSION" | ||
|
||
|
||
# Setup options for connecting to docker host | ||
if [ -z "$DOCKER_HOST" ]; then | ||
DOCKER_HOST="/var/run/docker.sock" | ||
fi | ||
if [ -S "$DOCKER_HOST" ]; then | ||
DOCKER_ADDR="-v $DOCKER_HOST:$DOCKER_HOST -e DOCKER_HOST" | ||
else | ||
DOCKER_ADDR="-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH" | ||
fi | ||
|
||
|
||
# Setup volume mounts for compose config and context | ||
if [ "$(pwd)" != '/' ]; then | ||
VOLUMES="-v $(pwd):$(pwd)" | ||
fi | ||
if [ -n "$COMPOSE_FILE" ]; then | ||
compose_dir=$(dirname $COMPOSE_FILE) | ||
fi | ||
# TODO: also check --file argument | ||
if [ -n "$compose_dir" ]; then | ||
VOLUMES="$VOLUMES -v $compose_dir:$compose_dir" | ||
fi | ||
if [ -n "$HOME" ]; then | ||
VOLUMES="$VOLUMES -v $HOME:$HOME -v $HOME:/root" # mount $HOME in /root to share docker.config | ||
fi | ||
|
||
# Only allocate tty if we detect one | ||
if [ -t 1 ]; then | ||
DOCKER_RUN_OPTIONS="-t" | ||
fi | ||
if [ -t 0 ]; then | ||
DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i" | ||
fi | ||
|
||
exec docker run --rm $DOCKER_RUN_OPTIONS $DOCKER_ADDR $COMPOSE_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SCREEPS_USERNAME={{ screeps_username }} | ||
SCREEPS_EMAIL={{ screeps_email }} | ||
SCREEPS_PASSWORD={{ screeps_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
echo Starting containers... | ||
docker-compose up -d | ||
echo Waiting for grafana to start... | ||
do | ||
sleep 1 | ||
curl -X HEAD http://localhost:1337 | ||
while [[ $? != 0 ]] | ||
echo Configuring Datasource... | ||
curl -s 'http://admin:admin@localhost:1337/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"localGraphite","type":"graphite","url":"http://graphite:8000","access":"proxy","isDefault":true,"database":""}' > /dev/null | ||
sleep 2 | ||
echo Installing Sample... | ||
curl -s 'http://admin:admin@localhost:1337/api/dashboards/db' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data @sampleDashboard.json > /dev/null | ||
echo All done! | ||
echo You should be able connect to http://localhost:1337 | ||
echo with username \'admin\' and password \'admin\' |