Update project configuration for Bookhoard organization rename
Phase 1 of Gitea repository migration: - Rename docker containers: bookmann_db → bookhoard_db, bookmann → bookhoard - Update database name: bookmann → bookhoard - Rename environment variables: BOOKMANN_* → BOOKHOARD_* - Update documentation references to new project name This prepares the codebase for migration to Bookhoard organization.
This commit is contained in:
+11
-11
@@ -21,14 +21,14 @@ Check media_item_formats table for existing KEPUB
|
||||
↓
|
||||
If KEPUB exists and is recent (< 24 hours):
|
||||
→ Serve pre-converted file
|
||||
→ Set X-Bookmann-KEPUB-SHA256 header
|
||||
→ Set X-Bookhoard-KEPUB-SHA256 header
|
||||
↓
|
||||
If KEPUB doesn't exist or is stale:
|
||||
→ Convert EPUB→KEPUB on-the-fly
|
||||
→ Calculate SHA-256 of converted KEPUB
|
||||
→ Store in media_item_formats (with converted_from_format_id)
|
||||
→ Serve converted file
|
||||
→ Set X-Bookmann-KEPUB-SHA256 header
|
||||
→ Set X-Bookhoard-KEPUB-SHA256 header
|
||||
↓
|
||||
Device downloads book with hash in response header
|
||||
↓
|
||||
@@ -43,9 +43,9 @@ Add these to your `.env` file or `system_config` table:
|
||||
|
||||
```bash
|
||||
# Conversion service configuration
|
||||
BOOKMANN_CONVERSION_CACHE_DIR=/var/bookmann/cache/kepub
|
||||
BOOKMANN_CONVERSION_TOOL=/usr/bin/kepubify # or /usr/bin/ebook-convert
|
||||
BOOKMANN_CONVERSION_CACHE_TTL=24h
|
||||
BOOKHOARD_CONVERSION_CACHE_DIR=/var/bookhoard/cache/kepub
|
||||
BOOKHOARD_CONVERSION_TOOL=/usr/bin/kepubify # or /usr/bin/ebook-convert
|
||||
BOOKHOARD_CONVERSION_CACHE_TTL=24h
|
||||
```
|
||||
|
||||
### Dockerfile Updates
|
||||
@@ -76,8 +76,8 @@ GET /opds/devices/{deviceId}/download/{bookId}?format=kepub
|
||||
**Response Headers:**
|
||||
- `Content-Type`: application/vnd.kobo+xml+zip
|
||||
- `Content-Disposition`: attachment; filename="book.kepub.epub"
|
||||
- `X-Bookmann-UUID`: uuid-123
|
||||
- `X-Bookmann-KEPUB-SHA256`: abc123... (KEPUB-specific hash)
|
||||
- `X-Bookhoard-UUID`: uuid-123
|
||||
- `X-Bookhoard-KEPUB-SHA256`: abc123... (KEPUB-specific hash)
|
||||
|
||||
## Database Schema
|
||||
|
||||
@@ -143,7 +143,7 @@ The service tries conversion tools in this order:
|
||||
### Cache Invalidation
|
||||
|
||||
Converted KEPUB files are cached for 24 hours by default. This TTL is configurable via:
|
||||
- Environment variable: `BOOKMANN_CONVERSION_CACHE_TTL`
|
||||
- Environment variable: `BOOKHOARD_CONVERSION_CACHE_TTL`
|
||||
- Code: `conversionCacheTTL` field in `ConversionService`
|
||||
|
||||
## Testing
|
||||
@@ -162,7 +162,7 @@ Use the provided Bruno test:
|
||||
This test verifies:
|
||||
- KEPUB hash header is present
|
||||
- Hash is 64 characters (SHA-256 format)
|
||||
- Bookmann UUID header is present
|
||||
- Bookhoard UUID header is present
|
||||
- Content-Type is correct for KEPUB
|
||||
|
||||
## Troubleshooting
|
||||
@@ -181,7 +181,7 @@ This test verifies:
|
||||
**Problem**: Converted files not being cached
|
||||
**Solution**:
|
||||
1. Verify cache directory exists and is writable
|
||||
2. Check `BOOKMANN_CONVERSION_CACHE_DIR` environment variable
|
||||
2. Check `BOOKHOARD_CONVERSION_CACHE_DIR` environment variable
|
||||
3. Ensure database can create media_item_formats records
|
||||
|
||||
### Hash Mismatches
|
||||
@@ -189,7 +189,7 @@ This test verifies:
|
||||
**Problem**: Progress sync fails after conversion
|
||||
**Solution**:
|
||||
1. Verify dual hash storage: both EPUB and KEPUB hashes should exist in `media_item_formats`
|
||||
2. Check `X-Bookmann-KEPUB-SHA256` header in response
|
||||
2. Check `X-Bookhoard-KEPUB-SHA256` header in response
|
||||
3. Ensure `converted_from_format_id` links KEPUB to source EPUB
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
@@ -23,7 +23,7 @@ Created a complete EPUB→KEPUB conversion service with:
|
||||
Updated the OPDS handler to integrate with conversion service:
|
||||
- Modified `NewOPDSHandler` to accept conversion service dependency
|
||||
- Enhanced `DownloadBook` method to support on-the-fly KEPUB conversion
|
||||
- Updated response headers to include `X-Bookmann-KEPUB-SHA256` for KEPUB downloads
|
||||
- Updated response headers to include `X-Bookhoard-KEPUB-SHA256` for KEPUB downloads
|
||||
- Properly handles format-specific hash headers
|
||||
|
||||
**Behavior**:
|
||||
@@ -62,7 +62,7 @@ Created comprehensive unit tests:
|
||||
|
||||
Created Bruno API test that validates:
|
||||
- KEPUB hash header presence and format
|
||||
- Bookmann UUID header
|
||||
- Bookhoard UUID header
|
||||
- Correct Content-Type for KEPUB format
|
||||
|
||||
### 5. Documentation ✅
|
||||
@@ -82,9 +82,9 @@ Comprehensive documentation covering:
|
||||
|
||||
**File**: `.env.example`
|
||||
Added conversion service configuration variables:
|
||||
- `BOOKMANN_CONVERSION_CACHE_DIR` - Cache directory path
|
||||
- `BOOKMANN_CONVERSION_TOOL` - Conversion tool to use
|
||||
- `BOOKMANN_CONVERSION_CACHE_TTL` - Cache time-to-live
|
||||
- `BOOKHOARD_CONVERSION_CACHE_DIR` - Cache directory path
|
||||
- `BOOKHOARD_CONVERSION_TOOL` - Conversion tool to use
|
||||
- `BOOKHOARD_CONVERSION_CACHE_TTL` - Cache time-to-live
|
||||
|
||||
**File**: `Dockerfile`
|
||||
Added kepubify installation in final stage:
|
||||
@@ -135,7 +135,7 @@ Check media_item_formats for existing KEPUB
|
||||
│
|
||||
└─ Serve cached file
|
||||
↓
|
||||
Set X-Bookmann-KEPUB-SHA256 header
|
||||
Set X-Bookhoard-KEPUB-SHA256 header
|
||||
↓
|
||||
Stream file to client
|
||||
```
|
||||
@@ -172,11 +172,11 @@ go build -o /tmp/bookmann-test ./cmd/server
|
||||
4. Request KEPUB download via OPDS:
|
||||
```bash
|
||||
curl "http://localhost:8765/opds/devices/{deviceId}/download/{bookId}?format=kepub" \
|
||||
-I | grep -i "X-Bookmann-KEPUB-SHA256"
|
||||
-I | grep -i "X-Bookhoard-KEPUB-SHA256"
|
||||
```
|
||||
5. Verify response headers:
|
||||
- `X-Bookmann-KEPUB-SHA256` present (64-character hash)
|
||||
- `X-Bookmann-UUID` present
|
||||
- `X-Bookhoard-KEPUB-SHA256` present (64-character hash)
|
||||
- `X-Bookhoard-UUID` present
|
||||
- `Content-Type: application/vnd.kobo+xml+zip`
|
||||
|
||||
### Automated Testing
|
||||
@@ -236,8 +236,8 @@ The conversion service is designed to support:
|
||||
|
||||
Before deploying to production:
|
||||
- [ ] Verify kepubify is installed in container
|
||||
- [ ] Set `BOOKMANN_CONVERSION_CACHE_DIR` to persistent volume
|
||||
- [ ] Configure `BOOKMANN_CONVERSION_CACHE_TTL` appropriately
|
||||
- [ ] Set `BOOKHOARD_CONVERSION_CACHE_DIR` to persistent volume
|
||||
- [ ] Configure `BOOKHOARD_CONVERSION_CACHE_TTL` appropriately
|
||||
- [ ] Test conversion with actual EPUB files
|
||||
- [ ] Monitor cache directory size and set up cleanup
|
||||
- [ ] Verify database has `media_item_formats` table
|
||||
@@ -248,7 +248,7 @@ Before deploying to production:
|
||||
## Rollback Plan
|
||||
|
||||
If issues arise:
|
||||
1. Set `BOOKMANN_CONVERSION_TOOL=""` to disable conversion
|
||||
1. Set `BOOKHOARD_CONVERSION_TOOL=""` to disable conversion
|
||||
2. Remove `conversionService` parameter from `NewOPDSHandler`
|
||||
3. OPDS handler will fall back to serving EPUB only
|
||||
4. No database schema changes required (schema already existed)
|
||||
|
||||
Reference in New Issue
Block a user