DurhamARC / ManyFEWS

The Many Flood Early Warning System
GNU General Public License v3.0
7 stars 3 forks source link

Switch WSGI gateway to Gunicorn and add TLS #86

Closed sjmf closed 1 year ago

sjmf commented 2 years ago

Deployment using the django debug server is bad practice. For deployment, we should serve the app via a uWSGI gateway like gunicorn. Further, it will be desirable to serve the app over https.

This will require the following changes to the Docker configuration:

sjmf commented 2 years ago

This task is almost complete with commit 100621b. Production deployment can be achieved by pulling the repo and running the command:

docker-compose -f docker-compose.yml -f production.yml up -d

Almost.

This would be the case if there wasn't a port-binding conflict between traefik and nginx. Nginx is bound to port 80 in development. Need to test if changing this back to 8000 will also allow forwarding with traefik.

sjmf commented 1 year ago

81760399 reset the default port to 8000. To override this, create a file docker-compose.override.yml with the following contents:

version: '3.6'
services:
  web:
    ports:
      - "80:80/tcp

Then run:

docker-compose up -d

docker-compose.override.yml is in the .gitignore file as of commit 0a459d8. To perform a production deployment with SSL, simply create this file with the contents of production.yml, e.g.:


cp production.yml docker-compose.override.yml