Code
Search code…
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Ansible - Traefik Network Deployment
Ansible - Named after Ursula K. Le Guin's instantaneous communication device from the Hainish Cycle, this deployment provides a unified Traefik reverse proxy network for external services.
🌐 Architecture
┌─────────────────┐
│ Traefik │
│ (Reverse Proxy) │
└────────┬────────┘
│
┌───────────────────┼───────────────────┐
│ │ │
┌─────────▼──────┐ ┌──────▼──────┐
│ Voight-Kampff │ │ External │
│ (Auth Service) │ │ Services │
└────────────────┘ └─────────────┘
API Keys + Cookies Protected by Hybrid Auth
Current Services (caronboulme.fr)
- Traefik Dashboard (
traefik.caronboulme.fr) - Reverse proxy dashboard (admin only) - Voight-Kampff Auth (
auth.caronboulme.fr) - Hybrid authentication service (API keys + web interface) - TheBrain (
thebrain.caronboulme.fr) - vLLM FastAPI server (protected) - Unmute Talk (
unmute-talk.caronboulme.fr) - TTS service (protected) - Unmute Transcript (
unmute-transcript.caronboulme.fr) - STT service (protected) - Chatterbox (
chatterbox.caronboulme.fr) - Alternative TTS service (protected) - Photos (
photos.caronboulme.fr) - Immich photo management (has its own auth)
🔐 Hybrid Authentication Strategy
Services are protected by Voight-Kampff hybrid authentication:
- API Keys for programmatic access (Bearer tokens)
- Web Interface with cookies for browser access
- Admin detection for sensitive services (like Traefik dashboard)
- Service-specific scopes and access control
🚀 Getting Started
Prerequisites
- Docker and Docker Compose installed
- External services (voight-kampff, thebrain, etc.) running and connected to the
ansiblenetwork - A domain name pointing to your server
- Ports 80 and 443 available
Installation
-
Clone/Navigate to the ansible directory
cd /path/to/Ansible -
Update Traefik email for Let's Encrypt certificates
nano traefik.yml # Change line 33: email: your-email@example.com -
Update your domain in configuration files
# Update traefik.yml and dynamic.yml sed -i 's/caronboulme.fr/yourdomain.com/g' traefik.yml dynamic.yml -
Create required directories and set permissions
mkdir -p traefik/logs touch traefik/acme.json chmod 600 traefik/acme.json -
Configure your services in dynamic.yml Edit
dynamic.ymlto:- Update service hostnames to your domain
- Configure service backends (container names and ports)
- Adjust middleware settings as needed
-
Start Traefik
docker-compose up -d -
Connect your external services Ensure your services are connected to the
ansiblenetwork:docker network connect ansible your-service-container -
Check logs
docker-compose logs -f
🔑 Authentication & Access
Web Interface Access
Visit the Voight-Kampff web interface for user-friendly API key management:
https://auth.caronboulme.fr
API Key Management
Note: API key creation/management is handled by the external Voight-Kampff service. Refer to the Voight-Kampff documentation for detailed API key operations.
Making Requests to Protected Services
Include the API key in the Authorization header:
curl https://thebrain.caronboulme.fr/v1/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen", "prompt": "Hello"}'
Python Example
import requests
API_KEY = "your-api-key-here"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# TheBrain (LLM) Service
response = requests.post(
"https://thebrain.caronboulme.fr/v1/completions",
headers=headers,
json={"model": "qwen", "prompt": "Hello world"}
)
# TTS Service (Unmute Talk)
response = requests.post(
"https://unmute-talk.caronboulme.fr/tts",
headers=headers,
json={"text": "Hello world"}
)
# STT Service (Unmute Transcript)
with open("audio.wav", "rb") as audio_file:
response = requests.post(
"https://unmute-transcript.caronboulme.fr/transcribe",
headers=headers,
files={"audio": audio_file}
)
🎯 Hybrid Authentication
The system supports both API keys and web authentication:
- API Keys - For programmatic access via Bearer tokens
- Web Cookies - For browser-based access (automatically handled)
- Admin Detection - Admin users can access sensitive services like Traefik dashboard
- Service Scopes - Fine-grained access control per service
🔧 Maintenance
View Logs
# Traefik logs
docker-compose logs -f traefik
# Traefik access logs
tail -f traefik/logs/access.log
# Check all external services connected to ansible network
docker ps --filter "network=ansible"
Restart Services
# Restart Traefik
docker-compose restart traefik
# Update Traefik
docker-compose pull traefik
docker-compose up -d traefik
Configuration Updates
# Reload dynamic.yml changes (automatic with file provider)
# Changes are picked up within seconds
# For traefik.yml changes, restart is required:
docker-compose restart traefik
Backup
# Backup Traefik certificates
cp traefik/acme.json acme.json.backup
# Backup configuration
cp dynamic.yml dynamic.yml.backup
cp traefik.yml traefik.yml.backup
🐛 Troubleshooting
SSL Certificates Not Generated
- Check Traefik logs:
docker-compose logs traefik - Verify your domain DNS points to your server
- Ensure ports 80 and 443 are open
- Check
traefik/acme.jsonpermissions:chmod 600 traefik/acme.json
Service Not Accessible
- Check if external service is running and connected to network:
docker network inspect ansible - Verify service configuration in
dynamic.yml - Check Traefik dashboard:
https://traefik.caronboulme.fr(admin access required) - Review Traefik logs:
docker-compose logs traefik
Authentication Issues
- Check Voight-Kampff service is running and accessible
- Verify the service can reach
http://voight-kampff:8080/verify - Test authentication endpoint:
curl -H "Authorization: Bearer YOUR_KEY" https://auth.caronboulme.fr/verify
📊 Network Details
- Network Name:
ansible - Driver: bridge
- Purpose: Connect external services to Traefik reverse proxy
- External services must join this network to be accessible through Traefik
- Only Traefik exposes ports 80/443 to the host
Connecting External Services
# Connect existing service to ansible network
docker network connect ansible your-service-container
# Or in docker-compose.yml:
networks:
ansible:
external: true
name: ansible
🔐 Security Recommendations
- Configure strong authentication in Voight-Kampff
- Regularly review active API keys and users
- Enable firewall to only allow ports 80/443
- Keep Traefik updated with
docker-compose pull - Monitor access logs regularly
- Secure admin access to Traefik dashboard
- Use HTTPS everywhere (automatically handled by Traefik)
- Review service configurations in
dynamic.ymlregularly
📚 References
Named after: Ansible (Ursula K. Le Guin's Hainish Cycle) - Instantaneous communication across vast distances Authentication: Voight-Kampff (Blade Runner) - The test to determine humanity