Overview
This comprehensive guide walks you through deploying DataForeman using Docker Compose. Whether you’re setting up a development environment, staging server, or production instance, this guide covers everything you need to know.
Prerequisites
Before you begin, ensure your system meets the following requirements:
- Docker 20.10 or higher
- Docker Compose 2.0 or higher
- Operating System: Linux, macOS, or Windows with WSL2
- Minimum Resources:
- 4 GB RAM (8 GB recommended)
- 20 GB available disk space
- 2 CPU cores minimum
Quick Start
The fastest way to get DataForeman running:
|
|
Access the application at http://localhost:8080
Default credentials:
- Email:
ADMIN_EMAIL(default:admin@example.com) - Password: from
ADMIN_PASSWORDin.env(default:password)
⚠️ Important: Change the default password immediately after first login!
Installation Steps
1. Clone the Repository
|
|
2. Configure Environment Variables
Create a .env file from the template:
|
|
Edit .env to customize your installation. The most important values to change:
|
|
Note:
PGHOST=dbandTSDB_HOST=tsdbrefer to Docker Compose service names — leave them as-is for a standard Docker deployment.
3. Start the Services
Launch all containers in detached mode:
|
|
npm start automatically runs fix-permissions.sh before starting containers, so no separate permission step is needed. Permissions fix the logs/ and var/ directories that containers write to.
5. Verify Installation
Check that all services are running:
|
|
You should see all services in the “Up” state.
What’s Included
The Docker Compose setup includes the following services:
| Service | Name in Compose | Description |
|---|---|---|
| PostgreSQL | db |
Main application database |
| TimescaleDB | tsdb |
Time-series data storage |
| NATS | nats |
Internal message bus |
| Core API | core |
Backend API and flow engine |
| Connectivity | connectivity |
Protocol drivers (OPC UA, EtherNet/IP, S7, MQTT) |
| Frontend | front |
React web interface |
| MQTT Broker | broker |
Embedded MQTT broker for device connectivity |
| Log Rotation | rotator |
Automated log management |
| Caddy | caddy |
Optional HTTPS reverse proxy (enabled with --with-caddy) |
Configuration
Port Configuration
Default ports used by DataForeman:
| Service | Port | Purpose |
|---|---|---|
| Frontend | 8080 | Web interface |
| API | 3000 | REST API |
| PostgreSQL | 5432 | Database |
| NATS | 4222 | Message bus |
To change ports, edit the .env file and restart:
|
|
Volume Management
Data is persisted in Docker named volumes. Docker prefixes volumes with the project name (dataforeman):
|
|
Upgrades
Upgrade to Latest Version
DataForeman is built from source — there are no pre-built images to pull. The correct upgrade process is:
-
Check GitHub Releases for the latest version tag (e.g.
vX.X.X) -
Fetch and check out the new version:
|
|
- Rebuild and restart:
|
|
Database migrations run automatically when core starts — no manual migration step is needed. Your data (databases, dashboards, configurations) is preserved.
To roll back:
git checkout vX.X.X && npm run start:rebuild
Database Migrations
Migrations run automatically on startup. Check logs:
|
|
Backup and Restore
Backup Database
Create a backup of the main PostgreSQL database:
|
|
Restore Database
Restore from a backup file:
|
|
Backup Volumes
Backup the main database volume:
|
|
Troubleshooting
Services Won’t Start
Check logs:
|
|
Check specific service:
|
|
Port Already in Use
If port 8080 is already in use by another application:
- Edit
.envand changeFRONT_PORTto a different value (e.g.FRONT_PORT=8090) - Restart:
docker compose down && docker compose up -d
Database Connection Issues
Reset database:
|
|
⚠️ Warning: This deletes all data!
Permission Denied Errors
Run the permission fix script:
|
|
This script fixes permissions on the logs/ and var/ directories that containers write to. It also sets logs/postgres/ to world-writable so the PostgreSQL container (which runs as a different UID) can write its log files.
Container Keeps Restarting
Check container logs for errors:
|
|
Common issues:
- Insufficient memory (increase Docker memory limit)
- Missing environment variables (check
.env) - Port conflicts (change ports in
.env)
Getting Help
If you encounter issues:
- Check the Troubleshooting section
- Review logs:
docker compose logs - Visit GitHub Discussions
- Report bugs on GitHub Issues