Exercise images are not loaded and exercise not visible from mobile
Hello people.
Today I tried to set up wger but there is something strange: when i manually trigger the exercise sync and the image download for them I don't see any image in the media volume, even if the download doesn't report any error:
root@HomeServer:/mnt/user/appdata/wger# docker exec -it wger-web-1 python3 manage.py download-exercise-images
INFO 2024-11-05 14:32:43,835 apps AXES: BEGIN version 7.0.0, blocking by ip_address
System check identified some issues:
WARNINGS:
?: (wger.W002) exercises without translations
HINT: There are 2 exercises without translations, this will cause problems! You can output or delete them with "python manage.py exercises-health-check --help"
*** Processing images ***
Processing image ef0b00e2-3323-4e7f-88fe-d71ef34b3384
Image not found in local DB, creating now...
successfully saved
[...]
Processing image 0705bc22-fadd-4c19-9c94-649a0b1f927f
Image not found in local DB, creating now...
successfully saved
Processing image ac8cb974-282b-467e-83e0-1019defc58f2
Image not found in local DB, creating now...
successfully saved
Processing image 7fab9de5-57cb-4ffa-adbc-ffeac468b26a
Image not found in local DB, creating now...
successfully saved
Processing image 300a44ac-4368-48e2-8b18-beea32ab915d
Image not found in local DB, creating now...
successfully saved
this also cause the impossibility to see the exercise images from "Exercises" page. If this could be useful, this is my docker compose file: https://pastebin.com/Wpdw2vVP and this is the prod.env content: https://pastebin.com/R5dZ0tuN
another problem, maybe related to the one described above, is that the static volume is empty and the server log reports:
0 static files copied to '/home/wger/static', 11786 unmodified.
the full log could be found at: https://pastebin.com/3NeeAwzR
anyway continuing my tests I created a new workout and a workout schedule but when I connect from the app I cannot see it. In addition I saw that if I try to create a new workout from mobile app directly, the exercises are not found and the autocomplete doesn't work as it does in the web UI. This is the same as reported here: https://github.com/wger-project/docker/issues/105
What's wrong here? I don't see anything obvious here so please could you point me in the right direction?
I guess the following log message it's not a problem if it appear after a container restart, because I guess it copy files only the first time it start:
0 static files copied to '/home/wger/static', 11786 unmodified.
Indeed in my static volume I have files. The strange thing it that in the docker-compose the web service doesn't mount the media folder and I'm not sure it's correct. If it doesn't mount the media volume, where the downloaded images are stored instead?
I also did another test mapping the volumes to a local path but nothing changed, I still have the same issue with images. For reference this is the docker-compose I used, where I also added to the "web" service container the media volume (even if it has not caused any positive impact): https://pastebin.com/gnUPftnp
It doesn't looks like a permission problem anyway.
This is a screenshot of what I see when I analyze the images transferred
I had the same issue when I tired to use the supplied docker-compse.yml file. To get things working I tried a similar fix to you, namely adding the media mount to the web: service but instead of making them Bind mounts I kept the Volume mounts. I think your issue might be that you are mounting "media" for the web: service at "/wger/media", but web: needs it to be mounted at "/home/wger/media". Note however, that nginx: expects it to be mounted at "/wger/media" and it should be Read Only (But it will probably still work if it's RW).
web: volumes: - static:/home/wger/static - media:/home/wger/media
nginx: volumes: - ./config/nginx.conf:/etc/nginx/conf.d/default.conf - static:/wger/static:ro - media:/wger/media:ro
I hope this helps.
thanks so much for your suggestion @Coyote21 Unfortunately it looks likes there is something else which still doesn't make it works as expected. This is how my compose file looks now with your suggested changes: https://pastebin.com/fzHEcH4m
and this is what it looks like from a browser perspective:
any core developer who may reply to this issue?
I'm not a developer, in fact I'm generally pretty dumb when it comes to these things, but maybe this will help prompt a better idea from you, or others.
Looking at your screenshot, it looks like the images are being blocked because of browser security used to stop cross-origin resource disclosure. This generally happens when the URL does not match the domain hosting the image file. In your prod.env file what URLs have you set for the static files ("MEDIA_URL" and "STATIC_URL") and are these the URLs you're using to visit the website?
As I said I could be way off, this is just a guess based on seeing the IP address in the image GET URL and the "OpaqueResponseBlocking" notifications.
yes, it's different because I'm using the IP addreass instead of a FQDN, so in the prod.env I set http://localhost as website name. I will try configuring a name and see if it changes