# Check if Docker is installed
docker --version
docker-compose --version
# If not installed:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Clone or download HubMail
git clone https://github.com/taskprovision/hubmail.git
cd hubmail
# Copy configuration
cp .env.example .env
# Quick setup (Linux/macOS)
./quick-setup.sh
# Start all services
docker-compose up -d
# Wait for startup (important!)
sleep 60
# Check services
curl http://localhost:1880 # Node-RED Dashboard
curl http://localhost:11435 # Ollama API
curl http://localhost:9090 # Prometheus
curl http://localhost:3000 # Grafana
curl http://localhost:6379 # Redis (use redis-cli)
# Send test email (requires configuration)
curl -X POST "http://localhost:1880/api/email/process" \
-H "Content-Type: application/json" \
-d '{
"from": "test@example.com",
"to": "system@hubmail.local",
"subject": "Test Email",
"body": "This is a test email for HubMail system."
}'
# Check processing (wait a few seconds)
curl "http://localhost:1880/api/email/stats"
| Service | URL | Purpose |
|---|---|---|
| Main Dashboard | http://localhost:1880 | Email processing workflows |
| Metrics | http://localhost:3000 | Grafana dashboards for monitoring |
| AI Models | http://localhost:11435 | Ollama API for email classification |
| Monitoring | http://localhost:9090 | Prometheus metrics |
# Edit .env file with your email credentials
# Example:
EMAIL_SERVER=imap.example.com
EMAIL_USER=your-email@example.com
EMAIL_PASS=your-secure-password
EMAIL_PORT=993
EMAIL_SECURE=true
# Check email processing statistics
curl "http://localhost:1880/api/email/stats"
# Or use Grafana dashboard
# Open http://localhost:3000
# Login with default credentials (admin/admin)
# Navigate to the Email Processing dashboard
# View Node-RED dashboard
open http://localhost:1880
# Check processing logs
docker-compose logs -f node-red
# Start system
docker-compose up -d
# Stop system
docker-compose down
# Restart system
docker-compose restart
# View status
docker-compose ps
# Check all services
docker-compose ps
# View logs
docker-compose logs
# Restart specific service
docker-compose restart node-red
# Reset everything (CAUTION: loses data)
docker-compose down -v
sudo rm -rf data/*
docker-compose up -d
# Quick health check
for port in 1880 11435 9090 3000 6379; do
if [ $port -eq 6379 ]; then
redis-cli -h localhost -p $port PING | grep -q "PONG" && echo "Redis Port $port: OK" || echo "Redis Port $port: FAIL"
else
curl -s http://localhost:$port > /dev/null && echo "Port $port: OK" || echo "Port $port: FAIL"
fi
done
# Find all urgent emails
curl "http://localhost:1880/api/email/search?classification=URGENT"
# Find emails from last week
curl "http://localhost:1880/api/email/search" -d '
{
"query": {
"range": {
"date": {
"gte": "now-7d"
}
}
}
}'
# Manually process an email
curl -X POST "http://localhost:1880/api/email/process" \
-H "Content-Type: application/json" \
-d '{
"from": "important@example.com",
"to": "your-email@example.com",
"subject": "Urgent Meeting",
"body": "We need to discuss the project status immediately.",
"date": "2024-01-20T10:30:00Z"
}'
# Check processing result
curl "http://localhost:1880/api/email/search?q=subject:Urgent%20Meeting"
NODE_RED_PORT=1880
OLLAMA_PORT=11435
PROMETHEUS_PORT=9090
GRAFANA_PORT=3000
REDIS_PORT=6379
# Email Server Settings
EMAIL_SERVER=imap.example.com
EMAIL_USER=your-email@example.com
EMAIL_PASS=your-secure-password
EMAIL_PORT=993
EMAIL_SECURE=true
EMAIL_CHECK_INTERVAL=300
# Node-RED Settings
NODERED_ADMIN_USER=admin
NODERED_ADMIN_PASSWORD=password
# AI Model Settings
LLM_MODEL=llama2:7b
LLM_TEMPERATURE=0.7
LLM_MAX_TOKENS=2048
# Redis Settings
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
# Notification Settings
WEBHOOK_URL=https://hooks.slack.com/services/your-webhook-url
WEBHOOK_ENABLED=true
Edit the .env file to customize classification thresholds:
# Classification confidence thresholds
CLASSIFICATION_THRESHOLD_URGENT=0.8
CLASSIFICATION_THRESHOLD_BUSINESS=0.6
CLASSIFICATION_THRESHOLD_PERSONAL=0.7
CLASSIFICATION_THRESHOLD_SPAM=0.9
Create custom auto-reply templates in the Node-RED flow:
For more secure email access, configure OAuth2:
# In .env file
EMAIL_AUTH_TYPE=oauth2
EMAIL_OAUTH_CLIENT_ID=your-client-id
EMAIL_OAUTH_CLIENT_SECRET=your-client-secret
EMAIL_OAUTH_REFRESH_TOKEN=your-refresh-token
EMAIL_OAUTH_ACCESS_TOKEN=your-access-token
EMAIL_OAUTH_EXPIRES=1234567890
For high email volume environments:
# Increase resources in docker-compose.yml
services:
node-red:
deploy:
resources:
limits:
cpus: '2'
memory: 2G
# Adjust processing settings in .env
EMAIL_BATCH_SIZE=50
EMAIL_PROCESSING_THREADS=4
# Check email server connectivity
nc -zv $EMAIL_SERVER $EMAIL_PORT
# View detailed connection logs
docker-compose logs node-red | grep "Email connection"
# Restart email processing
curl -X POST "http://localhost:1880/api/system/service/node-red/restart"
# Check if model is loaded
curl "http://localhost:11435/api/tags"
# Pull model again if needed
curl -X POST "http://localhost:11435/api/pull" \
-H "Content-Type: application/json" \
-d '{"name": "llama2:7b"}'
# Restart Ollama service
docker-compose restart ollama
If the system is running slowly:
# Check resource usage
docker stats
# Increase Docker resources
# Edit Docker Desktop settings or server limits
# Restart Docker
sudo systemctl restart docker
docker-compose up -d
docker-compose logs [service-name]🎉 You’re ready to start processing emails with HubMail!
Send a test email to system@hubmail.local and watch it get processed automatically.