Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

cloud - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch when building a streamlit web app on Heroku

I was building a web application on Heroku and encountered this issue:

2020-10-24T03:56:57.857273+00:00 app[web.1]: You can now view your Streamlit app in your browser.
2020-10-24T03:56:57.857320+00:00 app[web.1]: 
2020-10-24T03:56:57.857675+00:00 app[web.1]: Network URL: http://172.17.131.6:8501
2020-10-24T03:56:57.857819+00:00 app[web.1]: External URL: http://34.202.9.122:8501
2020-10-24T03:56:57.857932+00:00 app[web.1]: 
2020-10-24T03:56:59.458188+00:00 app[web.1]: 2020-10-24 03:56:59.458 Generating new fontManager, this may take some time...
2020-10-24T03:57:41.000000+00:00 app[api]: Build succeeded

2020-10-24T03:57:52.127634+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-10-24T03:57:52.147741+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-10-24T03:57:52.252583+00:00 heroku[web.1]: Process exited with status 137
2020-10-24T03:57:52.301275+00:00 heroku[web.1]: State changed from starting to crashed
2020-10-24T03:57:53.705631+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=okc-thunder-rebounds.herokuapp.com request_id=a90bb347-f583-4bec-8a6c-37bfea93908e fwd="71.232.30.113" dyno= connect= service= status=503 bytes= protocol=https

My setup.sh is like:

mkdir -p ~/.streamlit/
  
echo "
[general]

email = "qemail@domain.com"

" > ~/.streamlit/credentials.toml

echo "
[server]

headless = true

enableCORS=false

port = $PORT

" > ~/.streamlit/config.toml

And my Procfile is like:

web: sh setup.sh && streamlit run rebound_app.py

Where does it go wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The application must bind to the port provided by Heroku via the $PORT env variable. This is a requirement for every Web Dyno.

You need to pass the $PORT to streamlit

echo PORT $PORT
streamlit run  --server.port $PORT rebound_app.py

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...