An application that will use a local postgres database and when deployed setup and use a Cloud SQL Database
Install Docker Desktop
- To make sure we can run multiple container go to Docker>Preferences>Resources and in "Memory" make sure you have selected > 4GB
Follow the instructions for your operating system.
If you already have a preferred text editor, skip this step.
cd database-server
- Start docker shell
sh ./docker-shell.sh
- Can exit the docker shell without shutting down by typing
ctrl+d
- Can reconnect to docker shell by typing...
- Check migration status:
dbmate status
- To shut down docker container, type
ctrl+c
dbmate new base_tables
dbmate new seed_data
dbmate up
(see db/migrations for what tables are created)
dbmate rollback
dbmate dump
dbmate status
cd api-service
- Start docker shell
sh ./docker-shell.sh
To install a new python package use pipenv install requests
from the docker shell
To run development api service run uvicorn_server
from the docker shell
Test the API service by going to http://0.0.0.0:9000/
- We want to run the local database-server before api-service because we want to have the API set up a connection to the database