Skip to content

Commit c0fe39f

Browse files
authored
Merge pull request #90 from davidamacey/fix/offline-docker-updates
Production hardening with infrastructure upgrades and enhanced offline deployment
2 parents 67d4ab2 + 2b7210a commit c0fe39f

13 files changed

Lines changed: 947 additions & 171 deletions

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<img src="assets/logo-banner.png" alt="OpenTranscribe Logo" width="400">
3-
3+
44
**AI-Powered Transcription and Media Analysis Platform**
55
</div>
66

@@ -165,11 +165,15 @@ curl -fsSL https://raw.githubusercontent.com/davidamacey/OpenTranscribe/master/s
165165
```
166166

167167
Then follow the on-screen instructions. The setup script will:
168+
- Detect your hardware (NVIDIA GPU, Apple Silicon, or CPU)
168169
- Download the production Docker Compose file
169-
- Configure environment variables including GPU support (default GPU device ID: 2)
170-
- Help you set up your Hugging Face token (required for speaker diarization)
170+
- Configure environment variables with optimal settings for your hardware
171+
- **Prompt for your HuggingFace token** (required for speaker diarization)
172+
- **Automatically download and cache AI models (~2.5GB)** if token is provided
171173
- Set up the management script (`opentranscribe.sh`)
172174

175+
**Note:** The script will prompt you for your HuggingFace token during setup. If you provide it, AI models will be downloaded and cached before Docker starts, ensuring the app is ready to use immediately. If you skip this step, models will download on first use (10-30 minute delay).
176+
173177
Once setup is complete, start OpenTranscribe with:
174178

175179
```bash
@@ -189,7 +193,7 @@ Access the web interface at http://localhost:5173
189193
```bash
190194
git clone https://github.com/davidamacey/OpenTranscribe.git
191195
cd OpenTranscribe
192-
196+
193197
# Make utility script executable
194198
chmod +x opentr.sh
195199
```
@@ -198,7 +202,7 @@ Access the web interface at http://localhost:5173
198202
```bash
199203
# Copy environment template
200204
cp .env.example .env
201-
205+
202206
# Edit .env file with your settings (optional for development)
203207
# Key variables:
204208
# - HUGGINGFACE_TOKEN (required for speaker diarization)
@@ -209,7 +213,7 @@ Access the web interface at http://localhost:5173
209213
```bash
210214
# Start in development mode (with hot reload)
211215
./opentr.sh start dev
212-
216+
213217
# Or start in production mode
214218
./opentr.sh start prod
215219
```
@@ -470,7 +474,7 @@ OpenTranscribe offers flexible AI deployment options. Choose the approach that b
470474
LLM_PROVIDER=openai
471475
OPENAI_API_KEY=your_openai_key
472476
OPENAI_MODEL_NAME=gpt-4o-mini
473-
477+
474478
# Start without local LLM
475479
./opentr.sh start dev
476480
```
@@ -480,7 +484,7 @@ OpenTranscribe offers flexible AI deployment options. Choose the approach that b
480484
# Configure for vLLM in .env
481485
LLM_PROVIDER=vllm
482486
VLLM_MODEL_NAME=gpt-oss-20b
483-
487+
484488
# Start with vLLM service (requires 16GB+ VRAM)
485489
docker compose -f docker-compose.yml -f docker-compose.vllm.yml up
486490
```
@@ -490,7 +494,7 @@ OpenTranscribe offers flexible AI deployment options. Choose the approach that b
490494
# Configure for Ollama in .env
491495
LLM_PROVIDER=ollama
492496
OLLAMA_MODEL_NAME=llama3.2:3b-instruct-q4_K_M
493-
497+
494498
# Edit docker-compose.vllm.yml and uncomment ollama service
495499
# Then start with both compose files
496500
docker compose -f docker-compose.yml -f docker-compose.vllm.yml up
@@ -501,7 +505,7 @@ OpenTranscribe offers flexible AI deployment options. Choose the approach that b
501505
# Cloud Providers (configure in .env)
502506
LLM_PROVIDER=openai # openai, anthropic, custom (openrouter)
503507
OPENAI_API_KEY=your_openai_key # OpenAI GPT models
504-
ANTHROPIC_API_KEY=your_claude_key # Anthropic Claude models
508+
ANTHROPIC_API_KEY=your_claude_key # Anthropic Claude models
505509
OPENROUTER_API_KEY=your_or_key # OpenRouter (multi-provider)
506510

507511
# Local Providers (requires additional Docker services)
@@ -511,7 +515,7 @@ LLM_PROVIDER=ollama # Local Ollama server
511515

512516
**🎯 Deployment Scenarios:**
513517
- **💰 Cost-Effective**: OpenRouter with Claude Haiku (~$0.25/1M tokens)
514-
- **🔒 Privacy-First**: Local vLLM or Ollama (no data leaves your server)
518+
- **🔒 Privacy-First**: Local vLLM or Ollama (no data leaves your server)
515519
- **⚡ Performance**: OpenAI GPT-4o-mini (fastest cloud option)
516520
- **📱 Small Models**: Even 3B Ollama models can handle hours of content via intelligent sectioning
517521
- **🚫 No LLM**: Leave `LLM_PROVIDER` empty for transcription-only mode
@@ -534,7 +538,7 @@ OpenTranscribe automatically downloads and caches AI models for optimal performa
534538
│ ├── hub/ # WhisperX transcription models (~1.5GB)
535539
│ └── transformers/ # PyAnnote transformer models
536540
└── torch/ # PyTorch cache
537-
├── hub/checkpoints/ # Wav2Vec2 alignment model (~360MB)
541+
├── hub/checkpoints/ # Wav2Vec2 alignment model (~360MB)
538542
└── pyannote/ # PyAnnote diarization models (~500MB)
539543
```
540544

@@ -606,7 +610,7 @@ For production use, ensure you:
606610
# Generate strong secrets
607611
openssl rand -hex 32 # For SECRET_KEY
608612
openssl rand -hex 32 # For JWT_SECRET_KEY
609-
613+
610614
# Set strong database passwords
611615
# Configure proper firewall rules
612616
# Set up SSL/TLS certificates
@@ -616,7 +620,7 @@ For production use, ensure you:
616620
```bash
617621
# Use production environment
618622
NODE_ENV=production
619-
623+
620624
# Configure resource limits
621625
# Set up monitoring and logging
622626
# Configure backup strategies
@@ -628,7 +632,7 @@ For production use, ensure you:
628632
server {
629633
listen 80;
630634
server_name your-domain.com;
631-
635+
632636
location / {
633637
proxy_pass http://localhost:5173;
634638
proxy_set_header Host $host;
@@ -657,7 +661,7 @@ pytest tests/ # Run tests
657661
black app/ # Format code
658662
flake8 app/ # Lint code
659663

660-
# Frontend development
664+
# Frontend development
661665
cd frontend/
662666
npm install
663667
npm run dev # Development server
@@ -835,4 +839,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
835839

836840
**Built with ❤️ using AI assistance and modern open-source technologies.**
837841

838-
*OpenTranscribe demonstrates the power of AI-assisted development while maintaining full local control over your data and processing.*
842+
*OpenTranscribe demonstrates the power of AI-assisted development while maintaining full local control over your data and processing.*

backend/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ numpy>=1.25.2
2727

2828
# PyTorch with CUDA 12.8 support (CVE-2025-32434 fixed in 2.6.0+)
2929
--extra-index-url https://download.pytorch.org/whl/cu128
30-
torch==2.8.0+cu128
31-
torchaudio==2.8.0+cu128
30+
torch==2.8.0
31+
torchaudio==2.8.0
3232

3333
# WhisperX latest version with ctranslate2 4.5+ support
3434
whisperx==3.7.0

docker-compose.offline.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version: '3.8'
66

77
services:
88
postgres:
9-
image: postgres:14-alpine
9+
image: postgres:17.5-alpine
1010
restart: always
1111
volumes:
1212
- postgres_data:/var/lib/postgresql/data/
@@ -24,7 +24,7 @@ services:
2424
retries: 5
2525

2626
minio:
27-
image: minio/minio:latest
27+
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
2828
restart: always
2929
volumes:
3030
- minio_data:/data
@@ -42,7 +42,7 @@ services:
4242
retries: 5
4343

4444
redis:
45-
image: redis:7-alpine
45+
image: redis:8.2.2-alpine3.22
4646
restart: always
4747
ports:
4848
- "${REDIS_PORT:-6379}:6379"
@@ -133,9 +133,14 @@ services:
133133
- MAX_SPEAKERS=${MAX_SPEAKERS:-10}
134134
# LLM Configuration - external providers only for offline deployment
135135
- LLM_PROVIDER=${LLM_PROVIDER:-}
136+
- VLLM_BASE_URL=${VLLM_BASE_URL:-http://localhost:8012/v1}
137+
- VLLM_API_KEY=${VLLM_API_KEY:-}
138+
- VLLM_MODEL_NAME=${VLLM_MODEL_NAME:-gpt-oss-20b}
136139
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
137140
- OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME:-gpt-4o-mini}
138141
- OPENAI_BASE_URL=${OPENAI_BASE_URL:-}
142+
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://localhost:11434}
143+
- OLLAMA_MODEL_NAME=${OLLAMA_MODEL_NAME:-llama2:7b-chat}
139144
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
140145
- ANTHROPIC_MODEL_NAME=${ANTHROPIC_MODEL_NAME:-claude-3-haiku-20240307}
141146
- ANTHROPIC_BASE_URL=${ANTHROPIC_BASE_URL:-}
@@ -193,9 +198,14 @@ services:
193198
- MAX_SPEAKERS=${MAX_SPEAKERS:-10}
194199
# LLM Configuration
195200
- LLM_PROVIDER=${LLM_PROVIDER:-}
201+
- VLLM_BASE_URL=${VLLM_BASE_URL:-http://localhost:8012/v1}
202+
- VLLM_API_KEY=${VLLM_API_KEY:-}
203+
- VLLM_MODEL_NAME=${VLLM_MODEL_NAME:-gpt-oss-20b}
196204
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
197205
- OPENAI_MODEL_NAME=${OPENAI_MODEL_NAME:-gpt-4o-mini}
198206
- OPENAI_BASE_URL=${OPENAI_BASE_URL:-}
207+
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL:-http://localhost:11434}
208+
- OLLAMA_MODEL_NAME=${OLLAMA_MODEL_NAME:-llama2:7b-chat}
199209
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
200210
- ANTHROPIC_MODEL_NAME=${ANTHROPIC_MODEL_NAME:-claude-3-haiku-20240307}
201211
- ANTHROPIC_BASE_URL=${ANTHROPIC_BASE_URL:-}

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.8'
22

33
services:
44
postgres:
5-
image: postgres:14-alpine
5+
image: postgres:17.5-alpine
66
restart: always
77
volumes:
88
- postgres_data:/var/lib/postgresql/data/
@@ -19,7 +19,7 @@ services:
1919
retries: 5
2020

2121
minio:
22-
image: minio/minio
22+
image: minio/minio:RELEASE.2025-09-07T16-13-09Z
2323
restart: always
2424
volumes:
2525
- minio_data:/data
@@ -37,7 +37,7 @@ services:
3737
retries: 5
3838

3939
redis:
40-
image: redis:7-alpine
40+
image: redis:8.2.2-alpine3.22
4141
restart: always
4242
ports:
4343
- "5177:6379"
@@ -241,7 +241,7 @@ services:
241241
dockerfile: Dockerfile.prod
242242
restart: unless-stopped
243243
ports:
244-
- "5173:80"
244+
- "5173:8080"
245245
environment:
246246
- NODE_ENV=production
247247
depends_on:

frontend/Dockerfile.prod

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,32 @@ RUN chmod -R 755 static/fonts
2929
RUN npm run build
3030

3131
# Production stage
32-
FROM nginx:alpine
32+
FROM nginx:1.29.2-alpine3.22
3333

3434
# Copy the built files from the build stage
3535
COPY --from=build /app/dist /usr/share/nginx/html
3636

3737
# Copy the nginx configuration
3838
COPY nginx.conf /etc/nginx/conf.d/default.conf
3939

40-
# Expose port 80
41-
EXPOSE 80
40+
# Create non-root user and configure permissions for nginx
41+
# Note: nginx user already exists in base image, just configure permissions
42+
RUN chown -R nginx:nginx /usr/share/nginx/html && \
43+
chown -R nginx:nginx /var/cache/nginx && \
44+
mkdir -p /var/log/nginx && \
45+
chown -R nginx:nginx /var/log/nginx && \
46+
touch /var/run/nginx.pid && \
47+
chown nginx:nginx /var/run/nginx.pid
48+
49+
# Switch to non-root user
50+
USER nginx
51+
52+
# Expose port 8080 (non-privileged port for non-root user)
53+
EXPOSE 8080
54+
55+
# Add healthcheck
56+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
57+
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/ || exit 1
4258

4359
# Start nginx
4460
CMD ["nginx", "-g", "daemon off;"]

frontend/nginx.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
server {
2-
listen 80;
2+
listen 8080;
33
server_name localhost;
44
root /usr/share/nginx/html;
55
index index.html;
66

77
# Set maximum file upload size to 15GB for large video/audio files
88
client_max_body_size 15G;
9-
9+
1010
# Increase timeouts for large file uploads
1111
client_body_timeout 300s;
1212
client_header_timeout 300s;
@@ -43,7 +43,7 @@ server {
4343
proxy_set_header Connection 'upgrade';
4444
proxy_set_header Host $host;
4545
proxy_cache_bypass $http_upgrade;
46-
46+
4747
# Large file upload support
4848
proxy_request_buffering off;
4949
proxy_max_temp_file_size 0;

0 commit comments

Comments
 (0)