evan-buss / openbooks

Search and Download eBooks
https://evan-buss.github.io/openbooks/
MIT License
1.87k stars 59 forks source link

Don't `mkdir books` #60

Closed typkrft closed 2 years ago

typkrft commented 2 years ago

Is it possible not to run mkdir books? I could be completely off base, but generally when I mount a volume to a path I'm expecting the data to be in that path. Making another books directory in /books seems redundant. This is not a huge deal though, just a thought.

My Compose:

version: "3.9"

volumes:
  books:
    driver_opts:
      type: "nfs"
      o: "addr=${NAS_IP},nolock,soft,rw"
      device: ":${NAS_MEDIA_PATH}/Literature/Books"

services:
  openbooks:
    container_name: openBooks
    image: evanbuss/openbooks:latest
    environment:
      - BASE_PATH=/openbooks/
    volumes:
      - 'books:/books'
    ports:
      - '17012:80'
    restart: unless-stopped
    command: --persist
TaylorWorthing commented 2 years ago

The BASE_PATH is a general cache that holds more than just cached book downloads. For example, if you enable IRC logs with --log, a ${BASE_PATH}/logs directory is created.

If you want to store just the download cache, you could mount the books subdirectory like: books:/openbooks/books.

evan-buss commented 2 years ago

So the BASE_PATH is just used if you want to host the server at a subpath. For example http://yourwebsite.com/base_path/. If you aren't doing that you can remove the BASE_PATH environment variable.

The app creates a directory structure like the following:

openbooks/
├─ books/
│  ├─ book1.epub
│  ├─ book2.epub
├─ logs
│  ├─ log1.txt

@BrowncoatShadow Is correct in that you can modify the mount point of your docker file if you don't care about exposing the logs folder/files. This config will show the book files at the top level.

services:
  openbooks:
    container_name: openBooks
    image: evanbuss/openbooks:latest
    environment:
      - BASE_PATH=/openbooks/
    volumes:
-      - 'books:/books'
+      - 'books:/books/books'
    ports:
      - '17012:80'
    restart: unless-stopped
    command: --persist

I agree that having two separate mount points (1 for books and 1 for logs) would be less confusing. I will keep it in mind.

typkrft commented 2 years ago

So the BASE_PATH is just used if you want to host the server at a subpath. For example http://yourwebsite.com/base_path/. If you aren't doing that you can remove the BASE_PATH environment variable.

The app creates a directory structure like the following:

openbooks/
├─ books/
│  ├─ book1.epub
│  ├─ book2.epub
├─ logs
│  ├─ log1.txt

@BrowncoatShadow Is correct in that you can modify the mount point of your docker file if you don't care about exposing the logs folder/files. This config will show the book files at the top level.

services:
  openbooks:
    container_name: openBooks
    image: evanbuss/openbooks:latest
    environment:
      - BASE_PATH=/openbooks/
    volumes:
-      - 'books:/books'
+      - 'books:/books/books'
    ports:
      - '17012:80'
    restart: unless-stopped
    command: --persist

I agree that having two separate mount points (1 for books and 1 for logs) would be less confusing. I will keep it in mind.

I should have tried this first, sorry. I assumed incorrectly that it would throw an error or something weird because the path was already created. That'll work. Thanks!

TaylorWorthing commented 2 years ago

Whoops. I always forget that the environment variable is separate from the the --dir flag. @evan-buss, are you considering that in the future the log and book cache directories might be separate flags instead of a common directory flag?

brettinternet commented 1 year ago

I would love to see a separate mountpoint for logs and books. Configuring the volume as books:/books/books is unintuitive and the help description of --dir is sort of confusing since eBooks are actually saved in a subdirectory within the --dir folder instead of the folder itself.