๐ณ SentinentalBERT Docker Development Environment - Complete Setup
๐ Summary
I've created a comprehensive Docker development environment for the SentinentalBERT project that includes:
โ Files Created
docker-compose.dev.yml
- Main development Docker Compose configurationDockerfile.dashboard
- Streamlit dashboard container definition.env.dev
- Development environment templatedocker-compose.override.yml
- Development-specific overridesstart-dev.sh
- Automated startup script with full environment managementMakefile
- Development workflow commandsmonitoring/prometheus.dev.yml
- Prometheus configuration for developmentREADME_DOCKER_DEV.md
- Comprehensive documentation
๐ Services Included
Main Application
- Streamlit Dashboard (Port 8501) - Main viral content analysis interface
- Backend API (Port 8080) - RESTful API with Swagger UI
- NLP Service (Port 8000) - Sentiment analysis and text processing
Supporting Services
- Evidence Service (Port 8082) - Evidence collection and storage
- Ingestion Service (Port 8081) - Social media data ingestion
- Viral Detection (Port 8083) - Viral content detection algorithms
Databases & Storage
- PostgreSQL (Port 5432) - Main application database
- Redis (Port 6379) - Caching and session storage
- Elasticsearch (Port 9200) - Search and analytics engine
Development Tools
- Adminer (Port 8084) - PostgreSQL database administration
- Redis Commander (Port 8085) - Redis management interface
- Prometheus (Port 9090) - Metrics collection and monitoring
- Grafana (Port 3000) - Monitoring dashboards and visualization
๐ ๏ธ Key Features
Development-Friendly
- โ Hot Reload - Streamlit dashboard automatically reloads on code changes
- โ Volume Mounts - Source code mounted for easy editing
- โ Debug Mode - Enhanced logging and debugging capabilities
- โ Port Exposure - All services accessible for development and testing
Production-Ready Architecture
- โ Microservices - Properly separated services with defined APIs
- โ Health Checks - Built-in health monitoring for all services
- โ Resource Limits - Memory and CPU limits configured
- โ Networking - Isolated Docker network for service communication
Comprehensive Monitoring
- โ Prometheus Metrics - Application and system metrics collection
- โ Grafana Dashboards - Pre-configured monitoring dashboards
- โ Centralized Logging - Structured logging across all services
- โ Health Endpoints - Service health monitoring
๐ Quick Start Commands
# One-command setup and start
./start-dev.sh
# Using Makefile (alternative)
make quick-start
# Manual Docker Compose
docker compose -f docker-compose.dev.yml up -d
๐ Access URLs After Startup
Service | URL | Description |
---|---|---|
Main Dashboard | http://localhost:8501 | Streamlit viral content analysis |
Backend API | http://localhost:8080 | RESTful API + Swagger UI |
NLP Service | http://localhost:8000 | Sentiment analysis API |
Database Admin | http://localhost:8084 | Adminer (PostgreSQL) |
Redis Admin | http://localhost:8085 | Redis Commander |
Monitoring | http://localhost:9090 | Prometheus metrics |
Dashboards | http://localhost:3000 | Grafana (admin/admin123) |
๐ง Development Workflow
Starting Development
# Start all services
./start-dev.sh
# Check status
./start-dev.sh status
# View logs
./start-dev.sh logs streamlit-dashboard
Making Changes
- Edit
enhanced_viral_dashboard.py
- Auto-reloads in browser - Edit service code in
services/
- Restart specific service - Edit configuration - Restart affected services
Testing & Quality
# Run tests
make test
# Code formatting
make format
# Linting
make lint
# Type checking
make type-check
Database Operations
# Database shell
make db-shell
# Reset database
make db-reset
# Backup database
make db-backup
๐ Security & Configuration
Development Defaults
- PostgreSQL:
sentinel/sentinelpass123
- Redis:
redispass123
- Grafana:
admin/admin123
- JWT Secret:
dev-jwt-secret-key-change-in-production
Environment Configuration
- Copy
.env.dev
to.env
and customize - Add API keys for social media platforms
- Adjust resource limits as needed
- Configure monitoring settings
๐ Resource Requirements
Minimum System Requirements
- RAM: 8GB (recommended 16GB)
- Disk: 10GB free space
- CPU: 4 cores (recommended)
- Docker: Version 20.10+
- Docker Compose: Version 2.0+
Service Resource Allocation
- Streamlit Dashboard: 2GB RAM limit
- NLP Service: 4GB RAM limit (ML models)
- Backend Service: 2GB RAM limit
- PostgreSQL: 1GB RAM
- Elasticsearch: 1GB RAM
- Other Services: 512MB each
๐งช Testing & Validation
Health Checks
# Check all service health
make health-check
# Individual service checks
curl http://localhost:8501/_stcore/health # Dashboard
curl http://localhost:8080/actuator/health # Backend
curl http://localhost:8000/health # NLP Service
Integration Testing
# Run full test suite
make test
# Integration tests
make test-integration
# API endpoint testing
curl -X GET http://localhost:8080/api/health
๐ Maintenance Commands
Cleanup
# Stop all services
./start-dev.sh stop
# Clean environment (removes containers/volumes)
./start-dev.sh clean
# Complete cleanup
make dev-clean-all
Updates
# Rebuild images
make dev-build-no-cache
# Restart services
./start-dev.sh restart
๐ Documentation
README_DOCKER_DEV.md
- Comprehensive setup and usage guidestart-dev.sh help
- Script usage and commandsmake help
- Available Makefile targets- Service APIs - Swagger UI at http://localhost:8080/swagger-ui.html
๐ฏ Production Considerations
Security Hardening
- Change all default passwords
- Use environment-specific secrets
- Enable HTTPS/TLS
- Restrict port exposure
- Enable authentication and authorization
Performance Optimization
- Increase resource limits for production workloads
- Configure database connection pooling
- Enable caching strategies
- Set up load balancing
Monitoring & Alerting
- Configure Grafana alerts
- Set up log aggregation
- Monitor resource usage
- Set up backup strategies
โ Verification Checklist
- [x] Docker Compose files created and configured
- [x] Dockerfile for Streamlit dashboard
- [x] Environment configuration templates
- [x] Startup automation scripts
- [x] Development workflow tools (Makefile)
- [x] Monitoring and admin interfaces
- [x] Health checks and service discovery
- [x] Volume mounts for development
- [x] Network isolation and security
- [x] Resource limits and optimization
- [x] Comprehensive documentation
- [x] Testing and validation tools
๐ Next Steps
-
Start Development Environment:
bash ./start-dev.sh
-
Access Main Dashboard:
- Open http://localhost:8501
- Verify all tabs are working
-
Test real-time analysis features
-
Explore Admin Interfaces:
- Database: http://localhost:8084
- Monitoring: http://localhost:3000
-
APIs: http://localhost:8080/swagger-ui.html
-
Begin Development:
- Edit code with hot reload
- Use monitoring tools
- Run tests regularly
๐ Development Environment Ready!
The SentinentalBERT Docker development environment is now fully configured and ready for use. All services are containerized, monitored, and optimized for development workflow.
Happy Coding! ๐