You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a virtual environment: python -m venv .venv
.venv\Scripts\Activate.ps1 - You will have to do this every time you want to run this. Windows: .venv\Scripts\Activate.ps1, Linux/Mac: source .venv/bin/activate
(Optional) python -m pip install --upgrade pip
pip install -r requirements.txt
Go here: https://console.firebase.google.com/project/pantry-ai-db083/settings/serviceaccounts/adminsdk and Generate a new private key and drag the json file into this folder (not app). Make sure that it is named service-account.json and that it will not be committed (it is in the gitignore). Then create a .env file and add a field called FIREBASE_API_KEY. Then go to firebase, click on 1 app, then on the settings cog, and scroll down to the firebaseConfig object. You will see apiKey as one of the fields. Similar thing here, this should not be committed.
To run dev (good for using insomnia/postman) - fastapi dev app/main.py.
If you want to run and get it working with the mobile app, do fastapi run app/main.py which will host it on port 8000. To get the ip on windows go to ipconfig on Windows.
When you are done, Ctrl+c and then type deactivate to deactivate the venv.
Basic setup to host on Google Cloud run
Make sure that the two for prod lines are uncommented and the two local dev lines are commented out in main.py (change this back when committing) (might need to do this: gcloud config set project pantry-ai-db083)
gcloud run deploy --image gcr.io/pantry-ai-db083/backend --platform managed --allow-unauthenticated --execution-environment gen1 --max-instances 5 --cpu 1 --memory 1Gi (specs can be changed as needed). Do not set min-instances and especially don't set it to something >0 for the time being!