solidnerd/docker-bookstack

Problem accessing uploaded attachments

Closed this issue · 8 comments

Hi there,
I'm trying to get this running in a container with a mounted volume.
But I have issues with file attachements.

I can upload images into my pages just fine.
Deleting works also.

Same for file attachements.
Uploading and deleting works.
The files also get stored in the correct directory on disk.
But I cannot access them from the file link in the top left.

The browser then says:

Die Website ist nicht erreichbar
Die Webseite unter http://localhost:8080/attachments/4 ist eventuell vorübergehend nicht verfügbar oder wurde dauerhaft an eine neue Webadresse verschoben.
ERR_INVALID_RESPONSE

Here's what I do:
view page
edit
upload file
save
click link in the top left

[11/Aug/2023:08:07:20 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9397 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:23 +0000] "GET /books/systeme/page/fotos/edit HTTP/1.1" 200 13571 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:23 +0000] "GET /ajax/search/entities?types=book%2Cchapter%2Cpage&permission=view HTTP/1.1" 200 2713 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:37 +0000] "POST /attachments/upload?uploaded_to=4 HTTP/1.1" 200 1710 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:37 +0000] "GET /attachments/get/page/4 HTTP/1.1" 200 2642 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:40 +0000] "POST /books/systeme/page/fotos HTTP/1.1" 302 2020 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:40 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9633 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:43 +0000] "GET /attachments/4 HTTP/1.1" 500 15454 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:44 +0000] "GET /attachments/4 HTTP/1.1" 500 15454 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

[11/Aug/2023:08:07:45 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9591 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"

This is what the directories look like:

www-data@174072b1a32c:~/bookstack$ ls -lahR public/uploads/ storage/uploads/
public/uploads/:
total 12K
drwxrwxr-x 3 www-data www-data 4.0K Aug 11 07:54 .
drwxrwxr-x 5 www-data www-data 4.0K Apr 29 2022 ..
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 07:54 images

public/uploads/images:
total 12K
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 07:54 .
drwxrwxr-x 3 www-data www-data 4.0K Aug 11 07:54 ..
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 07:54 gallery

public/uploads/images/gallery:
total 12K
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 07:54 .
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 07:54 ..
drwxr-xr-x 4 www-data www-data 4.0K Aug 11 07:54 2023-08

public/uploads/images/gallery/2023-08:
total 3.9M
drwxr-xr-x 4 www-data www-data 4.0K Aug 11 07:54 .
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 07:54 ..
-rw-r--r-- 1 www-data www-data 3.9M Aug 11 07:54 img-20230807-171459.jpg
drwxr-xr-x 2 www-data www-data 4.0K Aug 11 07:54 scaled-1680-
drwxr-xr-x 2 www-data www-data 4.0K Aug 11 07:54 thumbs-150-150

public/uploads/images/gallery/2023-08/scaled-1680-:
total 304K
drwxr-xr-x 2 www-data www-data 4.0K Aug 11 07:54 .
drwxr-xr-x 4 www-data www-data 4.0K Aug 11 07:54 ..
-rw-r--r-- 1 www-data www-data 293K Aug 11 07:54 img-20230807-171459.jpg

public/uploads/images/gallery/2023-08/thumbs-150-150:
total 20K
drwxr-xr-x 2 www-data www-data 4.0K Aug 11 07:54 .
drwxr-xr-x 4 www-data www-data 4.0K Aug 11 07:54 ..
-rw-r--r-- 1 www-data www-data 9.0K Aug 11 07:54 img-20230807-171459.jpg

storage/uploads/:
total 16K
drwxrwxr-x 3 www-data www-data 4.0K Aug 11 07:47 .
drwxrwxr-x 1 www-data www-data 4.0K Apr 29 2022 ..
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 08:07 files

storage/uploads/files:
total 12K
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 08:07 .
drwxrwxr-x 3 www-data www-data 4.0K Aug 11 07:47 ..
drwxr-xr-x 2 www-data www-data 4.0K Aug 11 08:07 2023-08-Aug

storage/uploads/files/2023-08-Aug:
total 12K
drwxr-xr-x 2 www-data www-data 4.0K Aug 11 08:07 .
drwxr-xr-x 3 www-data www-data 4.0K Aug 11 08:07 ..
-rw-r--r-- 1 www-data www-data 1.2K Aug 11 08:07 noZUExEEweCIuui3-txt

I'm guessing this is an mod_rewrite issue, as the files are there and accessigble by www-data

I don't see a matching rewrite cond in the public/.htaccess file

Images work, as they are linked like

http://localhost:8080/uploads/images/gallery/2023-08/scaled-1680-/img-20230807-171459.jpg

The .env file says

STORAGE_TYPE=local
STORAGE_IMAGE_TYPE=local

The container has no storage type set

HJF9w commented

What is the output of docker logs docker-bookstack_bookstack_1 ?

the docker log says nothing special.
just the apache output from above

wait-for-db: waiting for bookstack_db:3306
Generating Key...
wait-for-db: done
base64:VZDRZIKS7HbO4KNofTJqfcw64Q//DYTLNtTek1F8pPs=
Starting Migration...
Nothing to migrate.
Clearing caches...
Application cache cleared!
Compiled views cleared!
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
[Fri Aug 11 08:00:57.389336 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/8.1.5 configured -- resuming normal operations
[Fri Aug 11 08:00:57.389368 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:01:10 +0000] "GET /attachments/2 HTTP/1.1" 500 15479 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:01:13 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9616 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:01:15 +0000] "GET /books/systeme/page/fotos/edit HTTP/1.1" 200 14142 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:01:15 +0000] "GET /ajax/search/entities?types=book%2Cchapter%2Cpage&permission=view HTTP/1.1" 200 2714 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:01:15 +0000] "GET /uploads/images/gallery/2023-08/scaled-1680-/img-20230807-171459.jpg HTTP/1.1" 304 182 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:01:20 +0000] "DELETE /attachments/2 HTTP/1.1" 200 1554 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:02:48 +0000] "POST /attachments/upload?uploaded_to=4 HTTP/1.1" 200 1735 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:02:49 +0000] "GET /attachments/get/page/4 HTTP/1.1" 200 2665 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:02:50 +0000] "POST /books/systeme/page/fotos HTTP/1.1" 302 2020 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:02:50 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9651 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:02:50 +0000] "GET /uploads/images/gallery/2023-08/scaled-1680-/img-20230807-171459.jpg HTTP/1.1" 304 182 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:02:52 +0000] "GET /attachments/3 HTTP/1.1" 500 15479 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:03:06 +0000] "GET /attachments/3 HTTP/1.1" 500 15479 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:03:09 +0000] "GET /attachments/3 HTTP/1.1" 500 15479 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:03:14 +0000] "GET /attachments/3 HTTP/1.1" 500 15479 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:10 +0000] "GET /books/systeme/page/fotos/edit HTTP/1.1" 200 14137 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:10 +0000] "GET /ajax/search/entities?types=book%2Cchapter%2Cpage&permission=view HTTP/1.1" 200 2714 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:10 +0000] "GET /uploads/images/gallery/2023-08/scaled-1680-/img-20230807-171459.jpg HTTP/1.1" 304 182 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:14 +0000] "DELETE /attachments/3 HTTP/1.1" 200 1554 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:15 +0000] "POST /books/systeme/page/fotos HTTP/1.1" 302 2020 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:15 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9437 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:20 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9397 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:23 +0000] "GET /books/systeme/page/fotos/edit HTTP/1.1" 200 13571 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:23 +0000] "GET /ajax/search/entities?types=book%2Cchapter%2Cpage&permission=view HTTP/1.1" 200 2713 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:37 +0000] "POST /attachments/upload?uploaded_to=4 HTTP/1.1" 200 1710 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:37 +0000] "GET /attachments/get/page/4 HTTP/1.1" 200 2642 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:40 +0000] "POST /books/systeme/page/fotos HTTP/1.1" 302 2020 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:40 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9633 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:43 +0000] "GET /attachments/4 HTTP/1.1" 500 15454 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:44 +0000] "GET /attachments/4 HTTP/1.1" 500 15454 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:07:45 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9591 "http://localhost:8080/books/systeme/page/fotos/edit" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:17:56 +0000] "GET /attachments/4 HTTP/1.1" 500 15454 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:17:57 +0000] "GET /attachments/4 HTTP/1.1" 500 15454 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:20:26 +0000] "GET /books/systeme/page/fotos HTTP/1.1" 200 9596 "http://localhost:8080/books/systeme" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
bookstack:80 172.18.0.1 - - [11/Aug/2023:08:20:26 +0000] "GET /uploads/images/gallery/2023-08/scaled-1680-/img-20230807-171459.jpg HTTP/1.1" 304 182 "http://localhost:8080/books/systeme/page/fotos" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
[Fri Aug 11 08:42:24.484165 2023] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully

btw i created th econtainer with

docker run -d --net bookstack_nw \
-e DB_HOST=bookstack_db:3306 \
-e DB_DATABASE=bookstack \
-e DB_USERNAME=bookstack \
-e DB_PASSWORD=secret \
-e APP_URL=http://localhost:8080 \
-p 8080:8080 \
--mount type=bind,source=/srv/docker/bookstack/.env,target=/var/www/bookstack/.env \
-v /srv/docker/bookstack/public/uploads:/var/www/bookstack/public/uploads \
-v /srv/docker/bookstack/storage/uploads:/var/www/bookstack/storage/uploads \
--name="bookstack_22.04" \
 solidnerd/bookstack:22.04

But even when I omit the mounts and just use the standard this doesn'T work

docker run -d --net bookstack_nw \
-e DB_HOST=bookstack_db:3306 \
-e DB_DATABASE=bookstack \
-e DB_USERNAME=bookstack \
-e DB_PASSWORD=secret \
-e APP_URL=http://localhost:8080 \
-p 8080:8080 \
--name="bookstack_22.04" \
 solidnerd/bookstack:22.04
HJF9w commented

Mounting the .env file in to the container is not supported anymore, as the in container .env was removed completely.
But I guess with bookstack 22.04 this was still supported?

I would recommend to update to the current version (23.6.2)

ah damn,
i should have used the latest tag and not just blindly copy the command from the readme. thanks, i will try again :)

stale commented

This issue has been automatically marked as stale because it has not had any activity for the last 30 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.