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