Installation Guide
Complete setup instructions for both Basic (OSS) and Advanced (Enterprise) editions
5-Minute Quick Start
Perfect for development, prototyping, and getting started quickly
1
Clone Repository
# Contact support@wag-tail.com for source code access
cd wag-tail-ai-gateway
2
Setup Environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
3
Start Gateway
uvicorn main:app --reload
Gateway now running at http://localhost:8000
4
Test API
curl -X POST http://localhost:8000/chat \
-H "X-API-Key: b6c91d9d2ff66624356f5e5cfd03dc784d80a2eedd6af0d94e908d7b19e25e85" \
-H "Content-Type: application/json" \
-d '{"prompt": "Hello world!"}'
Success!
Your Basic Edition is now running with full PII protection and security filtering.
System Requirements
Basic Edition
Python
3.9+
3.11+
RAM
2GB
4GB+
CPU
2 cores
4+ cores
Storage
5GB
10GB+
Advanced Edition
Python
3.9+
3.11+
RAM
8GB
16GB+
CPU
4 cores
8+ cores
Storage
20GB
50GB+
PostgreSQL
12+
15+
Redis
6+
7+
Basic Edition Installation
Open source edition with core security and filtering capabilities
Option 1: Standard Installation
# Install system dependencies (Ubuntu/Debian)
sudo apt update
sudo apt install python3 python3-venv python3-pip git curl -y
# Get source code - contact support@wag-tail.com
# git clone [repository URL]
cd wag-tail-ai-gateway
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
# Configure
cp config/sys_config.yaml.template config/sys_config.yaml
# Start
uvicorn main:app --reload
Option 2: Docker (Coming Soon)
docker run -p 8000:8000 wagtail/ai-gateway:basic
Minimal Configuration (config/sys_config.yaml)
llm:
provider: "mistral" # or "openai", "gemini", "azure"
model: "mistral"
api_url: "http://localhost:11434/api/generate" # Ollama default
api_key: "" # Leave empty for Ollama
log:
log_level: "INFO"
gateway_log: "logs/wag_tail_gateway.log"
max_log_size_mb: 50
regex:
injection_patterns:
- "(select\\s+\\*\\s+from\\s+)"
- "(drop\\s+table\\s+)"
- "(insert\\s+into\\s+)"
Advanced Edition Installation
Enterprise edition with semantic caching, priority queuing, and advanced routing
Prerequisites Checklist
1. Install Enterprise License
# Copy your license file
cp /path/to/your/license.key config/license.key
# Verify license
python -c "from license_loader import validate_license_expiry; validate_license_expiry()"
2. Setup PostgreSQL Database
# Install PostgreSQL
sudo apt install postgresql postgresql-contrib -y
sudo systemctl start postgresql
sudo systemctl enable postgresql
# Create database
sudo -u postgres psql
-- In PostgreSQL shell
CREATE USER wagtail_user WITH PASSWORD 'your_secure_password';
CREATE DATABASE wagtail_db OWNER wagtail_user;
GRANT ALL PRIVILEGES ON DATABASE wagtail_db TO wagtail_user;
\q
3. Setup Redis
# Install Redis
sudo apt install redis-server -y
sudo systemctl start redis-server
sudo systemctl enable redis-server
# Test connection
redis-cli ping # Should return "PONG"
4. Configure Advanced Features
# config/sys_config.yaml (Advanced)
database:
host: "localhost"
port: 5432
username: "wagtail_user"
password: "your_secure_password"
database: "wagtail_db"
cache:
enabled: true
redis_host: "localhost"
redis_port: 6379
ttl_seconds: 3600
llm:
provider: "mistral"
model: "mistral"
api_url: "http://localhost:11434/api/generate"
Verification & Testing
1. Health Check
curl http://localhost:8000/admin/health \
-H "X-Admin-API-Key: your-admin-key"
Expected Response:
{
"status": "healthy",
"version": "3.4.0",
"edition": "basic|advanced",
"database": "connected",
"redis": "connected",
"plugins_loaded": 4
}
2. API Functionality Test
curl -X POST http://localhost:8000/chat \
-H "X-API-Key: b6c91d9d2ff66624356f5e5cfd03dc784d80a2eedd6af0d94e908d7b19e25e85" \
-H "Content-Type: application/json" \
-d '{"prompt": "What is 2+2?"}'
Expected Response:
{
"response": "2 + 2 equals 4.",
"flag": "safe",
"llm_provider": "mistral",
"llm_model_name": "mistral",
"cache_hit": false,
"process_time_ms": 1234
}
3. Security Features Test
# Test SQL injection protection
curl -X POST http://localhost:8000/chat \
-H "X-API-Key: b6c91d9d2ff66624356f5e5cfd03dc784d80a2eedd6af0d94e908d7b19e25e85" \
-H "Content-Type: application/json" \
-d '{"prompt": "SELECT * FROM users; DROP TABLE users;"}'
Should be blocked with:
{
"response": "",
"flag": "blocked",
"reason": "SQL injection pattern detected"
}
Troubleshooting
Module not found error
# Ensure virtual environment is activated
source venv/bin/activate
pip install -r requirements.txt
Database Connection Failed
# Test PostgreSQL connection
psql -h localhost -U wagtail_user -d wagtail_db
# Check service status
sudo systemctl status postgresql
Redis Connection Failed
# Test Redis connection
redis-cli ping
# Check service status
sudo systemctl status redis-server
License Validation Failed
# Check license file
ls -la config/license.key
# Validate license
python -c "from license_loader import get_license_info; print(get_license_info())"
Production Setup
Systemd Service (Linux)
# Create service file
sudo tee /etc/systemd/system/wag-tail.service > /dev/null << EOF
[Unit]
Description=Wag Tail AI Gateway
After=network.target postgresql.service redis.service
[Service]
Type=simple
User=wagtail
WorkingDirectory=/opt/wag-tail-ai-gateway
Environment=PATH=/opt/wag-tail-ai-gateway/venv/bin
ExecStart=/opt/wag-tail-ai-gateway/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
# Enable and start
sudo systemctl enable wag-tail
sudo systemctl start wag-tail
Nginx Reverse Proxy
# /etc/nginx/sites-available/wag-tail
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Increase timeout for LLM processing
proxy_read_timeout 300s;
proxy_connect_timeout 10s;
proxy_send_timeout 10s;
}
}