11notes / docker-ics-view

Run open-web-calendar (web view for ics) based on Alpine Linux. Small, lightweight, secure and fast 🏔️
MIT License
9 stars 2 forks source link

Problem pulling config file. #2

Closed seraphx2 closed 1 year ago

seraphx2 commented 1 year ago

I am getting a 404 when this line is executing: get_text_from_url('http://localhost:8080/etc/schedule.json')

I have a location mounted as such image

So of course, I am putting my schedule.json in the ical folder of my storage pool.

If I don't try to specify a /?calendar value, the calendar loads fine with the default stuff, so it's definitely been deployed and is accessible. However as soon as I do /?calendar=schedule I am getting these two errors in the logs when accessing the calendar page. "GET /etc/schedule.json HTTP/1.1" 404 - "GET /?calendar=schedule HTTP/1.1" 500 -

On the error page I see I am getting this specific error:

ValueError
ValueError: dictionary update sequence element #0 has length 1; 2 is required

And when I use the browser-based debugging feature, I get a 404 page response, the text of get_text_from_url('http://localhost:8080/etc/schedule.json') being the html of a 404 page.

Obviously the 500 error is because it's trying to JSON parse the text of the 404 html content. So the real problem just being that for some reason it's not finding the schedule.json file, as if I'm mapped wrong? But that doesn't make sense because so far, I've not had problems with mounting locations on other images I've run.

I am using ix-charts in TrueNAS Scale to run this image, but I can access things just fine as long as I don't specify a calendar querystring parameter, and usually the mounting on other things I've run as pure docker images map just fine, so I'm not sure where the disconnect here is and why the calendar "app" can't find that schedule.json file.

Hoping you have some ideas to try.

11notes commented 1 year ago

Make sure that all folders and files mapped into the container via -v have UID and GID 1000. You can login to the container directly via: docker run --rm -ti 11notes/ics-view /bin/ash. check the permissions of the files/folders in /ics/etc

FYI: Thanks to your request I bumped the version to 1.4 and changed some stuff (like volume is now /ics/etc).

seraphx2 commented 1 year ago

So in TrueNAS Scale, that isn't a default user. So I created a user and group to match (I gave it rwx on all things at the moment just to try to get this working) and now I am getting this error:

yaml.scanner.ScannerError: mapping values are not allowed here
  in "<unicode string>", line 5, column 27:
        <title>PermissionError: [Errno 13] Permission denied:  ... 

Sorry, this is my first major foray into a Linux-based ecosystem, so there is still a lot I don't know. If this isn't the place to troubleshoot this, I will move along. I just was hoping you'd have a better idea of the meaning of the errors. I do have friends who work in this space but I wouldn't expect them to know what's going on with this docker image as much.

11notes commented 1 year ago

When you created the user in TrueNAS give it UID and GID 1000. Then SSH into your NAS go to the folder you want to mount into the container (the one containing the schedule.json) and chown it with 1000:1000 chown -R 1000:1000 /your/folder/etc.

seraphx2 commented 1 year ago

Awesome! Got it all working with that last bit. I didn't have the owner setup properly for the dataset. Thanks!

seraphx2 commented 1 year ago

So I just deployed the application and now am having an issue reading the config file again with similar errors as above. Previously I think the resolution was two things: setting -u 1000:1000 and running the chown command. I've done chown but I am getting an error when deploying the container saying this in the logs: /usr/local/bin/entrypoint.sh: exec: line 14: illegal option -u

previously, that was a totally valid command line argument that I was passing in. any ideas if something has changed?

11notes commented 1 year ago

The container UID/GID is by default 1000:1000, you do not have to use -u 1000:1000. You need to chown your directory for /ics/etc with 1000:1000

chown -R 1000:1000 /path/to/your/folder

and then simply start the container with

docker run --rm -ti -p 5000:5000 -v /path/to/your/folder:/ics/etc 11notes/ics-view:1.13

or for production

docker run --name ics-view -p 5000:5000 -v /path/to/your/folder:/ics/etc -d 11notes/ics-view:1.13
seraphx2 commented 1 year ago

but my default system account isn't 1000 it's like 568 or something like that. does that matter? and do i need to chown the etc folder, or the folder im using for a mount in my NAS storage?

11notes commented 1 year ago

that does not matter, the UID/GID in the container is 1000:1000, you can test it by running:

docker run --rm -ti 11notes/ics-view:1.13 id

which will output: uid=1000(docker) gid=1000(docker) groups=1000(docker)

seraphx2 commented 1 year ago

When you created the user in TrueNAS give it UID and GID 1000. Then SSH into your NAS go to the folder you want to mount into the container (the one containing the schedule.json) and chown it with 1000:1000 chown -R 1000:1000 /your/folder/etc.

The thing is, I already have permissions setup properly from the previous version. I, in theory, shouldn't have to change anything with my folders. However, the one thing that has changed is the error on providing the -u. it allowed me to do that before.

Remember, I already had this docker container running perfectly before the version numbers changed. This is the same exact config just now telling it to pull a different image tag. Now the one main behavior that is different is the -u not being allowed. I am not a docker guru or anything, so I am not sure if it's unrelated, but it is the one thing that is acting differently from the previous image I downloaded. Everything else is the same with my configuration.

11notes commented 1 year ago

It should work the same if you drop the -u