Giter VIP home page Giter VIP logo

birthdays's Introduction

Birthdays - Django App

App that accepts username and date of birth.

Shows Simple Happy Birthday Message or How many days to Birthday.

How to Use:

1. Add User Data:

POST: { "username": "string", date_of_birth: "YYYY-mm-dd"}

2. Get All Users Data:

GET: /hello/

3. Get Message For Specific User:

GET: /hello/<usermane>

Infrastructure Overview

System Diagram

Resources:

  1. Git + Google Cloud Source Repository:

    • Code Collaboration and Versioning
  2. GCS (Google Cloud Storage):

    • Kubernetes Yamls (deployments, services, ingress, secrets)
  3. Cloud Build:

    • Build and Deploy images to GKE
  4. Container Registry

    • Docker Image Repository
  5. GKE (Google Kubernetes Engine):

    • Application Container Cluster
  6. CloudSQL:

    • Private Network Application Database runnung Postgres
  7. Ingress:

    • External Exposure, LoadBalancing and SSL Termination
  8. Stackdriver:

    • Logging and future alerts
  9. VPC:

    • Internal conmmunication between cluster and database

Using Terraform to provision infrastructure:

Follow the Terraform Guide

Requirements

  • Docker Runtime Environment
  • Docker Compose

Run Unit Tests

There are 9 Tests in total under api/tests.py

Locally

python manage.py tests

CircleCI

circleci build

Run App Locally

Pre-Requisites

  • Rename .env.example to .env and update with necessary database details
  • Update docker-compose.yaml and .env file with correct database details

Run Command

docker-compose up

Acess in Browser

Shutdown Command

docker-compose down

Run in Production

Assumes you're using Cloud Source Respository otherwise:

Coopy Config to GCS bucket named {{PROJECT-ID}}-yaml:

  • .kubernetes/migration-job.yaml
  • .kubernetes/test-job.yaml

Flow


  1. Merge/Push Code to master
  2. Trigger Build (CloudBuild)
  3. Image stored in Container Registry
  4. CloudBuild Runs migration Job.
  5. CloudBuild image to pods in kubernetes cluster

Recommendation: Prefer Git Tags for Production instead on Branch

New Cluster


  1. Create Secrets:

     kubetcl apply -f .kubernetes/secrets.yaml
    
  2. Create the Migration Job

     kubectl apply -f .kubernetes/migration-job.yaml
    
  3. Create the Deployment

     kubectl apply -f .kubernetes/deployment.yaml
    
  4. Create the Service

     kubectl apply -f .kubernetes/service.yaml
    
  5. Create the LoadBalancer

     kubectl apply -f .kubernetes/ingress.yaml
    
  6. Point DNS to LoadBalancer IP Address.


Happy Birthday? - Thank You!

Feel free to drop a feedback (kudos and critics are welcome): [email protected]

birthdays's People

Contributors

emmanuelstroem avatar dependabot[bot] 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.