Intro to Backend Development
  • Introduction
  • SP25 Syllabus
  • Apply to Take the Course
  • Getting Started
  • Weekly Feedback Form
  • Ed Discussion
  • Intro to Backend SP25 Google Calendar
  • Cheat Sheets
    • Assignment Requirements
    • Assignment FAQs
    • Error FAQs 😢
    • Concept FAQs
    • Postman
    • Command Line
    • Virtual Environment
  • Chapters
    • 1. Routes
      • Pre-Class TODO's
      • Lecture
      • Assignment Handout
      • API Specification
    • 2. Databases
      • Pre-Class TODO's
      • Lecture
      • Demo
      • Assignment Handout
      • API Specification
    • 3. Relational Databases
      • Pre-Class TODO's
      • Lecture
      • Demo
      • Assignment Handout
      • API Specification
    • 4. Abstractions
      • Pre-Class TODO's
      • Lecture
      • Demo
      • Assignment Handout
      • API Specification
    • 5. Containerization
      • Pre-Class TODO's
      • Docker Installation
      • Lecture
      • Demo
      • Assignment Handout
    • 6. Deployment
      • Lecture
      • Demo
      • Assignment Handout
    • 7. Images
      • Demo
      • Assignment Handout
    • 8. Authentication
      • Lecture
      • Demo
      • Assignment Handout
    • (Work in Progress) OAuth
      • Pre-Class TODO's
      • Lecture
      • Demo
      • OAuth 2.0 vs OpenID
      • Flask / OpenID example
  • Additional Topics
    • Git and Github
    • HackOurCampus
  • Other AppDev Courses
    • Intro to iOS Development
    • Intro to Android Development
    • Intro to Digital Product Design
  • Deprecated
    • Previous Semester Syllabi
      • FA22 Syllabus
      • SP22 Syllabus
      • FA21 Syllabus
      • SP21 Syllabus
      • FA20 Syllabus
      • SP20 Syllabus
    • Deployment Pre-Class TODO's
    • PA6 Assignment Handout
    • Deployment Demo
    • Final Project (Spring 2019)
      • Final Project Award Winners
Powered by GitBook
On this page
  • Assignment Scope
  • 1. Use your existing PA4 code
  • 2. Create your Dockerfile & Docker Compose File, Create a Docker Image, then Push Image to Docker Hub
  • 3. Replace your current README.txt
  • 4. Submit Assignment
  • Challenges
  • Tier I
  • Tier II
  • Total Points to Gain: 3

Was this helpful?

  1. Chapters
  2. 5. Containerization

Assignment Handout

Contributors: Alicia Wang, Conner Swenberg, Alanna Zhou, Shungo Najima

PreviousDemoNext6. Deployment

Last updated 2 months ago

Was this helpful?

Assignment Scope

Due Date: Monday 4/28, 11:59pm

You will be creating a Docker image of your CMS assignment and pushing it to Docker Hub!

We will be grading your submissions by simply running docker-compose up -d, so make sure that your docker-compose.yml file is pointing to your Docker Hub image, not a local one!

1. Use your existing PA4 code

Make sure that you use what you submitted for PA4, and that at least one endpoint works (you can note this in your README.txt). We will not be running test cases against your PA4 code to grade your PA5 submission. Then, create your Dockerfile and docker-compose.yml in your src folder as we did in the demo!

2. Create your Dockerfile & Docker Compose File, Create a Docker Image, then Push Image to Docker Hub

Watch the demo if you forgot how to do this!

Make sure you name your Docker image <your Docker Hub username>/<what you'd like to name your repository> . Kate did this in demo as well. Not doing this will lose you some style points!

3. Replace your current README.txt

Replace your current README.txt with the one below. Fill out the required fields as usual, and answer the questions for full credit!

If you have trouble answering the questions, watch the lecture video. Each question is answered there.

4. Submit Assignment

4a. Fill out your README.txt

You should have a newer version of README.txt as mentioned above!

4b. Zip and submit your assignment files

Make sure that your docker-compose.yml file is pointing to your Docker Hub image, not a local tag. We will grade your submissions by running docker-compose up -d and then testing the route you designated in your README to see if your application is running properly as a Docker container.

Next, zip the starter folder and submit on CMS. For reference, your directory structure should look like the following:

pa5/
 |-README.txt
 |-postman_collection.json
 |-src/
    |-app.py
    |-db.py
    |-Dockerfile
    |-docker-compose.yml
    |-requirements.txt

For clarification, this means that you SHOULD NOT include your virtual environment, pycache, or .db file in your final submission. Doing so will lose you a few points on the project.

4c. Submit Feedback Form

Challenges

Tier I

+1 point

Use a Different Python Distribution

Choose a different python distribution to use other than a basic version of python and write about what makes that distribution unique and its potential use cases. We expect upwards of 3 sentences in your README.

Tier II

+1 points +1 point more if Tier I completed

Add Gunicorn Workers

To install gunicorn, simply pip install gunicorn and don't forget to add your version to the requirements.txt file!

Once you have your desired Gunicorn command to spawn our additional workers, we recommend writing it in a start_server.sh file. We can execute a .sh file with a sh <file>.sh command. We like to place our Gunicorn command in this .sh file because it makes our lives easier by not having to remember the exact command every time we want to run our app.

Now replace sh start_server.sh as our new command to run in our Docker container (don't forget to rebuild your image with the new requirements and start_server.sh file!).

Total Points to Gain: 3

You can check that your Docker Hub image exists if you go to and find under your Docker Hub username, the tag that you've pushed!

To receive credit for your assignment, you must fill out the so that we can better understand how effectively we are teaching and how long students are spending on assignments.

When running our application on a server (our end goal), there are many improvements we can make to our application with regards to how we run it. python app.py is a basic way to run an application, but we can try other methods. Gunicorn is one of these methods and you can read about it . For this exercise, we want you to use Gunicorn to spawn 4 "workers" to run our application, essentially quadrupling our ability to handle incoming requests (hardware permitting).

Read about crafting your gunicorn command.

https://hub.docker.com/
feedback form
here
here
745B
README.txt