Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Add docker run instructions, and pre-provision some grafana #11

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.idea
.idea
octograph.ini
data/
34 changes: 29 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ By default, energy data for the previous day will be collected. Optional from
and to ranges may be specified to retrieve larger datasets. It is anticipated
that the script will be run daily by a cron job.

.. code:: bash

docker-compose up -d # start InfluxDB and Grafana in Docker
python app/octopus_to_influxdb.py --from-date=2018-10-20
open http://localhost:3000

The default login credentials for Grafana are admin/admin, and you will be
prompted to set a new password on first login. You should then proceed to add
Expand All @@ -67,6 +62,35 @@ InfluxDB as a datasource with URL ``http://influxdb:8086`` and database
then be imported to review the data.


Running on host
====

.. code:: bash

docker-compose up -d # start InfluxDB and Grafana in Docker
python app/octopus_to_influxdb.py --from-date=2018-10-20
open http://localhost:3000

Running on docker
====

You can also run octopgrah using the Dockerfile within the `app` directory.
The only difference between from the script above is that no local installation
is required just mount the config file into docker, ensuring the path to your
local `ini` file is correct and run the docker command.

.. code:: bash

docker-compose up -d # start InfluxDB and Grafana in Docker
docker build ./app -t octograph # build the docker image, only needs done first time or whenever you update the repository
docker run --volume=`pwd`/octograph.ini:/usr/src/app/octograph.ini --network="container:octo-influxdb" octograph --from-date=2018-10-20 # run octograph using the same network as influxdb
open http://localhost:3000

Links
====

Some useful links for the tech involved are included below

.. _Octopus Energy API: https://developer.octopus.energy/docs/api/
.. _Octopus Energy Go: https://octopus.energy/go/
.. _InfluxDB: https://www.influxdata.com/time-series-platform/influxdb/
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ version: '3'
services:
influxdb:
image: influxdb
container_name: octo-influxdb
volumes:
- "./data/influxdb/:/var/lib/influxdb"
environment:
- INFLUXDB_DB=energy
ports:
- "8086:8086"
grafana:
image: grafana/grafana
container_name: octo-grafana
volumes:
- "./grafana/provisioning:/etc/grafana/provisioning"
ports:
- "3000:3000"
depends_on:
Expand Down
13 changes: 13 additions & 0 deletions grafana/provisioning/dashboards/dashboards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: 1

providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
allowUiUpdates: true
updateIntervalSeconds: 10 # How often Grafana scans for changed dashboards
options:
path: /etc/grafana/provisioning/dashboards
Loading