簡體   English   中英

使用 Azure 計算實例在遠程 HTTPS 上配置 Streamlit 服務器

[英]Streamlit server configuration on remote HTTPS using Azure Compute Instance

我正在嘗試在 Azure 計算實例資源上托管 Streamlit 應用程序。

似乎可以通過https://{instanceName}-{internalPort}.northeurope.instances.azureml.ms訪問實例(中間有 Azure 提供的安全層)。

為了對此進行抽煙測試,我創建了一個簡單的 Flask 應用程序並驗證了我可以訪問它:我能夠在https://[REDACTED]-5000.northeurope.instances.azureml.ms/上訪問我的虛擬應用程序。


嘗試 1:基本配置

現在我想為我的 Streamlit 應用程序提供服務。 最初我想消除錯誤源並簡單地檢查電線是否連接正確,我的應用程序很簡單:

import streamlit as st

st.title("Hello, World!")

運行這個 streamlit 應用程序 ( streamlit run sl_app.py ) 給出:

2022-03-28 11:49:38.932 Trying to detect encoding from a tiny portion of (13) byte(s).
2022-03-28 11:49:38.933 ascii passed initial chaos probing. Mean measured chaos is 0.000000 %
2022-03-28 11:49:38.933 ascii is most likely the one. Stopping the process.

  You can now view your Streamlit app in your browser.

  Network URL: http://[REDACTED]:8501
  External URL: http://[REDACTED]:8501

嘗試通過https://[REDACTED]-8501.northeurope.instances.azureml.ms/訪問此應用程序,我可以訪問該應用程序,但“請稍候...”指示器無限期出現:

在此處輸入圖像描述

嘗試 2:更新 Streamlit 配置

遠程運行時 App 未加載的啟發 症狀 #2 我創建了一個 Streamlit config.toml 並重新配置了服務器/瀏覽器訪問點,結果如下:

[browser]
serverAddress = "[REDACTED]-8501.northeurope.instances.azureml.ms"
serverPort = 80
gatherUsageStats = false

[server]
port = 8501
headless = true
enableCORS = false
enableXsrfProtection = false
enableWebsocketCompression = false

現在運行應用程序可以得到:


  You can now view your Streamlit app in your browser.

  URL: http://[REDACTED]-8501.northeurope.instances.azureml.ms:80

但是,我仍然得到無限的 Please wait-indicator。 深入研究會發現與 wss stream 相關的內容? 不管那是什么?

在此處輸入圖像描述

我懷疑我所看到的是由於 Azure 自動將我的請求從http://傳送到https:// ,而這出於某種原因拒絕了 Streamlit 使用的 stream 組件?


注意:為了安全起見,已刪除各種 IP 地址和主機名:-)

這里發生的主要問題是訪問 SSL 證書。 這是在 Azure 上部署 streamlit 的完美指南。

https://towardsdatascience.com/beginner-guide-to-streamlit-deployment-on-azure-f6618eee1ba9

https://towardsdatascience.com/beginner-guide-to-streamlit-deployment-on-azure-part-2-cf14bb201b8e

第一個鏈接是部署,沒有任何錯誤,第二個鏈接是使用 SSL 證書激活,使 URL 從 HTTP 變為 HTTPS。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM