This guide walks you through setting up umh-core with Docker Compose, starting with a minimal configuration and building up to a full production-ready stack.
Prerequisites
Docker and Docker Compose installed on your system
Basic familiarity with the command line
Minimal Setup
Find the latest version on the Releases page and replace <VERSION> with your selected version.
This achieves the same result as the docker cli commands, but the configuration is now documented in a file that you can version control and extend.
Adding TimescaleDB and Grafana
While umh-core can operate standalone, most deployments benefit from persistent storage and visualization capabilities.
TimescaleDB
TimescaleDB is PostgreSQL with an extension optimized for time-series data. Manufacturing data is inherently time-series: sensor readings, production counts, and machine states all have timestamps. It is an optimal solution to store this kind of data.
PgBouncer
PgBouncer is a connection pooler that manages database connections efficiently.
umh-core bridges can create many simultaneous connections to the database. PostgreSQL has a limited number of connections it can handle (typically 100 by default). Without connection pooling, a busy system can exhaust this limit, causing connection failures. PgBouncer multiplexes many client connections onto a pool of database connections. This allows hundreds of application connections while using only a few actual PostgreSQL connections.
In this configuration applications connect to PgBouncer on port 5432 and PgBouncer connects to TimescaleDB internally.
Adding TimescaleDB
Below are the changes to be made to the base configuration to deploy TimescaleDB and PgBouncer together with umh-core.
This declares:
2 Services called pgbouncer and timescaledb: PgBouncer acts as a proxy to TimescaleDB. This means the Credentials have to match between these two Services. Healthchecks ensure that the Services are started in order. timescaledb is isolated in the Network timescaledb-network. pgbouncer is both in the default and the timescaledb-network. This makes PgBouncer the only Service which can talk to TimescaleDB directly.
2 Networks called timescaledb-network and default: Without the Network section the Network default is always created by default. Services use the Network default if no explicit Network configuration is provided. The timescaledb-network is configured to be internal which means Services can't reach the internet or any Service outside this Network if they are only connected through this Network.
1 Volume called timescaledb-data: This is where TimescaleDB stores its data.
Grafana
Grafana is an open-source visualization platform. It can for example connect to TimescaleDB and allows you to build dashboards showing real-time and historical data.
Adding Grafana
Below are the changes to be made to the base configuration to deploy Grafana together with umh-core.
umh-core + Grafana + PgBouncer + TimescaleDB
To get the most out of Grafana it should be deployed together with TimescaleDB to have a good and persistent data source.
IMPORTANT: Do not forget to change Database credentials before using this in production!
Starting the Stack
Once the configuration is done you can start the full application stack by using docker compose up -d. There are a lot of useful commands for docker compose for example:
docker compose ps: check the running state of all services
docker compose stats: check resource usage of all services
docker compose pull: attempt to pull new versions of all images used in the docker-compose.yaml