fix: bind mounts from DOCKER_PATH + real storage reads from disk

docker-compose.yml:
- Switch from named volumes back to bind mounts driven by DOCKER_PATH in .env
- DOCKER_PATH/config → /config, DOCKER_PATH/data → /data
- Works with both Windows paths (C:\...) and Linux paths (/opt/...)

server.go:
- Wire in storage.Store so documents query reads real .adoc files from disk
- handleDocuments: calls store.List("") and store.Read(slug) for actual content
- extractTitle: parses first "= Title" line from AsciiDoc, falls back to slug
- handleSetup: also initialises store after writing config so docs appear immediately
- Single document query (document(slug:...)) reads and returns full content

.env.example:
- Clarify DOCKER_PATH usage with Windows and Linux examples
- Show resulting directory layout on host

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-10 14:45:08 +02:00
parent 65aefb47ed
commit 4ba3b7dd49
3 changed files with 149 additions and 45 deletions

View File

@@ -7,29 +7,23 @@ services:
container_name: archivum
restart: unless-stopped
ports:
- "8080:4000"
- "${HOST_PORT:-8080}:4000"
environment:
# Points to the config directory inside the container.
DOCKER_PATH: /config
UI_DIR: /srv/archivum/ui
# Set to match the owner of the host directories (run `id` to check).
PUID: ${PUID:-1000}
PGID: ${PGID:-1000}
TZ: ${TZ:-Europe/Stockholm}
volumes:
# Configuration (config.json written here by Setup Wizard).
- archivum-config:/config
# All data: wiki files live in /data/wiki, SQLite db in /data/db.
# Using named volumes for local dev avoids Windows/WSL2 permission issues.
- archivum-data:/data
# Named volumes let Docker manage ownership automatically.
# Replace with bind mounts if you need direct host access:
# - ./local/config:/config
# - ./local/data:/data
# (and make sure the host directories are owned by PUID:PGID)
volumes:
archivum-config:
archivum-data:
# DOCKER_PATH in .env is the base directory on the HOST.
# Example .env:
# DOCKER_PATH=C:\Repo\AW\Archivum\docker
# Results in:
# C:\Repo\AW\Archivum\docker\config → /config (config.json lives here)
# C:\Repo\AW\Archivum\docker\data → /data (wiki/ and db/ live here)
#
# If DOCKER_PATH is not set, falls back to ./local relative to this file.
- ${DOCKER_PATH:-./local}/config:/config
- ${DOCKER_PATH:-./local}/data:/data