hackoregon / transportation-system-backend

2018 repo for the transportation api backend
MIT License
8 stars 2 forks source link

Gunicorn setup #40

Closed bhgrant8 closed 6 years ago

bhgrant8 commented 6 years ago

This branch is meant to address #24 Create a Deploy Ready version of Crash API Specifically:

znmeb commented 6 years ago

I have zero expertise in Gunicorn - there must be someone else who can review this ;-)

kiniadit commented 6 years ago

Not the most familiar with this either. Will we be using Nginx as the web server with Gunicorn as the gateway?

https://codingstartups.com/deploy-django-nginx-gunicorn-postgresql-supervisor/

bhgrant8 commented 6 years ago

By using WhiteNoise (http://whitenoise.evans.io/en/stable/), combined with the load balancing we are using through AWS, we are actually able to cut out the need for nginx, and simplify the stack. Gunicorn then functions as the http server directly and can host static files in production mode through this plugin.

Ignoring the exact implementation steps in favor of the ones in official docs linked above, this blog post is a good overview of the benefits/costs of this approach: http://andrealmar.com/2016/03/django-whitenoise/

I'll note here that we are not using a CDN at this time, and would rather not worry about this unless we find a need to scale in this way.

kiniadit commented 6 years ago

Ok, thanks for sharing. I tested this earlier today and runs fine. I'm ok with merging this.