hoanghm / Proact

2 stars 0 forks source link

Launch internal web/API server #3

Closed ogallagher closed 2 months ago

ogallagher commented 2 months ago

primary branch = feature/backend-gemini

Host and deploy our internal server with a single example API endpoint. The server will be written in python.

Dependencies

ogallagher commented 2 months ago

I think @hoanghm suggested Google Cloud run free tier to host this?

ogallagher commented 2 months ago

I added a google cloud API key to the project, which we should be able to use to connect the server to various services (ex. cloud storage, firestore).

ogallagher commented 2 months ago

Below instructions were adapted from https://firebase.google.com/docs/hosting/cloud-run

  1. Install google cloud cli https://cloud.google.com/sdk/docs/install and run gcloud init. Confirm gcloud is configured.
    
    gcloud config list
    [core]
    account = owengall@icloud.com
    disable_usage_reporting = True
    project = gemini-goalkeeper-2024

Your active configuration is: [default]

2. Configure docker container in `gemini_proact_server/Dockerfile`.
3. Deploy docker image to container registry.

cd gemini_proact_server gcloud builds submit --tag gcr.io/gemini-goalkeeper-2024/gemini-proact-server

4. Deploy server image to google cloud run.

gcloud run deploy --image gcr.io/gemini-goalkeeper-2024/gemini-proact-server ... Service URL: https://gemini-proact-server--ue.a.run.app

ogallagher commented 2 months ago
Access to XMLHttpRequest at 'https://gemini-proact-server-<id>-ue.a.run.app/apikey/gemini' 
from origin 'http://localhost:55277' has been blocked by CORS policy: 
No 'Access-Control-Allow-Origin' header is present on the requested resource.