Deploy web app in Heroku Basic plan

After deploy my web app in Heroku Eco and Basic plan my web app can’t sleep.
How can I sove this problem?

Hey @Deivison,

Thanks for sharing your question! Can you clarify what you mean by “can’t sleep”?

2 Likes

My web app never sleeps and it’s consuming my dynos hours in Heroku Eco Basic plan.
I’m searching a way to set Heroku to force web app to sleeps after 30 minutes without activity.

My Procfile: web: sh setup.sh && streamlit run app.py

My setup.sh file:
"mkdir -p ~/.streamlit/

echo "
[general]\n
email = "myemail@xxxx.com"\n
" > ~/.streamlit/credentials.toml

echo "
[server]\n
headless = true\n
enableCORS=false\n
port = $PORT\n
" > ~/.streamlit/config.toml"

Thanks a lot Caroline !!

Hello @Deivison,

generally when you use Heroku as hosting service, it should manage sleeping times automatically. Here is part of its docs:

When Do Apps Sleep?

When an app on Heroku has only one web dyno and that dyno doesn’t receive any traffic in 1 hour, the dyno goes to sleep.

When someone accesses the app, the dyno manager will automatically wake up the web dyno to run the web process type. This causes a short delay for this first request, but subsequent requests will perform normally.

Apps that have more than 1 web dyno running never go to sleep and worker dynos (or other process types) are never put to sleep.

Your problem may simply be that some users are visiting your app, waking up the processes

1 Like

Thanks a lot for this answer @PaleAlex !!

But my web app don’t receive traffic after midnight. I’m sure about this.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.