Open michaelalang opened 1 month ago
meanwhile I identified the culrpit, the pod requires to run with privileges so the moment one add's an privileged SCC to the ServiceAccount the deployment starts working as expected.
I was able to identify that by reading the Database oban_jobs
table.error column which is pointing towards the source
{"{\"at\": \"2024-10-09T10:46:28.340170Z\", \"error\": \"** (MatchError) no match of right hand side value: {:error, :enoent}\\n (asciinema 1.0.0) lib/asciinema/recordings.ex:300: Asciinema.Recordings.save_file/2\\n
...
so I verified if the default file storage space needs to be available but that is also not the case, which means (most likely) temporary upload to S3 space not accessible, so I added the privileged SCC.
It would be really nice to get asciinema-server running without the need to escalate privileges.
This error comes from Asciinema.Recordings.save_file
which is trying to save the file in the recordings directory on the filesystem. This operation does 2 things: 1. creates a nested directory structure for the file (equivalent of mkdir -p
), 2. writes the file to that directory. It's hard to tell which of those two operations failed here, but either way, the filesystem must be writable and the container must be able to create new directories within the storage path (see https://docs.asciinema.org/manual/server/self-hosting/configuration/#local-filesystem). asciinema server doesn't require any special privileges here, so maybe the problem is on the k8s side?
@ku1ik thanks for your reply... from my POV it looks not to be an issue of the kubernetes deployment per-se as the container image itself expects to run as root
...
$ podman run -ti --rm --name asciinema --entrypoint /usr/bin/id ghcr.io/asciinema/asciinema-server:latest
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)
that might be coming from the need to have privileges when installing the dependencies as well as when changing the ownership of /opt/app
both would not work with unprivileged users in the container ...
$ podman inspect ghcr.io/asciinema/asciinema-server:latest | jq -r '.[0].History[]|.created_by'
/bin/sh -c #(nop) ADD file:7625ddfd589fb824ee39f1b1eb387b98f3676420ff52f26eb9d975151e889667 in /
/bin/sh -c #(nop) CMD ["/bin/sh"]
RUN /bin/sh -c apk add --no-cache libstdc++ tini bash ca-certificates rsvg-convert ttf-dejavu pngquant # buildkit
WORKDIR /opt/app
COPY /opt/app/_build/prod/rel/asciinema . # buildkit
RUN /bin/sh -c chgrp -R 0 /opt/app && chmod -R g=u /opt/app # buildkit
COPY .iex.exs . # buildkit
ENV PORT=4000 ADMIN_BIND_ALL=1 DATABASE_URL=postgresql://postgres@postgres/postgres RSVG_FONT_FAMILY=Dejavu Sans Mono PATH=/opt/app/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENTRYPOINT ["/sbin/tini" "--"]
CMD ["/opt/app/bin/server"]
EXPOSE map[4000/tcp:{}]
my suggestion is to add a line USER 1001
# or which ever id one likes
to the Dockerfile in front of the line ENTRYPOINT
Thanks for investigating further. I think we only need root in the builder image. In the final image it should be possible to use a regular user indeed.
Describe the bug Is there any possibility to increase the debug level in asciinema-server ? I am hitting following issue and cannot identify, what asciinema wants ...
To Reproduce Steps to reproduce the behavior:
Expected behavior output of more hintful messages to identify what should be fixed
Versions: