Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 3.01 KB

README.md

File metadata and controls

40 lines (31 loc) · 3.01 KB

DCC Python/Django Example


This application is a Django API that will maintain a log of date/timestamps for requests to the /access endpoint


Requirements

  • Port: The application runs on port 8000
  • Environment Vars:
    • ACCESS_LOG_LOC: Define the directory where the access log will be stored, otherwise it will default to a temp directory. This is useful for configuring a volume to store the access log file so it will be persisted. This variable is optional.
  • Volumes: The access log, by default, is stored in a temp directory and will be lost when the container restarts. To persist the file, in conjunction with setting the ACCESS_LOG_LOC env variable we can create a volume for that location and have the log be stored in EFS

How to Run

  • The app start command is python3 manage.py runserver

DCC Deployment

  • This repository contains both a Dockerfile and a Procfile; the deployment can be done with either mechanism.

  • Create the EFS share to hold the access log

  • Setup the repository connection

  • Configure the build - this demonstrates a BuildPack build, to create with a Dockerfile, set the BuildType to "Dockerfile" and set the Dockerfile Name to the match the Dockerfile in the root of this repo ("Dockerfile"). Note the 'procfile entry' field matches the key of the field from the repository Procfile that contains the application startup command.

  • Set the port to the port this application will run on, 8000. Modify the scale/ram/cpu to meet your needs.

  • Set the health check endpoint to use the designated route the application provides; the expected response is a 200.

  • Set the listener path to listen on the root

  • In the add-ons, add the ACCESS_LOG_LOC environment variable. This should reference the container path where the log file should be stored.

  • In the add-ons, add a volume for the location defined in the previous step, using the EFS share that was created in step 1. Mounting this directory as a volume will persist the log file between container reboots.