GithubHelp home page GithubHelp logo

letsc0d / dev-using-db Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dlops-io/dev-using-db

0.0 0.0 0.0 286 KB

Dev using Postgres & GCP Cloud SQL

Shell 9.08% JavaScript 53.09% Python 17.89% CSS 3.64% HTML 4.69% Dockerfile 11.62%

dev-using-db's Introduction

Development using a Database

An application that will use a local postgres database and when deployed setup and use a Cloud SQL Database

Prerequisites

Install Docker

Install Docker Desktop

Ensure Docker Memory

  • To make sure we can run multiple container go to Docker>Preferences>Resources and in "Memory" make sure you have selected > 4GB

Install VSCode

Follow the instructions for your operating system.
If you already have a preferred text editor, skip this step.

Database Server

  • 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

Create a new migration script

These would have no tables created, and will update the schema.sql

dbmate new base_tables

dbmate new seed_data

Running Migrations

dbmate up (see db/migrations for what tables are created)

dbmate rollback

dbmate dump

dbmate status

API Service

  • 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

dev-using-db's People

Contributors

shivasj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.