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

Automate cloud functions deployment #45

Closed
marvinmarnold opened this issue Jul 7, 2023 · 4 comments
Closed

Automate cloud functions deployment #45

marvinmarnold opened this issue Jul 7, 2023 · 4 comments

Comments

@marvinmarnold
Copy link
Collaborator

marvinmarnold commented Jul 7, 2023

Notes

There are three servers:

  • NextJS frontend: Vercel, autodeployments working
  • Postgres DB for saving queries: Supabase, autodeployments not necessary yet
  • Endpoint for LLM computation: Google Cloud Functions, autodeployment removed because wasn't working

Only the cloud functions are in scope. Additional notes:

  • There are a bunch of unused functions. Those were for tests and can be ignored.
  • Currently using 4GB of memory for deployments, eg:
gcloud functions deploy getanswer \
    --gen2 \
    --runtime=python310 \
    --memory=4GB \
    --region=us-east1 \
    --source=packages/googlecloud/functions/getanswer \
    --entry-point=getanswer \
    --trigger-http \
    --allow-unauthenticated \
    --set-env-vars OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }}
  • Not sure why deployments were failing before. One known issue is adding unnecessary quotes to OPENAI_API_KEY. Typically failed deployments manifest with CORS errors when the web client attempts to invoke the function.
  • OPENAI_API_KEY env var is already stored in GIthub.

Acceptance criteria

  • Deploys to getanswer when PR merged into prod branch.
  • prod branch created. Write protections added to Github to prevent direct pushes.
  • Deploys to getanswer-staging when PR merged into main branch.
  • Bonus: Anything easy we can do to have a custom ephemeral function for each PR? In another project we are using git hashes, but it requires a nontrivial amount of code.
@nikkag
Copy link
Collaborator

nikkag commented Jul 7, 2023

Reactivated the workflow for staging: On a push to main, the code will deploy to getanswer-staging
3974df9

@nikkag
Copy link
Collaborator

nikkag commented Jul 7, 2023

Build failed
Will investigate more later on to see what went wrong. For now I redeployed the staging function using the zip.

@nikkag
Copy link
Collaborator

nikkag commented Jul 14, 2023

Moving cache files out of the repo and using dvc to manage them seems to have fixed the issue!

Will give ephemeral functions for PRs more thought.

@marvinmarnold
Copy link
Collaborator Author

Awesome. I'm not 100% sure but I think those large files will perpetually cause bloat in git history and increase the download size to clone. Created an issue to deal with that eventually.

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

No branches or pull requests

3 participants