Skip to content

DevOpsTerminal/text2iac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Text2IaC Platform πŸš€

Generate production-ready infrastructure from plain English descriptions

Build Status Docker License: MIT

🎯 What is Text2IaC?

Text2IaC transforms natural language descriptions into production-ready infrastructure code. Simply describe what you need in plain English, and get:

  • Terraform modules for cloud infrastructure
  • Docker Compose files for local development
  • Kubernetes manifests for container orchestration
  • Monitoring setup with Prometheus/Grafana
  • CI/CD pipelines with GitHub Actions

✨ Key Features

  • πŸ“§ Email Integration - Send requests via email
  • 🌐 Web Interface - User-friendly dashboard
  • πŸ€– AI-Powered - Uses Mistral 7B locally via Ollama
  • πŸ”’ Fully Local - No external dependencies or data sharing
  • ⚑ Fast Setup - Running in 5 minutes
  • 🎨 Template-Based - Reusable, tested patterns

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • 8GB RAM (for LLM)
  • 20GB disk space

1. Clone and Start

git clone https://github.com/devopsterminal/text2iac-platform.git
cd text2iac-platform

# Copy environment template
cp .env.example .env

# Start all services
make start

2. Wait for LLM Download (first time)

# Monitor Ollama logs
docker-compose logs -f ollama

# Should see: "Mistral 7B model loaded successfully"

3. Test via Email

# Send test email (if SMTP configured)
echo "Create a Node.js API with PostgreSQL database" | \
  mail -s "[TEXT2IAC] Test API" infrastructure@localhost

4. Test via Web Interface

# Open web interface
open http://localhost:8080

# Or manually navigate to http://localhost:8080

πŸ“– Usage Examples

Example 1: Simple Web API

Subject: [TEXT2IAC] User Management API

Create a Node.js REST API with:
- User authentication (JWT)
- PostgreSQL database
- Redis caching
- Auto-scaling setup
- Basic monitoring

Expected traffic: 1000 requests/hour
Environment: Production

Generated Output:

  • βœ… Terraform AWS infrastructure
  • βœ… Docker Compose for local dev
  • βœ… Kubernetes manifests
  • βœ… Monitoring dashboard
  • βœ… CI/CD pipeline

Example 2: E-commerce Platform

Build an e-commerce platform with:
- Product catalog (Elasticsearch)
- Shopping cart (Redis)
- Payment processing (Stripe integration)
- Order management (PostgreSQL)
- Admin dashboard
- Real-time analytics

Generated Output:

  • βœ… Microservices architecture
  • βœ… API Gateway setup
  • βœ… Database migrations
  • βœ… Load balancer configuration
  • βœ… Security best practices

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Email       │────│   Text2IaC      │────│   Generated     β”‚
β”‚   Integration   β”‚    β”‚   API Server    β”‚    β”‚  Infrastructure β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Web Interface │────│   Mistral 7B    │────│   Templates     β”‚
β”‚   Dashboard     β”‚    β”‚   (via Ollama)  β”‚    β”‚   & Examples    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‘ Integration Options

1. Email Integration

Send infrastructure requests to [email protected]:

To: [email protected]
Subject: [TEXT2IAC] Project Name

Describe your infrastructure needs in plain English...

2. Web Interface

Access the web dashboard at http://localhost:8080:

  • πŸ“ Text input form
  • 🎯 Template gallery
  • πŸ“Š Status tracking
  • πŸ“‹ Request history

3. API Endpoints

Direct API access for programmatic use:

# Generate infrastructure
curl -X POST http://localhost:3001/api/generate \
  -H "Content-Type: application/json" \
  -d '{"description": "Create a blog with comments", "environment": "production"}'

# Check status
curl http://localhost:3001/api/status/{request_id}

πŸ› οΈ Configuration

Environment Variables

# Core Settings
OLLAMA_MODEL=mistral:7b
API_PORT=3001
WEB_PORT=8080

# Email Configuration (optional)
SMTP_HOST=mail.company.com
[email protected]
SMTP_PASS=your-password
IMAP_HOST=mail.company.com

# Database
DB_HOST=postgres
DB_NAME=text2iac
DB_USER=text2iac
DB_PASS=secure-password

# Security
JWT_SECRET=your-jwt-secret
API_KEY=your-api-key

Email Setup (Optional)

If you want email integration, configure SMTP/IMAP:

  1. Gmail/Google Workspace:

    SMTP_HOST=smtp.gmail.com
    IMAP_HOST=imap.gmail.com
    [email protected]
    SMTP_PASS=app-specific-password
  2. Microsoft Exchange:

    SMTP_HOST=smtp.office365.com
    IMAP_HOST=outlook.office365.com
  3. Internal Mail Server:

    SMTP_HOST=mail.company.internal
    IMAP_HOST=mail.company.internal

πŸ“Š Monitoring & Health Checks

Service Status

# Check all services
make health-check

# Individual service health
curl http://localhost:3001/health    # API Server
curl http://localhost:8080/health    # Web Interface
curl http://localhost:11434/api/ps   # Ollama LLM

Logs

# View all logs
docker-compose logs -f

# Specific service logs
docker-compose logs -f api
docker-compose logs -f email-bridge
docker-compose logs -f ollama

Metrics

  • πŸ“ˆ Request metrics: http://localhost:3001/metrics
  • πŸ”§ System metrics: http://localhost:9090 (if Prometheus enabled)
  • πŸ“Š Dashboards: http://localhost:3000 (if Grafana enabled)

πŸ”§ Development

Local Development

# Start in development mode
make dev

# Run tests
make test

# Code formatting
make format

# Type checking
make lint

Adding New Templates

  1. Create template in templates/ directory
  2. Add to template registry in api/src/services/template.service.ts
  3. Test with example request
  4. Update documentation

Custom Prompts

Modify LLM prompts in config/prompts/:

  • system-prompt.txt - Base instructions for LLM
  • terraform-prompt.txt - Terraform-specific guidance
  • kubernetes-prompt.txt - Kubernetes-specific guidance

🚒 Deployment

Docker Compose (Recommended)

# Production deployment
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

# With monitoring stack
docker-compose -f docker-compose.yml -f docker-compose.monitoring.yml up -d

Kubernetes

# Apply manifests
kubectl apply -f k8s/

# Check status
kubectl get pods -n text2iac

Cloud Deployment

  • AWS: Use ECS or EKS with provided configurations
  • Azure: Use Container Instances or AKS
  • GCP: Use Cloud Run or GKE

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidelines.

πŸ“š Documentation

πŸ› Troubleshooting

Common Issues

LLM not responding:

# Check Ollama status
curl http://localhost:11434/api/ps

# Restart Ollama
docker-compose restart ollama

Email not working:

# Check email bridge logs
docker-compose logs email-bridge

# Test SMTP connection
telnet $SMTP_HOST 587

Web interface not loading:

# Check frontend logs
docker-compose logs frontend

# Verify API connection
curl http://localhost:3001/health

Performance Tuning

For better LLM performance:

  • Increase Docker memory limit to 12GB+
  • Use GPU if available (NVIDIA Docker runtime)
  • Consider faster models like CodeLlama 7B

For high request volume:

  • Scale API service (docker-compose up --scale api=3)
  • Add Redis caching
  • Use load balancer (Nginx/HAProxy)

πŸ“ˆ Roadmap

Version 1.0 (Current MVP)

  • βœ… Email integration
  • βœ… Web interface
  • βœ… Basic templates (Terraform, Docker Compose)
  • βœ… Local LLM (Mistral 7B)

Version 1.1 (Next Release)

  • πŸ”² Slack/Teams integration
  • πŸ”² Template gallery
  • πŸ”² Request history
  • πŸ”² User authentication

Version 2.0 (Future)

  • πŸ”² Backstage plugin
  • πŸ”² ArgoCD integration
  • πŸ”² Multi-cloud support
  • πŸ”² Advanced monitoring

πŸ“„ License

This project is licensed under the Apache License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support


Made with ❀️ by the Platform Engineering Team