diff --git a/compose.yaml b/compose.yaml index d8931bc..78c1c58 100644 --- a/compose.yaml +++ b/compose.yaml @@ -28,8 +28,8 @@ services: # Build our local container connect it to the mongo bridge network and expose port 80 so we can access the API fastapi: build: . - ports: - - "30080:80" + expose: + - "80" networks: - mongoNetwork secrets: @@ -41,8 +41,6 @@ services: streamlit: build: streamlit/ - # ports: - # - "30081:8501" expose: - "8501" networks: @@ -57,6 +55,7 @@ services: build: nginx/ ports: - "30081:443" + - "30080:8081" networks: - mongoNetwork depends_on: diff --git a/nginx/nginx.conf b/nginx/nginx.conf index b3b68e3..75eb80f 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -17,20 +17,43 @@ server { } location /_stcore/stream { # most important config - resolver 127.0.0.11 valid=1s ipv6=off; - set $stream streamlit:8501/_stcore/stream; - proxy_pass http://$stream; - proxy_http_version 1.1; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header Upgrade $http_upgrade; - proxy_redirect off; - proxy_set_header Connection "upgrade"; - proxy_read_timeout 86400; + resolver 127.0.0.11 valid=1s ipv6=off; + set $stream streamlit:8501/_stcore/stream; + proxy_pass http://$stream; + proxy_http_version 1.1; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_redirect off; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; + + } + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + rewrite_log on; + error_log /var/log/nginx/localhost.error_log notice; +} + +server{ + listen 8081 ssl; + server_name sb-binsight.dri.oregonstate.edu; + sendfile on; + client_max_body_size 100M; + ssl_certificate /etc/ssl/certs/cert.pem; + ssl_certificate_key /run/secrets/sslKey; + + location / { + resolver 127.0.0.11 valid=1s ipv6=off; + set $fastapi fastapi; + proxy_pass http://$fastapi; + proxy_http_version 1.1; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_redirect off; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400; } - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - rewrite_log on; - error_log /var/log/nginx/localhost.error_log notice; } diff --git a/streamlit/streamlit.py b/streamlit/streamlit.py index a75644d..a6384b2 100644 --- a/streamlit/streamlit.py +++ b/streamlit/streamlit.py @@ -18,7 +18,7 @@ # Future update should include drop-down menu for device serial number # Will require mapping to device IDs DEVICE_ID = "c00ef8a4d3dda476" -BASE_URL = "http://sb-binsight.dri.oregonstate.edu:30080/api" +BASE_URL = "https://sb-binsight.dri.oregonstate.edu:30080/api" st.set_page_config(layout="wide") # Run the autorefresh about every 5000 milliseconds (5 seconds) and stop @@ -31,7 +31,7 @@ API_KEY = os.getenv("API_KEY") logging.info(f"BAD DEBUG: {API_KEY}") -client = httpx.Client() +client = httpx.Client(verify=False) def get_user_creds() -> dict: @@ -83,7 +83,7 @@ def extract_zip(img_b: io.BytesIO) -> None: def get_latest_detection() -> dict: - client = httpx.Client() + client = httpx.Client(verify=False) img_info = get_image_info(DEVICE_ID, client)["items"][0] file_name = get_img_path(img_info) img_path = get_image(DEVICE_ID, file_name)