Open Energy Playground is a research project aiming to make it easier and faster to prototype smart energy services.
Energy data is collected and measured from sites such as offices, homes, construction sites and museums. This data is then analyzed, stored and processed with tools from the toolbox to result in mockups, tutorials, research material and concept services. Data will be made available through open source when the project is finished.
The processing platform (or playground) is built on number of Docker containers. But, what is Docker?
"Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in."
- Docker
To get started, go through the first step in the Docker getting started guide (Mac, Windows or Linux). Then come back here!
(For installation on Raspberry Pi, see separate instructions)
Clone the Open Energy Playground:
git clone https://github.com/op-en/playground.git
This project contains only a Docker Compose file that specifies what programs to download, and how to run them on your computer. To download, install and startup all these programs, go into the project folder and run docker-compose, like so:
cd playground/
docker-compose up -d
Thats it!
When the compose script is finished, the playground is ready.
First you have to find the public ip of the docker-machine that is running the container. You can find this in two ways:
1. When you start up the docker environment, it outputs the ip, like this:
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
docker is configured to use the default machine with IP 192.168.99.100
2. If the machine is already running, you can get the ip by running
docker-machine ip default
The playground currently contains 6 containers.
- InfluxDB, a database.
- Grafana, a visualizing tool.
- Mosquitto, a broker relaying MQTT messages.
- node-RED, a tool for wiring everything together.
- App Server, a bridge from MQTT to websockets.
- nginx, a web server hosting your custom content.
There is a lot to know and learn about Docker containers. Some of the most important aspects when it comes to the playground is discussed here.
It is very important to understand the ephemeral nature of containers. This means that data created and stored within the container can disappear if the container restarts or is stopped.
For example, if we do not specify where the flows should be stored when running the node-RED container, they will be stored on the container itself. And the next time you restart the container, all you work will be LOST! Tragic!
To avoid this, the compose script (by default) maps the folder in the container that stores the flows to another folder on the host system. In the compose file, this is specified as the node-red folder within this project.
With this mapping in place, the flows are persistent beyond a restart.
You can see what containers are running with:
docker ps
And the images available with:
docker images
If deployed with this compose script, the ports from the containers are automatically mapped to the host.
If you want to run something custom inside an image, you can run:
docker exec -t -i [docker image] /bin/bash