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@example.com
- Password: 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:
|
|
3. Set File Permissions
Run the permission fix script:
|
|
This ensures proper permissions for data directories and log files.
4. Start the Services
Launch all containers in detached mode:
|
|
or
|
|
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:
- ✅ PostgreSQL Database - Main data storage
- ✅ TimescaleDB Extension - Time-series data optimization
- ✅ NATS Message Bus - Internal service communication
- ✅ Core API Service - Backend API
- ✅ Connectivity Drivers - Protocol handlers (OPC UA, Modbus, etc.)
- ✅ React Frontend - Web interface
- ✅ Log Rotation - Automated log management
- ✅ Caddy Reverse Proxy (optional) - HTTPS and routing
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 volumes:
|
|
Upgrades
Upgrade to Latest Version
- Pull the latest code:
|
|
- Pull new Docker images:
|
|
- Restart services:
|
|
Database Migrations
Migrations run automatically on startup. Check logs:
|
|
Backup and Restore
Backup Database
Create a backup of your PostgreSQL database:
|
|
Restore Database
Restore from a backup file:
|
|
Backup Volumes
Backup all data volumes:
|
|
Troubleshooting
Services Won’t Start
Check logs:
|
|
Check specific service:
|
|
Port Already in Use
If port 8080 is already in use by other application:
- Edit
.envand changeAPP_PORT - 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:
|
|
Or manually:
|
|
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