|
1 |
| -# docker-gunicorn-proxy |
| 1 | +# gunicorn-proxy |
2 | 2 |
|
3 |
| -It is highly recommended to put a reverse proxy in front of Gunicorn. This |
4 |
| -project provides a turnkey reverse proxy for gunicorn in a Docker environment. |
| 3 | +`gunicorn-proxy` is a turnkey reverse proxy for gunicorn in a Docker |
| 4 | +environment. |
5 | 5 |
|
6 |
| -The Gunicorn docs recommend nginx, but this project use HAProxy for the more |
7 |
| -robust proxy features. Notably, HAProxy offers request queuing, which we use |
8 |
| -for load shedding during times of excessive load. (nginx does have queuing |
9 |
| -functionality, but it's only available in the commercial version.) |
| 6 | +As well as being simple to set up, this has the additional benefit of load |
| 7 | +shedding. Under high load, the proxy will return 503 errors for a portion of |
| 8 | +requests. This allows the application to maintain acceptable response times |
| 9 | +for some requests and fail quickly for others. The proxy also allows health |
| 10 | +checks to skip the queue, so health checks will continue to succeed as long as |
| 11 | +the application continues to serve requests. |
| 12 | + |
| 13 | +Although this project is entitled `gunicorn-proxy`, there are few |
| 14 | +gunicorn-specific features and this will most likely be effective for any |
| 15 | +HTTP-speaking application server. |
10 | 16 |
|
11 | 17 | ## Getting Started
|
12 | 18 |
|
13 | 19 | This project is available from Docker Hub as
|
14 | 20 | [luhn/gunicorn-proxy:0.2](https://hub.docker.com/r/luhn/gunicorn-proxy).
|
15 | 21 |
|
16 |
| -Get your gunicorn running in a container. Then run this project, using the |
17 |
| -`SERVER` environment variable to point it at your gunicorn container. For |
18 |
| -example, this might look like: |
| 22 | +Get your gunicorn running in a container. Then run this project, setting the |
| 23 | +`SERVER` environment variable to the hostname and port of your application and |
| 24 | +`CONCURRENCY` to the number of workers running. For example, this might look |
| 25 | +like: |
19 | 26 |
|
20 | 27 | ```bash
|
21 | 28 | docker run --link gunicorn -e "SERVER=gunicorn:8080" -e "CONCURRENCY=4" luhn/gunicorn-proxy
|
22 | 29 | ```
|
23 | 30 |
|
24 |
| -Set `CONCURRENCY` to the number of gunicorn workers you have. |
25 |
| - |
26 | 31 | ## Configuration
|
27 | 32 |
|
28 | 33 | The proxy is configured via environment variables.
|
|
0 commit comments