olammi.iki.fi/sw
taloLoggerCont HOWTO
[Introduction]
[Requirements]
[Installing]
[Configuration]
[Upgrading]
[Error reporting and support]

Introduction

taloLoggerCont is a Docker container based logger installation/composition that provides the taloLogger and taloLogger graph containers and sample configuration to be modified according to logging needs.

Out of the box the taloLoggerCont provides similar functionality that taloLoggerPi produces, but in a container setup and not restricted to the Raspberry Pi platform.

There are three sample compositions provided in the package for different database setups: SQLite database, MySQL/MariaDB database and PostgreSQL database. The composition, configuration and the containers are freely modifiable to match the target environment.

Requirements

The requirements for taloLoggerCont are:

Installing

These are step by step instructions to install taloLoggerCont on an environment meeting the requirements.:

  • Have a working Docker environment with docker-compose on your system.
  • Download the latest taloLoggerCont zip package to your target system from taloLogger download page or by issuing a command:
         wget http://olammi.iki.fi/sw/taloLoggerCont/taloLoggerCont_latest.zip
  • Extract the zip package:
         unzip taloLoggerCont_latest.zip
  • Move into the taloLoggerCont directory:
         cd taloLoggerCont
  • Start the taloLoggerCont composition:
         docker-compose up -d

The docker-compose up command will pull the necessary docker container images from the internet repositories and start the containers described in the docker-compose.yml file. The out-of-the-box default configuration will create a SQLite database file in the vol/db/ directory.

Now taloLoggerCont is up and running with default settings. The taloLogger is active and logging with 2 minute interval to a SQLite3 database set up in the volume mount vol/db/. An example dummy outdoor temperature is being logged. The example data logged is sinusoidial curve with 2 hour wave lenght provided by the dummy data source on the taloLogger application.

The log can be viewed by web browser from URL:

     http://<system IP address>:8080/
You should see a page opening with a heading TaloLoggerCont and a link TaloLoggerGraph. The link will open the example log view with chart and image.

NOTE!! The during the first start up the database container talodb will take some time to initialize. If database connection cannot be initialized from the taloLogger containers, wait for few minutes and possibly check the talodb container logs for database initialization state.

Configuration

You can alter the default configuration of the taloLoggerCont to match the log environment you have and the required data sources, data measurements and data stores.

Contents of the taloLoggerCont folder

The taloLoggerCont default container composition package contains the following components when extracted.

  • docker-compose.yml - A composition file to orchestrate the default logger containers: talologger for logging and talologgercont for log visualization. This file is initially the same as the docker-compose.yml_sqlite file.
  • docker-compose.yml_mysql[-armhf] - A composition file to orchestrate the logger containers and database server container named talodb for storing the logged data. Talodb container will run a MariaDB database server. See database configuration section below for information about switching to MySQL/MariaDB database. For 32-bit ARM architectures use the ..._mysql-armhf version. This uses non-official MySQL container for older OS versions that do not have official MariaDB container available. Database data will be stored in volume mount directory vol/db_data_mysql/.
  • docker-compose.yml_postgresql - A composition file to orchestrate the logger containers and database server container named talodb for storing the logged data. Talodb container will run a PostgreSQL database server. See database configuration section below for information about switching to PostgreSQL database. Database data will be stored in volume mount directory vol/db_data_pgsql/.
  • docker-compose.yml_sqlite - A composition file to orchestrate the logger containers. Data will be stored in a file based SQLite3 database file in the volume mount directory vol/db/.
  • taloLogger.conf - A configuration file for the talologger container. The talologger container is responsible for logging the data from the datasources configured in this file and storing the data into datastores configured in this file. This file replaces the configuration file inside the olammi/talologger:latest container image before the container is started.
  • taloLoggerGraph.conf - A configuration file for the talologgergraph container. The talologgergraph container is responsible for visualizing the logged data from the database as graphs and data augmented images. This file replaces the configuration file inside the olammi/talologgergraph:latest container image before the container is started.
  • talo_php.ini - A configuration file for the PHP environment inside the talologgergraph container. This file is injected inside the container before it is started. Initially this will set the correct timezone for the PHP environment.
  • vol - (created, if missing, when the composition is launched for the first time) Directory containing all stateful data conserning the composition that survives taking the containers down.

taloLogger

TaloLogger configuration file taloLogger.conf is monted inside the talologger container being run.

The configuration file contains all the example configurations also in the taloLogger package example configuration file. However only minimal functionality is enabled by default. Read the comment sections in the configuration file for information about possible configuration options.

You can also read about configuring the taloLogger from the taloLogger HOWTO.

taloLoggerGraph

TaloLoggerGraph configuration file taloLoggerGraph.conf is monted inside the talologgergraph container being run.

The configuration file contains all the example configurations also in the taloLoggerGraph package example configuration file. However only minimal functionality is enabled by default. Read the comment sections in the configuration file for information about possible configuration options.

You can also read about configuring the taloLoggerGraph from the taloLoggerGraph HOWTO.

Database

The taloLoggerCont stores data in example configuration in to a SQLite3 database file:

     vol/db/talo.db
The schema/structure of the database is generic. When new measurement points to log are being configured, no alternations to the database schema or the table model is needed. All you need to do is to configure new @MEASURE directives to the taloLogger configuration and utilize the logged data points in the taloLoggerGraph @SERIES and @POSITION directives.

The taloLoggerCont example composition contains also sample docker-compose.yml files for container based databases: MySQL/MariaDB and PostgreSQL. In order to utilize these configurations, the following steps are necessary:

  • Copy the relevant yml-example over the file docker-compose.yml.
  • Edit taloLogger.conf configuration file to switch to use relevant data store (snippet from line 153...):
         #@DATASTORE=FILESTORE:FILESTORE
         #@DATASTORE=FILESTORE:XMLFILE
         #@DATASTORE=RRD:RRD
         #@DATASTORE=MYSQLDB:MYSQLDB
         #@DATASTORE=POSTGREDB:POSTGREDB
         @DATASTORE=SQLITEDB:SQLITEDB
         #@DATASTORE=THINGSPEAK:THINGSPEAK
         #@DATASTORE=MQTT:MQTT
    Comment out the non relevant line and remove comment mark from the relevant database type row.
  • Edit taloLoggerGraph.conf configuration file to switch to use relevat database (snippet from line 20...):
         ############################################################################# 
         # Data store configuration
         ############################################################################# 
    
         # Database type (Supported types: MYSQL, POSTGRESQL and SQLITE)
         DB_TYPE = SQLITE
    Replace the DB_TYPE configuration value with relevant database type (MYSQL, POSTGRESQL or SQLITE).
  • If using MySQL/MariaDB database, replace the database root password (environment variable MARIADB_ROOT_PASSWORD) in the docker-compose.yml file before the first start of the database container (docker-compose up). During the first start the database is created and initialized. After the init, the root password environment variable and its value may be removed from the docker-compose.yml as it has no influence over the container after the db init.

In order to work properly, the time zone configuration for all logger containers should be set properly. This is done in two locations:

  • The TZ environment variable configuration for each container in the docker-compose.yml
  • The [Date] date.timezone configuration directive for the PHP environment in the talo_php.ini
Initially these are all set to "Europe/Helsinki". If You are located on a different timezone, change the time zone information on all locations mentioned above to Your relevant value.

Web server port

In the default setup the logger data visualization site accessible by a web browser is served on port 8080 on the talologgergraph container. This port may be altered by changing the talologgergraph container composition configuration in the docker-compose.yml file. The olammi/talologgergraph container image internally exposes the service on port 80 and this is redirected and exposed to port 8080 in the configuration:

     ports:
       - "8080:80"
Change the port 8080 to another value if needed. If port 80 is desired, use value "80:80".

Committing configuration

Safest way to ensure that the altered configuration will affect the containers and have the desired effect, restart the composition by giving the following commands:

     docker-compose down
     docker-compose up -d
Some changes might be effective only by restarting single relevant container, but if you want to be sure, the down-up-cycle will read all the configuration files.

Logs

Containers produce logs to the Docker environment. A container log may be followed using the command

     docker logs -f <container_name>
where the container_name is talologger, talologgergraph or talodb

Upgrading

Upgrading software inside the containers is not the preferred way to upgrade to new versions. As newer taloLogger-containers are released, the composition file refers to the newest version of the container released. Docker-compose can be asked to check for and pull the new versions of the containers. Therefore the following commands are sufficient to upgrade to newest versions of the containers:

     docker-compose down
     docker-compose pull
     docker-compose up -d

Error reporting and support

If you still encounter problems running the application after following instructions of this HOWTO documentation and after reading the taloLoggerCont FAQ, send a support request or error report by email to the author of the application (olammi at iki dot fi). Please include the following data to the mail:

  • description of the problem
  • possible log rows concerning and elaborating the problem
  • any possible error messages related to the problem
  • any configuration files causing the problem or being root of the problem

01.02.2024 taloLogger v1.8d released