-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.dev.yaml
More file actions
99 lines (87 loc) · 2.79 KB
/
docker-compose.dev.yaml
File metadata and controls
99 lines (87 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
services:
pushkinlib:
build:
context: .
dockerfile: Dockerfile
image: pushkinlib:latest
container_name: pushkinlib
restart: unless-stopped
ports:
- "9090:9090"
environment:
- PORT=${PORT:-9090}
- BOOKS_DIR=/data/books
- INPX_PATH=/data/books/${INPX_FILE:-test_library.inpx}
- CACHE_DIR=/data/cache
- DATABASE_PATH=/data/cache/pushkinlib.db
- CATALOG_TITLE=${CATALOG_TITLE:-Pushkinlib}
- LOG_LEVEL=${LOG_LEVEL:-info}
- PAGE_SIZE=${PAGE_SIZE:-30}
- PUBLIC_BASE_URL=${PUBLIC_BASE_URL:-http://localhost:9090}
- GENRES_CSV_PATH=./web/static/genres.csv
- TTS_SERVER_URL=http://tts-server:8000
- TTS_API_KEY=${TTS_API_KEY:-sk-test-key-1}
- AUTH_ENABLED=${AUTH_ENABLED:-false}
- ADMIN_USER=${ADMIN_USER:-admin}
- ADMIN_PASS=${ADMIN_PASS:-admin123}
- SESSION_SECRET=${SESSION_SECRET:-dev-session-secret-change-in-production}
volumes:
# Mount books directory (LIBRARY_PATH from .env)
- ${LIBRARY_PATH:-./books}:/data/books:ro
# Mount cache directory for database
- cache_data:/data/cache
depends_on:
tts-server:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9090/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
tts-server:
image: ghcr.io/foxzi/tts-server:latest
container_name: tts-server
restart: unless-stopped
entrypoint:
- python
- -c
- |
import os, pathlib, textwrap
key = os.environ.get("TTS_API_KEY", "changeme")
cfg = textwrap.dedent(f"""\
preload_models: "v5_ru"
models_dir: /models
default_sample_rate: 48000
torch_threads: 4
max_concurrent: 2
default_response_format: opus
auth:
enabled: true
tokens:
- key: "{key}"
name: "pushkinlib"
requests_per_minute: 120
chars_per_hour: 500000
""")
conf = pathlib.Path("/etc/tts-server/config.yml")
conf.parent.mkdir(parents=True, exist_ok=True)
conf.write_text(cfg)
print(f"TTS config generated (auth key: {key[:8]}...)")
os.execvp("uvicorn", ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"])
volumes:
- tts_models:/models
environment:
- TTS_CONFIG_PATH=/etc/tts-server/config.yml
- TTS_API_KEY=${TTS_API_KEY:-sk-test-key-1}
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 15s
timeout: 10s
retries: 5
start_period: 60s
volumes:
cache_data:
driver: local
tts_models:
driver: local