forked from rohit-purandare/ShelfBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
161 lines (141 loc) · 8.48 KB
/
docker-compose.yml
File metadata and controls
161 lines (141 loc) · 8.48 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
services:
shelfbridge:
image: ghcr.io/rohit-purandare/shelfbridge:latest
# Uncomment the line below and comment the image line above to build locally
# build: .
container_name: shelfbridge
# Restart policy: "no" prevents restart loops during configuration setup
# Container stays stopped when configuration is invalid, requiring manual restart
restart: 'no'
volumes:
# Named volumes for zero-setup - no local directories required
- shelfbridge-config:/app/config
- shelfbridge-data:/app/data
# ALTERNATIVE: Use local directories for easier config editing
# Uncomment the lines below and comment the named volumes above
# This creates local ./config and ./data directories you can easily access
# - ./config:/app/config
# - ./data:/app/data
# - ./logs:/app/logs # Optional: access logs locally
# Environment variables for configuration (recommended for Docker)
# Uncomment and customize the values below to use environment variable configuration
#
# 🚀 CONFIGURATION MODES:
# 1. Environment Variables (no config.yaml needed) - Perfect for Docker!
# 2. YAML Configuration (create config/config.yaml manually) - Advanced features
#
# 📋 PRIORITY ORDER (if both exist):
# 1. config.yaml values (highest) - if config.yaml exists
# 2. Environment variables (fallback) - fills missing config.yaml values
# 3. Built-in defaults (lowest)
#
# ⚠️ LIMITATIONS: Some advanced features require config.yaml:
# - Library filtering (include/exclude arrays)
# - Reread detection configuration (nested settings)
# - Per-user library filtering
#
# 💡 Recommendation: Use environment variables for most setups - no file editing needed!
environment:
# Default environment - prevents empty environment mapping error
NODE_ENV: 'production'
# Optional: specify the user and group id that the docker container should use
# PUID: 1000
# PGID: 1000
# =============================================================================
# REQUIRED USER CONFIGURATION (Must be set if not using config.yaml)
# =============================================================================
# User 0 configuration - PRIMARY USER (REQUIRED)
# SHELFBRIDGE_USER_0_ID: "your_username" # REQUIRED: User identifier
# SHELFBRIDGE_USER_0_ABS_URL: "https://your-abs-server.com" # REQUIRED: Audiobookshelf URL
# SHELFBRIDGE_USER_0_ABS_TOKEN: "your_audiobookshelf_token" # REQUIRED: ABS API token
# SHELFBRIDGE_USER_0_HARDCOVER_TOKEN: "your_hardcover_token" # REQUIRED: Hardcover API token
# Additional users for multi-user setups (OPTIONAL)
# SHELFBRIDGE_USER_1_ID: "second_user" # User identifier for second user
# SHELFBRIDGE_USER_1_ABS_URL: "https://your-abs-server.com" # Audiobookshelf URL for second user
# SHELFBRIDGE_USER_1_ABS_TOKEN: "second_user_abs_token" # ABS API token for second user
# SHELFBRIDGE_USER_1_HARDCOVER_TOKEN: "second_user_hardcover_token" # Hardcover API token for second user
# Add more users as needed (USER_2, USER_3, etc.)
# =============================================================================
# OPTIONAL GLOBAL CONFIGURATION (All have sensible defaults)
# =============================================================================
# Core sync settings
# SHELFBRIDGE_MIN_PROGRESS_THRESHOLD: "5.0" # Minimum progress % to sync (0-100, default: 5.0)
# SHELFBRIDGE_WORKERS: "3" # Number of parallel workers (1-10, default: 3)
# SHELFBRIDGE_PARALLEL: "true" # Enable parallel processing (true/false, default: true)
# SHELFBRIDGE_TIMEZONE: "UTC" # Timezone for scheduling (default: UTC)
# Safety and testing
# SHELFBRIDGE_DRY_RUN: "false" # Run without making changes (true/false, default: false)
# SHELFBRIDGE_FORCE_SYNC: "false" # Force sync even if unchanged (true/false, default: false)
# SHELFBRIDGE_MAX_BOOKS_TO_PROCESS: "" # Limit books processed per sync (optional, no default)
# Automation
# SHELFBRIDGE_SYNC_SCHEDULE: "0 3 * * *" # Cron schedule (default: daily at 3 AM)
# SHELFBRIDGE_AUTO_ADD_BOOKS: "false" # Auto-add books to Hardcover (true/false, default: false)
# Session-based delayed updates (reduces API calls)
# SHELFBRIDGE_DELAYED_UPDATES_ENABLED: "false" # Enable delayed updates (true/false, default: false)
# SHELFBRIDGE_DELAYED_UPDATES_SESSION_TIMEOUT: "900" # Session timeout in seconds (60-7200, default: 900 = 15 min)
# SHELFBRIDGE_DELAYED_UPDATES_MAX_DELAY: "3600" # Max delay before forcing sync (300-86400, default: 3600 = 1 hour)
# SHELFBRIDGE_DELAYED_UPDATES_IMMEDIATE_COMPLETION: "true" # Always sync book completion immediately (true/false, default: true)
# Progress protection
# SHELFBRIDGE_PREVENT_PROGRESS_REGRESSION: "true" # Prevent progress loss (true/false, default: true)
# Rate limiting and performance
# SHELFBRIDGE_HARDCOVER_SEMAPHORE: "1" # Max concurrent Hardcover requests (1-10, default: 1)
# SHELFBRIDGE_HARDCOVER_RATE_LIMIT: "55" # Hardcover requests per minute (10-60, default: 55)
# SHELFBRIDGE_AUDIOBOOKSHELF_SEMAPHORE: "5" # Max concurrent ABS requests (1-10, default: 5)
# SHELFBRIDGE_AUDIOBOOKSHELF_RATE_LIMIT: "600" # ABS requests per minute (60-1200, default: 600)
# Library fetching
# SHELFBRIDGE_MAX_BOOKS_TO_FETCH: "" # Max books to fetch from ABS (optional, no default)
# SHELFBRIDGE_PAGE_SIZE: "100" # Books per API request (25-200, default: 100)
# Debugging
# SHELFBRIDGE_DUMP_FAILED_BOOKS: "true" # Create error reports (true/false, default: true)
# =============================================================================
# EXAMPLE CONFIGURATIONS
# =============================================================================
# Basic Single User Setup - Uncomment and modify:
# SHELFBRIDGE_USER_0_ID: "alice"
# SHELFBRIDGE_USER_0_ABS_URL: "https://audiobookshelf.mydomain.com"
# SHELFBRIDGE_USER_0_ABS_TOKEN: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
# SHELFBRIDGE_USER_0_HARDCOVER_TOKEN: "hc_sk_1234567890abcdef..."
# Family Setup Example - Multiple users with custom settings:
# SHELFBRIDGE_MIN_PROGRESS_THRESHOLD: "3.0" # Lower threshold for family
# SHELFBRIDGE_AUTO_ADD_BOOKS: "true" # Auto-add books
# SHELFBRIDGE_SYNC_SCHEDULE: "0 */6 * * *" # Sync every 6 hours
# SHELFBRIDGE_TIMEZONE: "America/New_York" # Family timezone
#
# SHELFBRIDGE_USER_0_ID: "mom"
# SHELFBRIDGE_USER_0_ABS_URL: "https://family-audiobooks.com"
# SHELFBRIDGE_USER_0_ABS_TOKEN: "mom_abs_token"
# SHELFBRIDGE_USER_0_HARDCOVER_TOKEN: "mom_hardcover_token"
#
# SHELFBRIDGE_USER_1_ID: "dad"
# SHELFBRIDGE_USER_1_ABS_URL: "https://family-audiobooks.com"
# SHELFBRIDGE_USER_1_ABS_TOKEN: "dad_abs_token"
# SHELFBRIDGE_USER_1_HARDCOVER_TOKEN: "dad_hardcover_token"
# Reduced API Usage Example - Delayed updates for frequent readers:
# SHELFBRIDGE_DELAYED_UPDATES_ENABLED: "true" # Enable session-based delayed updates
# SHELFBRIDGE_DELAYED_UPDATES_SESSION_TIMEOUT: "1800" # 30 minutes timeout
# SHELFBRIDGE_DELAYED_UPDATES_MAX_DELAY: "7200" # 2 hours max delay
# SHELFBRIDGE_DELAYED_UPDATES_IMMEDIATE_COMPLETION: "true" # Still sync completions immediately
# SHELFBRIDGE_SYNC_SCHEDULE: "0 */1 * * *" # Check every hour (with delayed updates)
#
# Benefits: Reduces Hardcover API calls while maintaining accuracy
# Use case: Active readers who listen continuously for long sessions
command: ['npm', 'start']
healthcheck:
test: ['CMD', 'npm', 'run', 'test:native']
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
labels:
- 'com.docker.compose.project=shelfbridge'
- 'com.docker.compose.service=shelfbridge'
networks:
- shelfbridge-network
volumes:
shelfbridge-config:
driver: local
shelfbridge-data:
driver: local
networks:
shelfbridge-network:
driver: bridge