Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -41,8 +41,6 @@ services:

streamlit:
build: streamlit/
# ports:
# - "30081:8501"
expose:
- "8501"
networks:
Expand All @@ -57,6 +55,7 @@ services:
build: nginx/
ports:
- "30081:443"
- "30080:8081"
networks:
- mongoNetwork
depends_on:
Expand Down
51 changes: 37 additions & 14 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 3 additions & 3 deletions streamlit/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down