Skip to content

Repository files navigation

AI Development Environment Setup

PowerShell .NET License

Automated installer and verification suite for AI development stack on Windows, macOS, and Linux, featuring optimized Ollama configuration with parallel execution support.


Features

  • Automated Ollama Setup - Install and configure with 4x parallel execution
  • Docker Container Management - PostgreSQL+pgvector, Qdrant, n8n workflow platform
  • Model Management - Auto-install nomic-embed-text, llama3.1, llama3.2
  • Health Checks - Comprehensive verification and diagnostics
  • Auto-Fix - Automatically resolve common configuration issues
  • Performance Optimized - 80% faster logging, 95% faster startup

Requirements

  • OS: Windows 10/11 (x64), macOS, or Linux
  • PowerShell: 7.0 or later (Windows)
  • Bash: (macOS/Linux)
  • Privileges: Administrator/root rights (for some operations)
  • Docker: (Optional, for vector databases)
  • Internet: For model downloads

Quick Start

Windows

Option 1: Windows GUI (Easiest)

Double-click these files in Windows Explorer:

setup.cmd    - Run this as Administrator
verify.cmd   - Run this normally

Option 2: PowerShell

# Full installation with parallel execution (requires admin)
pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup.ps1

# Dry-run mode (preview operations)
pwsh -File .\scripts\setup.ps1 -DryRun

# Skip Docker containers
pwsh -File .\scripts\setup.ps1 -SkipDocker

Option 3: Verify Installation

# Check all components
pwsh -File .\scripts\verify-ai-stack.ps1

# Auto-fix any issues
pwsh -File .\scripts\verify-ai-stack.ps1 -AutoFix

# Skip optional components
pwsh -File .\scripts\verify-ai-stack.ps1 -SkipN8n -SkipVectorDb

macOS / Linux

Option 1: Bash (Recommended)

# Full installation (run from project root)
bash ./scripts/setup.sh

# Verify stack
bash ./scripts/verify-ai-stack.sh

# Diagnose Ollama
bash ./scripts/diagnose-ollama.sh

Note: You may need to run with sudo for some operations (e.g., Docker).


Project Structure

Setup-AI-Dev-Environment/
|-- scripts/            # PowerShell automation scripts
|   |-- setup.ps1
|   |-- verify-ai-stack.ps1
|-- docker/             # Docker configurations
|   |-- docker-compose-pgvector.yml
|   |-- docker-compose-qdrant.yml
|-- docs/               # Documentation
|   |-- OLLAMA_PARALLEL_CONFIG.md
|   |-- VERIFY_PARALLEL_CONFIG.md
|-- setup.cmd          # Quick setup launcher
|-- verify.cmd         # Quick verification launcher
|-- README.md          # This file

For detailed structure information, see docs/PROJECT_STRUCTURE.md.


Documentation

Document Description
OLLAMA_PARALLEL_CONFIG.md Parallel execution configuration guide
VERIFY_PARALLEL_CONFIG.md Verification script documentation
PROJECT_STRUCTURE.md Project organization guide
SETUP_GIT_FRESH.md Git repository setup guide

Architecture

Components

---------------- AI Development Stack ----------------
|  Ollama (LLM Service)     |  Port: 11434                |
|  - Parallel Execution     |  Concurrent: 4 requests     |
|  - nomic-embed-text       |  Embeddings                 |
|  - llama3.1:latest        |  Generation (stable)        |
|  - llama3.2:latest        |  Generation (latest)        |
---------------------------------------------------------
|  Vector Databases                                    |
|  - pgvector             |  Port: 5432  (Default)      |
|  - Qdrant               |  Port: 6333/6334            |
|  - ChromaDB             |  Port: 8000                 |
---------------------------------------------------------
|  Cache & Storage                                     |
|  - Redis                |  Port: 6379                 |
|  - Redis Commander      |  Port: 8081  (UI)           |
---------------------------------------------------------
|  Workflow Platform                                   |
|  - n8n                  |  Port: 5678                 |
---------------------------------------------------------

Performance Optimizations

  • 80% faster logging - .NET File API buffering
  • 70% faster process management - Single query caching
  • 95% faster startup - Lazy assembly loading
  • 60% faster installer detection - Pre-compiled regex
  • 4x throughput - Ollama parallel execution

Scripts Overview

All scripts are located in the scripts/ directory:

Script Purpose Admin Required
scripts/setup.ps1 Main installation script Yes
scripts/verify-ai-stack.ps1 Health checks and verification No
scripts/diagnose-ollama.ps1 Ollama diagnostics No
scripts/check_syntax.ps1 PowerShell syntax validation No

Quick Launchers (Root)

File Purpose Admin Required
setup.cmd Launch setup script Yes
verify.cmd Launch verification script No

Docker Configurations (docker/)

File Service Port
docker/docker-compose-pgvector.yml PostgreSQL + pgvector 5432
docker/docker-compose-qdrant.yml Qdrant vector DB 6333/6334
docker/docker-compose-redis.yml Redis cache + UI 6379, 8081

Usage Examples

Example 1: Fresh Installation (Windows)

REM Double-click setup.cmd as Administrator
setup.cmd

REM Or use PowerShell
pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\setup.ps1

Then verify:

REM Double-click verify.cmd
verify.cmd

REM Or use PowerShell
pwsh -File .\scripts\verify-ai-stack.ps1

Output:

Ollama: Running
    Parallel execution: 4 concurrent requests
Models: All required models available (3/3)
Vector DB: pgvector is running
n8n: Running on port 5678

Example 2: Troubleshooting

# Run verification with auto-fix
pwsh -File .\scripts\verify-ai-stack.ps1 -AutoFix

# If issues persist, run diagnostics
pwsh -File .\scripts\diagnose-ollama.ps1

Example 3: Testing Ollama

# Test embedding generation
$body = @{
    model = 'nomic-embed-text'
    prompt = 'test text'
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:11434/api/embeddings" `
    -Method Post -Body $body -ContentType 'application/json'

# Test text generation
$body = @{
    model = 'llama3.1:latest'
    prompt = 'Explain AI in 10 words'
    stream = $false
} | ConvertTo-Json

Invoke-RestMethod -Uri "http://localhost:11434/api/generate" `
    -Method Post -Body $body -ContentType 'application/json'

Configuration

Environment Variables

# Ollama parallel execution (set by setup.ps1)
$env:OLLAMA_NUM_PARALLEL = "4"

# PostgreSQL password (used by setup.ps1)
$env:PGPASSWORD = "Mutsmuts10"

# Custom Npgsql path (optional)
$env:NPGSQL_DLL_PATH = "C:\custom\path\Npgsql.dll"

Customize Setup

Edit scripts/setup.ps1 to modify step execution:

$StepSelector = @{
    'InstallTools'            = 1  # Enable/disable with 1/0
    'BootstrapDependencies'   = 1
    'EnsureNpgsql'            = 1
    'StartPgvectorContainer'  = 1
    'CreateCompose'           = 1
    'DockerUpN8n'             = 1
    'OllamaEmbeddingTest'     = 1
    'KeepSessionOpen'         = 0
}

Docker Configurations

All Docker files are in the docker/ folder:

# Start pgvector
docker compose -f .\docker\docker-compose-pgvector.yml up -d

# Start Qdrant
docker compose -f .\docker\docker-compose-qdrant.yml up -d

# Start Redis
docker compose -f .\docker\docker-compose-redis.yml up -d

# Stop services
docker compose -f .\docker\docker-compose-pgvector.yml down

Troubleshooting

Ollama Not Starting

# Check if port 11434 is blocked
netstat -ano | findstr :11434

# Kill blocking process
taskkill /F /PID <PID>

# Restart Ollama
ollama serve

Models Not Pulling

# Pull manually
ollama pull nomic-embed-text
ollama pull llama3.1
ollama pull llama3.2

# Check disk space
Get-PSDrive C | Select-Object Used,Free

Docker Container Issues

# Check Docker status
docker ps -a

# View logs
docker logs pgvector-db
docker logs n8n

# Restart containers
docker compose -f docker-compose-pgvector.yml restart

Performance Benchmarks

Ollama Throughput

Configuration Requests/Min Latency (avg)
Sequential (default) ~10 6000ms
Parallel (2) ~18 3500ms
Parallel (4) ~35 1800ms
Parallel (8) ~60 1000ms

Script Execution Times

Operation Before Optimization After Optimization Improvement
Logging 50ms 10ms 80%
Process Queries 300ms 90ms 70%
Startup 400ms 20ms 95%
Installer Detection 200ms 80ms 60%

Contributing

Contributions are welcome! Please follow these steps:

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

License

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


Acknowledgments

  • Ollama - Local LLM runtime
  • pgvector - PostgreSQL vector extension
  • Qdrant - Vector search engine
  • n8n - Workflow automation platform

Support


Roadmap

  • Add support for Linux/macOS
  • GUI installer option
  • Additional LLM provider support
  • Kubernetes deployment templates
  • Automated testing suite
  • Integration with VS Code extension

Made with love for AI Developers

Version: 2.2 | Last Updated: December 2025

About

Setup AI-Dev-Environment

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages