ajnart / homarr

Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)
https://homarr.dev
MIT License
6.02k stars 275 forks source link

Local resources do not load until container is pulled down and bought up #213

Closed gxgani closed 1 year ago

gxgani commented 2 years ago

Environment

Docker

Version

0.7.0

Describe the problem

Mount the ./icons (host) volume onto container as /app/public/icons. Resources return 404 unless the container has been pulled down and loaded again (restarting container does not work)

Additional info

No response

Please tick the boxes

ajnart commented 2 years ago

So you're saying accessing a mounted icon doesn't work automatically ?

gxgani commented 2 years ago

So you're saying accessing a mounted icon doesn't work automatically ?

yes! It returns 404. Using the wiki's docker-compose template. I move an icon into host volume, I see the icon in the container as well but returns 404 unless I pull the container down and up again. (Tried chmod/chown the icon, did not work either)

ajnart commented 2 years ago

So you're saying accessing a mounted icon doesn't work automatically ?

yes! It returns 404. Using the wiki's docker-compose template. I move an icon into host volume, I see the icon in the container as well but returns 404 unless I pull the container down and up again. (Tried chmod/chown the icon, did not work either)

This is a weird scenario. I will do some testing

DebugDax commented 2 years ago

So you're saying accessing a mounted icon doesn't work automatically ?

yes! It returns 404. Using the wiki's docker-compose template. I move an icon into host volume, I see the icon in the container as well but returns 404 unless I pull the container down and up again. (Tried chmod/chown the icon, did not work either)

This is a weird scenario. I will do some testing

I experience the same thing and have done some testing as well.

Running just yarn locally, this is not an issue. Icons can be added to /icons/ then loaded into dashboard without restarting yarn.

Running through docker, it can't see the icons until container is restarted. While the container is running, if you remove an icon from /icons/, it will not show up on dashboard anymore, then re-add that same file, it will work again without restarting container. Renaming an existing file will make the file no longer work until container is restarted or it's named back to what it was when the container was started.

You can see by having Dev Console open in browser, when typing in filename it will 404 for the path even if the file exists.

I am using Docker for Windows and if I open a terminal into the container and pwd /app/public/icons/ it can see the new icons, it just won't load on dashboard.

Trodfoot commented 2 years ago

I am running Truenas Scale and having the same problem. Its a weird one. If I shutdown and restart the container, I will then be able to use the icon I can already see. To get past this I just uploaded my whole icon directory and restarted. Its overkill but it worked.

ajnart commented 2 years ago

This is indeed very annoying and it seems to be a NextJS limitation. I will put this link below describing what I believe could be a fix for this issue

walkxcode commented 2 years ago

Found a similiar solution here: https://stackoverflow.com/questions/60799704/images-not-loading-unless-i-rebuild-app-next-js

ajnart commented 2 years ago

Found a similiar solution here: https://stackoverflow.com/questions/60799704/images-not-loading-unless-i-rebuild-app-next-js

Yes but I don't know where to put this code 😅 And do we really need express for just one route? Might be able to just use NextJS rewrites with one API route

Make it so /icons/id goes to /api/getIcon/Id and make the getIcon/[is].ts return the right file if found ?

edit : That's what I wrote previously