A comprehensive infrastructure-as-code setup for self-hosting essential services including databases, monitoring, security, and productivity tools.
This repository contains Docker Compose configurations and documentation for deploying a complete self-hosted infrastructure stack, including:
- Database Services: MongoDB, PostgreSQL, Redis
- Monitoring & Observability: Comprehensive monitoring stack with metrics, logs, and alerting
- Security: Fail2ban for intrusion prevention, Infisical for secrets management
- Storage & Productivity: MinIO object storage, Nextcloud file sharing
- Container Management: Docker monitoring and management tools
├── docker-monitoring/ # Container monitoring and management
├── docs/ # Documentation and setup guides
├── fail2ban/ # Intrusion prevention and security
├── infisical/ # Secrets management
├── minio/ # Object storage service
├── mlflow/ # ML experiment tracking (if applicable)
├── mongodb/ # MongoDB database
├── monitoring-stack/ # Metrics, logging, and alerting
├── nextcloud/ # File sharing and collaboration
├── postgres/ # PostgreSQL database
└── redis/ # In-memory data store
- Docker Engine 20.10+
- Docker Compose 2.0+
- Minimum 4GB RAM, 20GB storage
- Domain name (recommended for SSL/TLS)
-
Clone the repository
git clone <repository-url> cd self-hosted-infrastructure
-
Copy environment templates
find . -name "*.env.example" -exec bash -c 'cp "$1" "${1%.example}"' _ {} \;
-
Configure environment variables Edit the
.envfiles in each service directory with your specific settings. -
Start core services
# Start databases first docker-compose -f postgres/docker-compose.yml up -d docker-compose -f mongodb/docker-compose.yml up -d docker-compose -f redis/docker-compose.yml up -d # Start monitoring stack docker-compose -f monitoring-stack/docker-compose.yml up -d # Start remaining services docker-compose -f nextcloud/docker-compose.yml up -d docker-compose -f minio/docker-compose.yml up -d
- PostgreSQL: Primary relational database
- MongoDB: Document database for flexible schemas
- Redis: Caching and session storage
Complete observability solution including:
- Metrics collection and visualization
- Log aggregation and analysis
- Alerting and notification system
- Performance monitoring dashboards
- Fail2ban: Automated intrusion prevention
- Infisical: Centralized secrets management
- SSL/TLS: Automated certificate management (recommended with reverse proxy)
- MinIO: S3-compatible object storage
- Nextcloud: File sharing, calendar, and collaboration platform
- Change default passwords in all
.envfiles - Enable firewall and close unnecessary ports
- Set up SSL/TLS certificates for web services
- Configure backup strategies for persistent data
- Review and customize Fail2ban rules for your environment
- Use strong secrets managed through Infisical
# Check service status
docker-compose ps
# View service logs
docker-compose logs -f [service-name]
# Monitor resource usage
docker statsEach service directory contains backup scripts and documentation. Key backup locations:
- Database dumps:
./backups/databases/ - Configuration files:
./backups/configs/ - User data:
./backups/data/
# Update images
docker-compose pull
# Restart services with new images
docker-compose up -dAfter deployment, services will be available at:
- Nextcloud:
http://localhost:8080(configure your domain) - MinIO Console:
http://localhost:9001 - Monitoring Dashboard:
http://localhost:3000 - Database connections: See individual service documentation
Note: Configure a reverse proxy (nginx, Traefik) for production deployments with proper SSL/TLS termination. NGINX Example Config located under /nginx folder
Detailed setup guides and configuration documentation are available in the docs/ directory:
- Service-specific setup instructions
- Troubleshooting guides
- Performance optimization tips
- Security hardening recommendations
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Please ensure all changes include appropriate documentation updates.
This infrastructure setup is intended for self-hosting enthusiasts and small to medium deployments. Always review configurations, implement proper security measures, and maintain regular backups before using in production environments.
- Check the
docs/directory for detailed guides - Review service logs for troubleshooting
- Open an issue for bugs or feature requests
Happy self-hosting! 🏠
All Configs managed, developed and created by Shaivil Patel