udacity / cd0157-Server-Deployment-and-Containerization

Server Deployment and Configuration project. This was formerly the nd0044 course 4 project.
76 stars 2.9k forks source link

Deploying a Flask API

This is the project starter repo for the course Server Deployment, Containerization, and Testing.

In this project you will containerize and deploy a Flask API to a Kubernetes cluster using Docker, AWS EKS, CodePipeline, and CodeBuild.

The Flask app that will be used for this project consists of a simple API with three endpoints:

The app relies on a secret set as the environment variable JWT_SECRET to produce a JWT. The built-in Flask server is adequate for local development, but not production, so you will be using the production-ready Gunicorn server when deploying the app.

Prerequisites

Initial setup

  1. Fork the Server and Deployment Containerization Github repo to your Github account.
  2. Locally clone your forked version to begin working on the project.
    git clone https://github.com/SudKul/cd0157-Server-Deployment-and-Containerization.git
    cd cd0157-Server-Deployment-and-Containerization/
  3. These are the files relevant for the current project:
    .
    ├── Dockerfile 
    ├── README.md
    ├── aws-auth-patch.yml #ToDo
    ├── buildspec.yml      #ToDo
    ├── ci-cd-codepipeline.cfn.yml #ToDo
    ├── iam-role-policy.json  #ToDo
    ├── main.py
    ├── requirements.txt
    ├── simple_jwt_api.yml
    ├── test_main.py  #ToDo
    └── trust.json     #ToDo 

Project Steps

Completing the project involves several steps:

  1. Write a Dockerfile for a simple Flask API
  2. Build and test the container locally
  3. Create an EKS cluster
  4. Store a secret using AWS Parameter Store
  5. Create a CodePipeline pipeline triggered by GitHub checkins
  6. Create a CodeBuild stage which will build, test, and deploy your code

For more detail about each of these steps, see the project lesson.