Configuration

View as MarkdownOpen in Claude

Overview

This guide covers advanced configuration options for customizing your TTS Docker deployment. Learn how to optimize resources, configure external services, and tune performance.

Environment Variables

All configuration is managed through environment variables in the .env file.

Core Configuration

LICENSE_KEY
stringRequired

Your Smallest.ai license key for validation and usage reporting

API Server Configuration

API_SERVER_PORT
integerDefaults to 7100

Port for the API server to listen on

$API_SERVER_PORT=8080
API_BASE_URL
stringDefaults to http://license-proxy:3369

Internal URL for license proxy communication

LIGHTNING_TTS_BASE_URL
stringDefaults to http://lightning-tts:8876

Internal URL for Lightning TTS communication

Lightning TTS Configuration

TTS_PORT
integerDefaults to 8876

Port for Lightning TTS to listen on

$TTS_PORT=8876
REDIS_URL
stringDefaults to redis://redis:6379

Redis connection URL for caching and state management

For external Redis:

$REDIS_URL=redis://external-redis.example.com:6379

With password:

$REDIS_URL=redis://:password@redis:6379
GPU_DEVICE_ID
stringDefaults to 0

GPU device ID to use (for multi-GPU systems)

$GPU_DEVICE_ID=0

Resource Configuration

GPU Allocation

For systems with multiple GPUs, you can specify which GPU to use:

docker-compose.yml
1lightning-tts:
2 deploy:
3 resources:
4 reservations:
5 devices:
6 - driver: nvidia
7 device_ids: ['0']
8 capabilities: [gpu]

For multiple GPUs per container:

docker-compose.yml
1lightning-tts:
2 deploy:
3 resources:
4 reservations:
5 devices:
6 - driver: nvidia
7 count: 2
8 capabilities: [gpu]

Memory Limits

Set memory limits to prevent resource exhaustion:

docker-compose.yml
1services:
2 lightning-tts:
3 deploy:
4 resources:
5 limits:
6 memory: 16G
7 reservations:
8 memory: 12G

CPU Limits

Control CPU allocation:

docker-compose.yml
1services:
2 lightning-tts:
3 deploy:
4 resources:
5 limits:
6 cpus: '8'
7 reservations:
8 cpus: '4'

External Services

External Redis

Use an external Redis instance instead of the embedded one:

docker-compose.yml
1services:
2 api-server:
3 environment:
4 - REDIS_HOST=external-redis.example.com
5 - REDIS_PORT=6379
6 - REDIS_PASSWORD=${REDIS_PASSWORD}
7
8 lightning-tts:
9 environment:
10 - REDIS_HOST=external-redis.example.com
11 - REDIS_PORT=6379
12 - REDIS_PASSWORD=${REDIS_PASSWORD}

Remove the Redis service from docker-compose.yml.

Custom Network

Use a custom Docker network:

docker-compose.yml
1networks:
2 custom-network:
3 driver: bridge
4 name: my-custom-network
5
6services:
7 api-server:
8 networks:
9 - custom-network

Performance Tuning

Voice Configuration

Configure voice parameters:

docker-compose.yml
1lightning-tts:
2 environment:
3 - DEFAULT_VOICE=default
4 - VOICE_SPEED=1.0
5 - VOICE_PITCH=1.0

Batch Processing

Optimize for batch processing:

docker-compose.yml
1lightning-tts:
2 environment:
3 - BATCH_SIZE=8
4 - MAX_QUEUE_SIZE=100

Model Precision

Control model precision for performance:

docker-compose.yml
1lightning-tts:
2 environment:
3 - MODEL_PRECISION=fp16

Options: fp32, fp16, int8

Volume Mounts

Persistent Model Cache

Cache models to avoid re-downloading:

docker-compose.yml
1services:
2 lightning-tts:
3 volumes:
4 - tts-models:/app/models
5
6volumes:
7 tts-models:

Log Persistence

Persist logs for debugging:

docker-compose.yml
1services:
2 api-server:
3 volumes:
4 - ./logs/api-server:/app/logs
5
6 lightning-tts:
7 volumes:
8 - ./logs/tts:/app/logs

Health Checks

Add health checks for better monitoring:

docker-compose.yml
1services:
2 lightning-tts:
3 healthcheck:
4 test: ["CMD", "curl", "-f", "http://localhost:8876/health"]
5 interval: 30s
6 timeout: 10s
7 retries: 3
8 start_period: 60s
9
10 api-server:
11 healthcheck:
12 test: ["CMD", "curl", "-f", "http://localhost:7100/health"]
13 interval: 30s
14 timeout: 10s
15 retries: 3

Security Configuration

Read-Only Root Filesystem

Enhance security with read-only root filesystem:

docker-compose.yml
1services:
2 api-server:
3 read_only: true
4 tmpfs:
5 - /tmp
6 - /var/tmp

Non-Root User

Run containers as non-root:

docker-compose.yml
1services:
2 api-server:
3 user: "1000:1000"

Environment File Example

Complete .env file example:

.env
$LICENSE_KEY=your-license-key-here
$
$API_SERVER_PORT=7100
$TTS_PORT=8876
$
$REDIS_HOST=redis
$REDIS_PORT=6379
$
$GPU_DEVICE_ID=0
$
$DEFAULT_VOICE=default
$VOICE_SPEED=1.0

What’s Next?