Steven Levine
Steven Levine

Reputation: 61

Run multiple Dash Apps under Nginx, Gunicorn, Flask & Docker

My project attempts to run multiple Dockerized (not limited) Dash apps which all use Flask with HTTP WSGI served by Gunicorn, Proxied by Nginx. This has been outlined somewhat by Plot.ly/Dash founder @chriddyp and others. A requirement is to serve the Dash apps via HTTPS which can easily be done with Letsencrypt certs that are straightforward to install.

Problem: Should this be divided into multiple Docker containers, ie: Nginx on main container, Dash/Flask/Gunicorn on each app container and the SSL certs on the front-end proxy (Nginx container)?

Would this require Docker SDN (software-defined-networking) approaches to make it work?

This is to run on my plain EC2 in AWS. (Not Beanstalk)

Any guidance will be appreciated. I will share everything on Github once it is working.

Upvotes: 2

Views: 2003

Answers (1)

Dusan Gligoric
Dusan Gligoric

Reputation: 584

One container per application, so one for Nginx, one for Gunicorn, one for Dash and one for Flask.

You wont need Docker's host network but certainly its a plus since you can resolve other containers hostnames, so when proxy passing for example you can do http://dash if your Dash container has dash hostname.

I suggest using Docker Compose for all this as it will make things lots easier.

If you run Gunicorn over unix socket you will need a volume to share to Nginx container so it can access it.

Not sure if there are some special things related to EC2 and Docker as sadly I dont have AWS knowledge. Someone will fill in on this :)

Upvotes: 2

Related Questions