Fix: Directory config and init process (#396)

This commit is contained in:
Alex
2026-01-05 17:56:00 +00:00
committed by GitHub
parent abf7f24178
commit 06778184af
6 changed files with 11 additions and 16 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ COPY --from=frontend-builder /frontend/dist /app/frontend-dist
# Final setup: permissions and directories in one layer
# Only creating directories and setting executable bits.
# Ownership will be handled by the entrypoint script.
RUN mkdir -p /var/log/cwa-book-downloader /cwa-book-ingest && \
RUN mkdir -p /var/log/cwa-book-downloader /books && \
chmod +x /app/entrypoint.sh /app/tor.sh /app/genDebug.sh
# Expose the application port
+2 -7
View File
@@ -27,14 +27,8 @@ logger.debug(f"BASE_DIR: {BASE_DIR}")
if env.ENABLE_LOGGING:
env.LOG_DIR.mkdir(exist_ok=True)
# Create necessary directories
# Create staging directory (destination is created by orchestrator using config value)
env.TMP_DIR.mkdir(exist_ok=True)
env.INGEST_DIR.mkdir(exist_ok=True)
CROSS_FILE_SYSTEM = os.stat(env.TMP_DIR).st_dev != os.stat(env.INGEST_DIR).st_dev
logger.debug(f"STAT TMP_DIR: {os.stat(env.TMP_DIR)}")
logger.debug(f"STAT INGEST_DIR: {os.stat(env.INGEST_DIR)}")
logger.debug(f"CROSS_FILE_SYSTEM: {CROSS_FILE_SYSTEM}")
# DNS placeholders - actual values set by network.init() from config/ENV
CUSTOM_DNS: list[str] = []
@@ -453,6 +447,7 @@ def download_settings():
description="Directory where downloaded files are saved.",
default="/books",
required=True,
env_var="INGEST_DIR", # Legacy env var name for backwards compatibility
),
SelectField(
key="FILE_ORGANIZATION",
+1 -1
View File
@@ -127,7 +127,7 @@ change_ownership /tmp/cwa-book-downloader
# Test write to all folders
make_writable ${CONFIG_DIR:-/config}
make_writable /cwa-book-ingest
make_writable ${INGEST_DIR:-/books}
# Always run Gunicorn (even when DEBUG=true) to ensure Socket.IO WebSocket
# upgrades work reliably on customer machines.
+2 -2
View File
@@ -100,8 +100,8 @@ echo "=== Permissions ===" > "$LOG_DIR/permissions.txt"
echo "ls -all /app" >> "$LOG_DIR/permissions.txt"
ls -all /app >> "$LOG_DIR/permissions.txt" 2>&1
echo "" >> "$LOG_DIR/permissions.txt"
echo "ls -all /cwa-book-ingest" >> "$LOG_DIR/permissions.txt"
ls -all /cwa-book-ingest >> "$LOG_DIR/permissions.txt" 2>&1
echo "ls -all ${INGEST_DIR:-/books}" >> "$LOG_DIR/permissions.txt"
ls -all ${INGEST_DIR:-/books} >> "$LOG_DIR/permissions.txt" 2>&1
echo "" >> "$LOG_DIR/permissions.txt"
echo "ls -all /var/log/cwa-book-downloader" >> "$LOG_DIR/permissions.txt"
ls -all /var/log/cwa-book-downloader >> "$LOG_DIR/permissions.txt" 2>&1
+2 -2
View File
@@ -60,7 +60,7 @@ That's it! Configure settings through the web interface as needed.
```yaml
volumes:
- /your/config/path:/config # Config, database, and artwork cache directory
- /your/download/path:/cwa-book-ingest # Downloaded books
- /your/download/path:/books # Downloaded books
```
> **Tip**: Point the download volume to your CWA or Booklore ingest folder for automatic import.
@@ -90,7 +90,7 @@ Environment variables work for initial setup and Docker deployments. They serve
| Variable | Description | Default |
|----------|-------------|---------|
| `FLASK_PORT` | Web interface port | `8084` |
| `INGEST_DIR` | Book download directory | `/cwa-book-ingest` |
| `INGEST_DIR` | Book download directory | `/books` |
| `TZ` | Container timezone | `UTC` |
| `PUID` / `PGID` | Runtime user/group ID (also supports legacy `UID`/`GID`) | `1000` / `1000` |
| `SEARCH_MODE` | `direct` or `universal` | `direct` |
+3 -3
View File
@@ -415,9 +415,9 @@ class TestCrossFilesystem:
assert os.stat(tmp_dir).st_dev == os.stat(ingest_dir).st_dev
def test_detect_cross_filesystem(self):
"""CROSS_FILE_SYSTEM detection should work."""
# This is a documentation test - the actual logic is in settings.py:
# CROSS_FILE_SYSTEM = os.stat(env.TMP_DIR).st_dev != os.stat(env.INGEST_DIR).st_dev
"""Cross-filesystem detection uses same_filesystem() at runtime."""
# Detection is done lazily by same_filesystem() in core/naming.py
# when hardlinking is attempted, not at startup
pass