This repository contains code to implement the HCCC Library GateCounter with Grafana for data display
You will need a Raspberry Pi or comparable board running Linux. Download and install Docker and Docker-compose following the instructions for your OS:
or, if you have a Debian-based Linux on your Pi, e.g. Raspbian, run the included setup script ./install-docker.sh
Please also, in a developer's text editor e.g. NotePad++ or Microsoft Visual Studio Code, read through docker-compose.yaml to make sure you understand it. Before starting your stack, you will need to
- Register for DuckDNS and have your subdomain name and token ready
- Make sure ports 80 and 443 are accessible on your host machine and your machine has a connection to the Internet
- Copy .env.template to .env with
cp .env.template .env
DO NOT COMMIT AND PUSH .env TO A PUBLIC GIT REPOSITORY UNLESS YOU WANT TO GET HACKED!!! - Edit the files .env and .configs/grafana.ini, updating configuration values with your desired configuration
- Run
docker-compose config
from this directory to doublecheck that docker-compose.yaml file contains no syntax errors and that all your options from .env were correctly filled in
Run docker-compose up -d
to start everything
To Stop or (re)Start a container in your stack without removing it, run docker-compose stop grafana
replacing stop and grafana with the command and name of the container you wish to stop/start/restart.
Run the following commands to update the images your containers use and recreate/restart the containers using them
docker-compose build
docker-compose pull
docker-compose up -d
docker image prune -f
Run docker-compose rm -s grafana
replacing grafana with the name of the service you wish to stop and remove without removing its persistent data. docker-compose rm -s -v grafana
will stop and remove the container and any unnamed (not specified in docker-compose.yaml file) volumes connected to it. To remove just a named volume, run docker volume rm grafana_provisioning
replacing grafana_provisioning with the name of the volume you want to remove. You can view all volumes with docker volume ls
.
Run docker-compose down
to stop and remove all containers in your stack without removing their persistent data in named volumes. You can run docker-compose down -v
to remove all containers AND all named volumes. WARNING: this will permanently remove data stored in docker volumes, but not data stored in mapped folders/files. If you don't want to lose this data, either back it up first, or follow the instructions in the above section.