litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: OpenShift Deployment starts without Prisma

Open abeltre1 opened this issue 4 months ago • 2 comments

What happened?

Problem:

In this issue, the default litellm command within the LiteLLM container attempts to execute prisma generate within a directory facing two significant challenges that must be addressed on OpenShift for the command to successfully write to the directory:

  • Permissions: The target path, /usr/local/lib/python3.11/site-packages/prisma/, is mounted as read-only.
  • Overwriting: The file schema.prisma, already present at the target path, cannot be overwritten. This is due to the function call shutil.copy(data.schema_path, packaged_schema) attempting to overwrite schema.prisma.

Solution:

  1. Build Without Prisma Schema: A straightforward solution would be to construct the upstream container without including the Prisma schema at the path /usr/local/lib/python3.11/site-packages/prisma/schema.prisma.
  2. Rebuild with Adjusted Permissions and File Removal: A more involved solution entails using the upstream container as a base and then rebuilding the LiteLLM image with adjusted permissions to allow writing to the directory and removing the pre-existingschema.prismafile. This way we can execute litellm command can execute prisma generate without encountering issues.

It is worth highlighting that OpenShift permissions are stricter security policies.

Relevant log output

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/prisma/generator/generator.py",
line 112, in run
self._on_request(request)
File "/usr/local/lib/python3.11/site-packages/prisma/generator/generator.py",
line 170, in _on_request
self.generate(data)
File "/usr/local/lib/python3.11/site-packages/prisma/generator/generator.py",
line 255, in generate
shutil.copy(data.schema_path, packaged_schema)
File "/usr/local/lib/python3.11/shutil.py", line 431, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/local/lib/python3.11/shutil.py", line 258, in copyfile
with open(dst, 'wb') as fdst:
^^^^^^^^^^^^^^^
OSError: [Errno 30] Read-only file system: '/usr/local/lib/python3.11/site-packa
ges/prisma/schema.prisma'


### Twitter / LinkedIn details

_No response_

abeltre1 avatar Oct 08 '24 01:10 abeltre1