Skip to content

Commit

Permalink
Upgrading Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
fmdlc committed Oct 25, 2020
1 parent 4d0f960 commit 4721582
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 12 deletions.
29 changes: 18 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: default install start stop restart prune
.PHONY: default install start stop restart prune provision docker-bootstrap

NAME=ISP-Checker
VERSION=1.2
Expand All @@ -15,7 +15,13 @@ default:
@echo "\t- stop : Stops entire stack."
@echo "\t- restart : Restart stack.\n"

install:
install: docker-bootstrap provision
@echo "\nOpen your browser a points to http://127.0.0.1:3000/\n"
@echo "Default Username: admin | Default Password: admin"
@echo "Updated credentials after your first login!."
$(info Make: Bootstrap done)

docker-bootstrap:
$(info Make: Creating persistent Docker volumes)
@bash ./docker-compose/bin/inject_credentials.sh
@docker volume create --name=influxdb-storage
Expand All @@ -24,28 +30,29 @@ install:
@docker-compose -f $(COMPOSE_FILE) up -d
@sleep 10

provision:
$(info Make: Initializing datasources and dashboards)
@docker run --network host -v "$(PWD)/grafana:/app" --rm curlimages/curl:7.73.0 \

@echo ">> Provisioning: InfluxDB datasource\n"
@docker run --network host -v "$(PWD)/docker-compose/grafana:/app" --rm curlimages/curl:7.73.0 \
-s --location -XPOST 'http://admin:[email protected]:3000/api/datasources' \
--header 'Content-Type: application/json' -d @/app/datasource.json > /dev/null

@docker run --network host -v "$(PWD)/grafana:/app" --rm curlimages/curl:7.73.0 \
@echo ">> Provisioning: Network dashboard\n"
@docker run --network host -v "$(PWD)/docker-compose/grafana:/app" --rm curlimages/curl:7.73.0 \
-s --location -XPOST 'http://admin:[email protected]:3000/api/dashboards/db' \
--header 'Content-Type: application/json' -d @/app/network-dashboard.json > /dev/null

@docker run --network host -v "$(PWD)/grafana:/app" --rm curlimages/curl:7.73.0 \
@echo ">> Provisioning: Raspberry dashboard\n"
@docker run --network host -v "$(PWD)/docker-compose/grafana:/app" --rm curlimages/curl:7.73.0 \
-s --location -XPOST 'http://admin:[email protected]:3000/api/dashboards/db' \
--header 'Content-Type: application/json' -d @/app/raspberry-dashboard.json > /dev/null

@docker run --network host -v "$(PWD)/grafana:/app" --rm curlimages/curl:7.73.0 \
@echo ">> Provisioning: Network preferences\n"
@docker run --network host -v "$(PWD)/docker-compose/grafana:/app" --rm curlimages/curl:7.73.0 \
-s --location -XPUT 'http://admin:[email protected]:3000/api/user/preferences' \
--header 'Content-Type: application/json' -d @/app/default.json > /dev/null

@echo "\nOpen your browser a points to http://127.0.0.1:3000/\n"
@echo "Default Username: admin | Default Password: admin"
@echo "Updated credentials after your first login!."
$(info Make: Bootstrap done)

kube-install:
kubectl apply -f https://raw.githubusercontent.com/fmdlc/ISP-Checker/master/kubernetes/ISP-Checker-deploy.yaml

Expand Down
2 changes: 1 addition & 1 deletion docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
container_name: telegraf
image: tty0/isp_telegraf:1.15.3
volumes:
- "../telegraf/conf/telegraf.conf:/etc/telegraf/telegraf.conf"
- "./telegraf/conf/telegraf.conf:/etc/telegraf/telegraf.conf"
env_file:
- ./credentials.env
links:
Expand Down
14 changes: 14 additions & 0 deletions docker-compose/grafana/network-dashboard.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
{
"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Network latencies and availability",
"editable": true,
"gnetId": 13140,
"graphTooltip": 0,
"id": null,
"links": [],
Expand Down
15 changes: 15 additions & 0 deletions docker-compose/grafana/raspberry-dashboard.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Raspberry Pi Monitoring",
"editable": true,
"gnetId": 10578,
"graphTooltip": 1,
"id": null,
"links": [],
"panels": [
Expand Down

0 comments on commit 4721582

Please sign in to comment.