hackforla / hackforla/peopledepot
Add gunicorn and Whitenoise, and set up Dockerfile-aws and entrypoint-aws.sh
- Dominant language
- Python
- Stars
- 14
- Forks
- 37
- Avg merge
- 9d 15h
- Merged PRs (30d)
- 5
Description
### 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
- [Django static files guide](https://testdriven.io/blog/django-static-files/)
- [Whitenoise in Docker Deployment](https://testdriven.io/blog/deploying-django-to-heroku-with-docker/#whitenoise)
- [How to test whitenoise config](https://whitenoise.readthedocs.io/en/stable/django.html#how-do-i-know-it-s-working)
- [Deploying whitenoise where django is not at the root of the domain](https://whitenoise.readthedocs.io/en/stable/django.html#deploying-an-application-which-is-not-at-the-root-of-the-domain)
**Parent Issue**: #219
**Blocked by**: #219 sub-issue "Split requirements into dev and AWS"
Contributor guide
Assessment
This issue has not been assessed yet.