melkortf / tf2-servers

TF2 server in Docker container - multiple images for various purposes
MIT License
37 stars 11 forks source link

Add OverlayFS support to do runtime layering #142

Open stevefan1999-personal opened 6 months ago

stevefan1999-personal commented 6 months ago

It is something like this: https://www.baeldung.com/linux/overlayfs-usage

For example, we have can have a special folder called tf2-overlay and then it will merge the content into the tf2 folder, so we can cleanly separate custom assets (such as sound, materials, maps and models) into a different folder that is ReadWriteMany shared in Kubernetes.

If native overlayfs support was not detected, we have to fall back to use fuse-overlayfs: https://github.com/containers/fuse-overlayfs.

Of course, another way to do it is to just embed those assets into the container images themselves.

FROM ghcr.io/melkortf/tf2-base:latest
COPY ./models/ tf2/models
COPY ./sounds/ tf2/sounds
...

But it comes with a cost of having to constantly track upstream image new version and I kind of hate to have a cron job for doing this when I can just have a minimal set of image that can quickly onboard a new node and share those assets with Ceph or NFS.

And worse, in containers, only the layers above can be shared, and every time I add my 20GB+ assets into the image, it is effectively duplicated again and causing a lot of disk problem (since I always have to start again with the latest base image).

garrappachc commented 6 months ago

I'll look into it with more depth, but for the moment: have you tried the podman's -O option or docker's --mount?

stevefan1999-personal commented 6 months ago

I'll look into it with more depth, but for the moment: have you tried the podman's -O option or docker's --mount?

I'm not using podman nor docker. I'm using Kubernetes

github-actions[bot] commented 18 hours ago

This issue is stale because it has been open for 60 days with no activity.