The purpose of the persistence service is to collect all values that were sent from Pot Pourri devices and store them in a database for later use.
It uses InfluxDB for this purpose, as it is specifically made for time-series data.
InfluxDB is sided by Telegraf, which works as an adapter that receives MQTT messages, converts them into the InfluxDB data format, and stores them in the database.
This service runs out of the box. If you need to configure your deployment different from the default values, have a look at section Advanced configuration below!
To deploy the app manually, conduct the following steps:
- Pull the latest changes with
$ git checkout master && git pull
- Build the app with
$ docker-compose build
- Start the updated containers with
$ docker-compose up -d
If you want to update the still running app, you can conduct the same steps without the need to stop the container first.
If you have just changed the Telegraf configuration ./telegraf/telegraf.conf (see more about the configuration below), both commands won't work as neither the image nor the container have changed. In this case you can restart the containers with $ docker-compose restart
.
InfluxDB will persist the collected data in a Docker volume called potpourri-persistence_influxdb
. So all your data will still be there if you shut down and re-start your container.
If you want to start fresh, you need to delete this volume before you start the container again. Deleting volumes is only possible if you delete the containers that use them first:
$ docker rm potpourri-persistence-influxdb
$ docker volume rm potpourri-persistence_influxdb
Changes in Telegraf aren't persisted as Telegraf is being configured via ./telegraf/telegraf.conf and changes at runtime that need to be persisted aren't necessary.
If you have run docker-compose
without the -d
flag, your terminal is still open. Just close the terminal or hit Ctrl + D to stop the program.
If you have run docker-compose
with the -d
flag, open a terminal, navigate to the location of this service's docker-compose.yml
and execute
$ docker-compose down
If the default configuration doesn't fit your needs, you have the following options to change it.
All changes described here will take effect when you start the container with docker-compose up
.
The port used by the three tools as well as the project name prefix that docker-compose
will use, can be configured in the .env
file.
Telegraf can configured via ./telegraf/telegraf.conf. You can edit it a according to your needs.
You can find more information on configuring Telegraf here.
For normal use, docker-compose
should be all you need to be happy. However, if you change docker-compose.yml
often and need to shutdown and start your setup frequently, there are a couple of scripts in ./scripts that might be useful for you.
Please see the comments in the script files for more details!