From 6f87c34858694a53fd3ddc8757e3a53c5b5e0fdf Mon Sep 17 00:00:00 2001 From: Michael Chow Date: Mon, 16 Mar 2020 16:50:43 -0400 Subject: [PATCH 1/2] add nginx to docker-compose for temporary scaling on linode --- docker-compose.yml | 11 ++++++++++- nginx.conf | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index f90ac249..d1baf2b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,17 @@ version: '3.1' services: + nginx: + image: nginx:latest + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - app + ports: + - "${PORT}:80" + app: build: . restart: always ports: - - "${PORT}:8000" + - "8000" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..97d3bc5d --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +user nginx; + +events { + worker_connections 1000; +} +http { + server { + listen 80; + location / { + proxy_pass http://app:8000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; + } + } +} From 0e57af12a4a31befea424d870bae09e2649729d5 Mon Sep 17 00:00:00 2001 From: Michael Chow Date: Mon, 16 Mar 2020 16:53:13 -0400 Subject: [PATCH 2/2] update readme for docker w/ multiple containers --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9e1c1716..b6954a2b 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,9 @@ Copy `.env.example` to be `.env` and run the container. ```bash cp .env.example .env docker-compose up + +# or to scale the number of streamlit containers +# docker-compose up --scale app=4 ``` You should be able to view the app via `localhost:8000`. If you want to change the