Once the container is built, you need to switch to Node 18 in your terminal using nvm:
nvm use 18Before running the script, you need to set up the database URLs in your environment variables. The following environment variables are required:
PRISMA_API_USERS_URL- Database connection URL for API UsersPRISMA_API_MEDIA_URL- Database connection URL for API MediaPRISMA_USERS_URL- Database connection URL for Users (optional), this is a SQLite Database used to temporarily store user data needed for other objects.GOOGLE_APPLICATION_JSON- Firebase database to save usersOKTA_TOKEN- needed to validate user's SSO GUID against.
These should be set in your .env file in the project root.
Important: Before pulling the schema, the environment variables (PRISMA_API_USERS_URL and PRISMA_API_MEDIA_URL) must point to the production database to pull the schema.
Once the database URLs are configured to point to production, pull the schema using the pull command:
pnpm prisma:pullAfter pulling the schema:
- If you want to run the script locally, change the environment variables to point to your container database
- If you want to run scripts against stage or prod, keep the environment variables pointing to the respective production databases
After setting up the environment variables and pulling the schema, you can run the script. The script supports the following commands:
build-cache- Build document cache by migrating documents from Couchbaseingest- Ingest documents from cache into Core
First, ensure your .env file has the production database URLs:
PRISMA_API_USERS_URL→ production databasePRISMA_API_MEDIA_URL→ production database
pnpm prisma:pullIf you want to run the script locally, update your .env file to point to your container database:
PRISMA_API_USERS_URL→ local container databasePRISMA_API_MEDIA_URL→ local container database
pnpm dev build-cachepnpm dev ingest --pipeline users
pnpm dev ingest --pipeline playlists
pnpm dev ingest --pipeline allNote: If you want to run scripts against stage or prod, ensure your environment variables point to the respective production databases in your .env file.
reset:firebase is used to batch delete firebase users. be warned this is dangerous - only do this in dev environment.
This is becuase the email could be used to login to other Jesus Film Apps, ergo, this should only be used to test scripting in dev environments.