Skip to content

Download prisma binaries on build time - #13

Merged
mateo-di merged 26 commits into
carto/mainfrom
feature/sc-505348/re-review-outbound-traffic-writable-volumes
Oct 9, 2025
Merged

Download prisma binaries on build time#13
mateo-di merged 26 commits into
carto/mainfrom
feature/sc-505348/re-review-outbound-traffic-writable-volumes

Conversation

@mateo-di

Copy link
Copy Markdown
Collaborator

Title

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

@mateo-di
mateo-di marked this pull request as ready for review September 30, 2025 20:10
@mateo-di mateo-di self-assigned this Sep 30, 2025
@mateo-di
mateo-di changed the base branch from main to carto/main October 2, 2025 02:23
- Update litellm-proxy-extras to look for Prisma CLI in correct location
  (/app/.cache/prisma-python/binaries/node_modules/.bin/prisma)
- Dockerfile properly pre-caches Prisma binaries during build
- Enable offline mode to prevent npm downloads at runtime (403 errors)
- Add PRISMA_OFFLINE_MODE=true environment variable support
- Remove unnecessary npm install step that was failing
- Prisma Python package already installs CLI to /app/.cache/prisma-python/binaries/
- Update all references from nodeenv to binaries directory
- Fix symlink to point to correct location
- Simplify Dockerfile and remove redundant installation steps
- Simplify Python utils.py to use single known path for Prisma CLI
- Remove unnecessary verification steps from Dockerfile
- Consolidate environment variables into cleaner format
- Remove redundant mkdir and debugging commands
- Focus on essential functionality only
- Add create_views.py from db_scripts to runtime image
- Makes it available at /app/create_views.py for downstream images
- Eliminates need to copy this file in child Dockerfiles
- Add intelligent detection for when to run view creation
- Skip gracefully if no DATABASE_URL or non-PostgreSQL database
- Handle connection issues without showing errors (DB might not be ready)
- Add silent mode via CREATE_VIEWS_SILENT environment variable
- Only show errors for actual problems, not expected conditions
@mateo-di
mateo-di merged commit 8ea1bba into carto/main Oct 9, 2025
2 checks passed
mateo-di added a commit that referenced this pull request Nov 22, 2025
Root cause: Commit b2a56a2 removed NPM_CONFIG_CACHE and
PRISMA_BINARY_CACHE_DIR env vars from runtime prisma generate, causing
403 errors when Prisma tried to download from npm registry.

Solution: Restore env vars to tell Prisma to use pre-cached binaries
from builder stage at /app/.cache/prisma-python/binaries.

This fixes the Cloud Run error:
npm ERR! 403 403 Forbidden - GET https://registry.npmjs.org/prisma

Related: PR #13 (original working implementation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant