Skip to content

Add gunicorn and Whitenoise, and set up Dockerfile-aws and entrypoint-aws.sh #672

Description

@fyliu

Overview

Set up a production-ready Docker configuration for AWS deployment using gunicorn as the WSGI server and Whitenoise for static file serving. This builds on the split requirements from the previous issue.

Action Items

  • Add gunicorn and whitenoise to app/requirements-aws.in
  • Recompile app/requirements-aws.txt
  • Create or update app/Dockerfile-aws to:
    • Use requirements-aws.txt instead of requirements.txt
    • Run python manage.py collectstatic --noinput during the build
    • (Use single-stage build for now—optimization comes later)
  • Create or update app/entrypoint-aws.sh to:
    • Run database migrations if needed
    • Start gunicorn as the WSGI server (e.g., gunicorn peopledepot.wsgi:application --bind 0.0.0.0:8000)
  • Update app/peopledepot/settings.py to configure Whitenoise:
    • Add 'whitenoise.middleware.WhiteNoiseMiddleware' to MIDDLEWARE (near the top, after SecurityMiddleware)
    • Set STATIC_ROOT and STATIC_URL appropriately
    • Optionally configure WHITENOISE_AUTOREFRESH or other Whitenoise settings
  • Test that the Dockerfile builds successfully and the entrypoint runs without errors

Acceptance Criteria

  • Dockerfile-aws builds successfully and uses requirements-aws.txt
  • entrypoint-aws.sh exists and starts gunicorn
  • Whitenoise is configured in Django settings
  • Static files are collected during the Docker build
  • The app starts and serves static files when the container runs
  • Single-stage build (no multi-stage optimization yet)

References

Parent Issue: #219
Blocked by: #219 sub-issue "Split requirements into dev and AWS"

Metadata

Metadata

Labels

complexity: mediumStraightforward but some complexity (e.g., involves multiple files)dockerPull requests that update docker codefeature: infrastructureFor changes on site technical architecturerole: dev opss: PD teamstakeholder: People Depot Teamsize: 2ptCan be done in 7-12 hours
No fields configured for Feature.

Projects

Status
🆕New Issue Review

Relationships

None yet

Development

No branches or pull requests

Issue actions