Open DasWookie opened 2 years ago
I've made changes to the config TRYING to get sygil working on my local network. This is the config I used to test that the "hello" streamlit demo worked, and it connects with no problem at all. config.toml.txt
So, it doesn't APPEAR to be the config.toml settings that's stopping sygil from connecting from another machine on the local network. I've seared and troubleshot this as far as I can go, but it seems to me to be a issue with the sygil code and the connection only being allowed from localhost.
I've used the bone stock config as well as making just about every permutation of changes to headless, address, port, enableCORS, enableXsrfProtection, serverAddress, and serverPort. I can't get it to work, Here is my current config file for the streamlit config.toml. This works for streamlit hello, but NOT for sygil!
[global]
disableWatchdogWarning = false
showWarningOnDirectExecution = true
dataFrameSerialization = "arrow"
[logger]
level = "info"
%(asctime)s.%(msecs)03d %(message)s
. See Python's documentation for available attributes.messageFormat = "%(asctime)s %(message)s"
[client]
caching = true
displayEnabled = true
showErrorDetails = true
[runner]
magicEnabled = true
installTracer = false
fixMatplotlib = true
postScriptGC = true
fastReruns = false
[server]
folderWatchBlacklist = []
fileWatcherType = "auto"
cookieSecret = ""
headless = true
runOnSave = false
address = "192.168.1.7"
port = 7860
baseUrlPath = ""
server.enableXsrfProtection
is on and server.enableCORS
is off at the same time, we will prioritize server.enableXsrfProtection
.server.enableXsrfProtection
is on and server.enableCORS
is off at the same time, we will prioritize server.enableXsrfProtection
.maxUploadSize = 200
maxMessageSize = 200
enableWebsocketCompression = false
[browser]
gatherUsageStats = false
[mapbox]
token = ""
[deprecation]
showfileUploaderEncoding = true
showPyplotGlobalUse = true
[theme]
base = "dark"
So, it is NOT a firewall setting, or my streamlit config.toml that's the issue. That I know for certain now. I just don't know what the problem is for why I'm not able to connect from any other machines on the same network. Again, this worked previously!
@DasWookie I think it's an issue with the address, the port is probably fine, you need to set the address in the config file to 0.0.0.0 or your server IP under the [server]
section, another option is to launch streamlit with the --server.address 0.0.0.0
argument, also, make sure the serverAddress
under the browser section is also set as well as the port for that, those are used for CORS and XSRF, for some reason it also sometimes conflicts with the server address and it's taken from there instead of the server section, another thing to keep in mind is that command line arguments take priority over the streamlit config file, so, try launching streamlit with streamlit run scripts\webui_streamlit.py --logger.level info --server.headless True --server.address 0.0.0.0 --browser.serverAddress 0.0.0.0
, note the --server.headless True
if you are on a server this might be needed as streamlit will try to open a browser on launch which sometimes can have issues and stop the whole app on a server without a desktop.
OK, I tried that, and was able to connect successfully with using either: streamlit run scripts\webui_streamlit.py --logger.level info --server.headless True --server.address 0.0.0.0 --browser.serverAddress 0.0.0.0 and streamlit run scripts\webui_streamlit.py --logger.level info --server.headless True --server.address 192.168.1.7 --browser.serverAddress 192.168.1.7
So, I then changed my config.toml file for both the server section "address" and browser section "serverAddress" to have either 0.0.0.0 or 192.168.1.7 and both settings allowed a connection from machines on the local network. The headless setting seems to have gotten changed at least twice in the history, and the serverAddress = "localhost" value in the file bone stock certainly isn't helping.
The settings are probably getting changed because of the Settings page on the UI, I made it so you can customize the address and port from there and I had to add a default value for when those things were not set, probably having conflicts with it, also, in case you wonder, you can disable those options from the user config file so they are not shown there on the UI in case you plan to expose the UI on a remote server or just so you can connect from outside your home network, find the admin section on the config file and change the two options there.
yeah, the problem is, to access the config page, you have to have a working version. If one runs their linux server is headless (as I do) then the settings page isn't accessible with the default settings for the config.toml. I get there are MANY use cases, and there is no perfect solution. I beat my head against this rock for almost a week before posted the question on Discussions, and after getting nothing there and doing my own troubleshooting, I finally escalated this to an issue.
So a change of the following in your .streamlit/config.toml file: [server] headless = true address = "0.0.0.0"
[browser] serverAddress = "0.0.0.0"
seems to get it working. I don't know if that would be acceptable to modify in the .streamlit/config.toml or not. The 0.0.0.0 might end up confusing a lot of people who want to copy the string emitted by the launcher where localhost works for them.
@DasWookie yup, that should fix it but as you say it might or more like it already has people confused when they see the http://0.0.0.0:8501
address on their console and try to open it on the browser, so, I have no other option but to aim to please the guys with little tech knowledge and make it easy for them to understand things and then for the guys that want to run things on a server or other way just point them to where to edit stuff so they can make things work.
Btw, you should join our discord, I'm always there and a lot of other people as well so helping with this kind of issue or any other is a lot easier, you can also just join to chat with the community or to share the results you've gotten with our UI on our Showcase channels :)
Discussed in https://github.com/Sygil-Dev/sygil-webui/discussions/1640
This is something specific to Sygil! I can run "streamlit hello" on the server in the same conda environment with the same config.toml config file, and I'm able to connect no problem from any of the other machines on the same network. I even changed the port number even to 7860 (instead of 8501) just to make sure that isn't the issue, it wasn't, but I'm doing the test just to prove that it's not a firewall issue on the server or client machines on the same network.
So, I can connect to other streamlit apps on the linux server, on either port 7860 and 8501, but I still am unable connect to streamlit sygil server. This WORKED! I have been using it since the streamlit server was initially released. I haven't been able to track it down to which change broke it, but it's not working anymore.