NathanVaughn / webtrees-docker

Up-to-date Docker image for webtrees with all the bells and whistles.
https://hub.docker.com/r/nathanvaughn/webtrees
MIT License
59 stars 15 forks source link

Uploading media fails #83

Closed AlexKalopsia closed 1 year ago

AlexKalopsia commented 2 years ago

Hi there, I am running on a media upload issue that I have tried to discuss with the webtrees code owners (https://github.com/fisharebest/webtrees/issues/4159) but it seems like this could be an issue with the docker environment perhaps.

The problem

Whenever I try and upload a new media file, nothing really happens. I select the file, give it a title and media type, i click Save but nothing happens, the popup dialog just stays open.

The browser network tab shows that there is a POST request, but it shows 117 bytes for an image that is actually 554 Kb. The server returns 500. The docker log only shows:

webtrees:80 172.19.0.1 - - [10/Jan/2022:13:29:21 +0000] "GET /tree/family/create-media-object HTTP/1.1" 200 2569 "https://webtrees.mydomain.com/tree/family/add-fact/X331/OBJE" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0"
webtrees:80 127.0.0.1 - - [10/Jan/2022:13:29:23 +0000] "GET / HTTP/1.1" 302 669 "-" "curl/7.74.0"

Here are some more findings on uploading the original image as well as smaller versions:

554Kb - 1030x1600 - FAIL
404Kb - 824x1280 - FAIL
165Kb - 515x800 - FAIL
99Kb - 412x640 - SUCCESS

I initially thought it could be the super high resolution, but yeah, it turns out I need to make the image a lot smaller for it to succeed.

Notice that in the upload popup it says Maximum upload size: 51,200 KB, so that doesn't seem to be the issue.

I bashed into the docker container and did both php -i | grep -i "post_max_size" and php -i | grep -i "upload_max_filesize", and they both return 50MB. I also ran these commands from outside the containers, and they both return 32MB.

Details of my setup:

Webtrees: 2.0.19

nginx config:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name webtrees.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app xxx.xxx.xxx.xxx;
        set $upstream_port xxx;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

}

docker-compose:

  webtrees:
    image: ghcr.io/nathanvaughn/webtrees:latest
    container_name: webtrees
    depends_on:
      - mariadb
    ports:
      - 9180:80
      - 9143:443
    volumes:
      - ${DOCKER_PATH}/webtrees/data:/var/www/webtrees/data/
      - ${DOCKER_PATH}/webtrees/media:/var/www/webtrees/media/
      - ${DOCKER_PATH}/webtrees/themes:/var/www/webtrees/themes/
      - ${DOCKER_PATH}/webtrees/modules:/var/www/webtrees/modules_v4/
    environment:
      - PRETTY_URLS=1
      - LANG=en-US
      - BASE_URL=${WEBTREES_URL}
      - DB_TYPE=mysql
      - DB_HOST=${IP}
      - DB_PORT=3306
      - DB_USER=${WEBTREESDB_USER}
      - DB_PASS=${WEBTREESDB_PSW}
      - DB_NAME=${WEBTREESDB_DB}
      - DB_PREFIX=wt_
      - WT_USER=${WEBTREES_USER}
      - WT_NAME=MyName
      - WT_PASS=${WEBTREES_PSW}
      - WT_EMAIL=${LE_EMAIL}
    restart: unless-stopped
NathanVaughn commented 2 years ago

Thanks for the detailed information. Off the top of my head, I'm not sure what's going on. I booted up the basic Docker compose stack in the repo on my Windows 11 PC with Docker Desktop and couldn't replicate the issue. I was able to upload two 3MB+ .jpg files without issue. I also tried it on my deployed Webtrees instance I run for my family and that also worked fine.

The PHP post limit is set to 50MB as you've noted. The container uses an Apache web server but that shouldn't adding any additional limits. I'm not familiar with nginx but my guess is that there may be something there blocking it, or any other part of how you're accessing Webtrees such as Cloudflare.

NathanVaughn commented 1 year ago

I'm going to close this, since now you can configure the PHP upload limit to your liking