Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container cannot start (when using local and init_if_not_exists db?) when running with uid/gid set #855

Open
DiamondJoseph opened this issue Jan 22, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@DiamondJoseph
Copy link
Contributor

To be able to mount the DLS filesystem at Diamond from the cluster, a pod must be running as non-root, with a uid/gid mapped to a kubernetes user with appropriate permissions on the filesystem to read/write files.

Deploying a known working configuration of tiled into the kubernetes cluster does not work after changing who the pod is running as:

podSecurityContext:
  runAsUser: <uid>
  runAsGroup: <gid>
  
securityContext:
  runAsUser: <uid>
  runAsGroup: <gid>

logs-from-tiled-in-tiled-7d7fbccd59-hnfbn.log

I'm assuming it has something to with creating the sqlite database?

This is otherwise using the default Helm configuration:

  authentication:
    allow_anonymous_access: false
  trees:
    - path: /
      tree: catalog
      args:
        uri: "sqlite+aiosqlite:////storage/catalog.db"
        writable_storage: "/storage/data"
        init_if_not_exists: true
@DiamondJoseph DiamondJoseph added the bug Something isn't working label Jan 22, 2025
@DiamondJoseph
Copy link
Contributor Author

I believe the solution is allowing the Dockerfile to accept args of UID/GID and making a user with those IDs, but I am not sure whether it is required for all of the stages of the Dockerfile?

Are there any requirements for containerised tiled to be running as root?

@danielballan
Copy link
Member

We run it is non-root in production. I think your theory is plausible.

@DiamondJoseph
Copy link
Contributor Author

It's definitely the permissions on the /storage directory that are the issue for startup: I've added a emptyDir overriding that directory while I'm still fiddling with temporary database.

Would be nice to have clearer logging when failing to start due to the db failing to be created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants